/**
 * Arkusz stylów frontowych i autoryzacyjnych wtyczki Vanguard CSP.
 * Obsługuje: Wirtualny Panel Autoryzacji (FrontendAuth), Tarczę Brute-Force (LoginProtection),
 * Sześcian 3D i tryb dostępności Quantum Shield, Ekran Blokady 418, Formularz Incydentów,
 * Licznik Sesji KSC oraz w pełni konfigurowalny moduł Najczęściej Czytane (czcionka, miniatury,
 * zaokrąglenia, linia rozdzielająca, nagłówki H2-H6 oraz układy kart/listy).
 * Pełna responsywność (RWD) i zgodność ze standardem WCAG 2.2 (poziom AA / AAA).
 *
 * @package           VanguardCSP
 * @author            Euro Media Press Sp. z o.o. - Michał Jabłoński
 * @copyright         Euro Media Press Sp. z o.o. 2026
 * @license           GPL-3.0-or-later
 */

:root {
    --vcsp-auth-width: 420px;
    --vcsp-auth-bg: #f4f6f8;
    --vcsp-auth-primary: #0e4874;
    --vcsp-auth-hover: #093252;
}

.is-hidden {
    display: none !important;
}

/* ==========================================================================
   1. Pułapki Honeypot oraz Data Poisoning (ukryte dla ludzi i czytników ekranu)
   ========================================================================== */
.vcsp-honeypot-trap,
.vcsp-poison-trap {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   2. Ekran blokady zapory WAF (HTTP 418 - Frontend.php)
   ========================================================================== */
body.vcsp-block-screen-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: #0d1117;
    color: #f0f6fc;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
}

.vcsp-block-screen-box {
    max-width: 520px;
    width: 100%;
    background-color: #161b22;
    border: 2px solid #d63638;
    padding: 36px 32px;
    text-align: center;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

.vcsp-block-screen-box h1 {
    margin: 0 0 14px 0;
    font-size: 1.6rem;
    letter-spacing: 1px;
    color: #ff6b6b;
}

.vcsp-block-screen-box p {
    margin: 0 0 22px 0;
    font-size: 1rem;
    line-height: 1.6;
    color: #e6edf3;
}

.vcsp-block-screen-node {
    display: inline-block;
    padding: 6px 14px;
    background-color: #0d1117;
    border: 1px solid #30363d;
    font-family: monospace;
    font-size: 0.85rem;
    color: #8b949e;
}

/* ==========================================================================
   3. Wirtualny Panel Autoryzacji (FrontendAuth.php)
   ========================================================================== */
body.vcsp-auth-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 16px;
    background-color: var(--vcsp-auth-bg);
    color: #1d2327;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    box-sizing: border-box;
}

.vcsp-auth-box {
    width: 100%;
    max-width: var(--vcsp-auth-width);
    background-color: #ffffff;
    border: 1px solid #8c8f94;
    padding: 32px 28px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
}

.vcsp-auth-box h2 {
    margin: 0 0 20px 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1d2327;
    text-align: center;
}

.vcsp-auth-subtext {
    margin: 0 0 20px 0;
    font-size: 0.95rem;
    line-height: 1.55;
    color: #2c3338;
    text-align: center;
}

.vcsp-injected-logo {
    text-align: center;
    margin-bottom: 20px;
}

.vcsp-injected-logo img {
    max-width: 220px;
    max-height: 84px;
    width: auto;
    height: auto;
    display: inline-block;
}

.vcsp-alert {
    padding: 12px 14px;
    margin-bottom: 18px;
    border-left: 4px solid #1d2327;
    font-size: 0.9rem;
    line-height: 1.5;
}

.vcsp-alert-error {
    background-color: #fcf0f1;
    border-left-color: #8a1113;
    color: #5c0809;
}

.vcsp-alert-success {
    background-color: #edfaef;
    border-left-color: #005c12;
    color: #00420d;
}

.vcsp-input-group {
    margin-bottom: 16px;
}

.vcsp-input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1d2327;
}

.vcsp-input-group input[type="text"],
.vcsp-input-group input[type="password"],
.vcsp-input-group input[type="email"],
.vcsp-input-group select,
.vcsp-input-group textarea {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    font-size: 1rem;
    color: #1d2327;
    background-color: #ffffff;
    border: 1px solid #50575e;
    border-radius: 0;
    box-sizing: border-box;
}

.vcsp-checkbox-inline {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #1d2327;
    cursor: pointer;
}

.vcsp-checkbox-inline input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
}

.vcsp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    padding: 10px 18px;
    margin-top: 8px;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    background-color: var(--vcsp-auth-primary);
    border: 1px solid var(--vcsp-auth-primary);
    border-radius: 0;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.vcsp-btn:hover,
.vcsp-btn:focus {
    background-color: var(--vcsp-auth-hover);
    border-color: var(--vcsp-auth-hover);
    color: #ffffff;
}

.vcsp-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.vcsp-links {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #dcdcde;
    text-align: center;
    font-size: 0.88rem;
}

.vcsp-links a {
    color: #0e4874;
    font-weight: 600;
    text-decoration: underline;
}

.vcsp-links a:hover {
    color: #093252;
}

.vcsp-links-sep {
    margin: 0 8px;
    color: #8c8f94;
}

/* Wskaźnik fokusu klawiatury WCAG 2.2 AAA */
.vcsp-auth-box a:focus-visible,
.vcsp-auth-box button:focus-visible,
.vcsp-auth-box input:focus-visible,
.vcsp-quantum-instance-wrapper button:focus-visible,
.vcsp-quantum-instance-wrapper input:focus-visible,
.vcsp-incident-form-card button:focus-visible,
.vcsp-incident-form-card input:focus-visible,
.vcsp-incident-form-card select:focus-visible,
.vcsp-incident-form-card textarea:focus-visible,
.vcsp-popular-container a:focus-visible {
    outline: 3px solid #0e4874 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

/* ==========================================================================
   4. Widżet Tarczy Logowania Brute-Force i Godzin Pracy (LoginProtection.php)
   ========================================================================== */
.vcsp-login-shield {
    background-color: #f6f7f7;
    border: 1px solid #8c8f94;
    padding: 14px 16px;
    margin: 0 0 18px 0;
    color: #1d2327;
    box-sizing: border-box;
}

.vcsp-login-shield-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 8px;
}

.vcsp-login-shield-track {
    width: 100%;
    height: 8px;
    background-color: #dcdcde;
    overflow: hidden;
    margin-bottom: 10px;
}

.vcsp-login-shield-bar {
    height: 100%;
    width: 100%;
    background-color: #005c12;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.vcsp-login-shield-bar.is-warn {
    background-color: #b26200;
}

.vcsp-login-shield-bar.is-locked {
    background-color: #8a1113;
}

.vcsp-login-shield-info {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #1d2327;
}

.vcsp-login-shield-timer {
    display: inline-block;
    margin-top: 4px;
    font-family: monospace;
    font-size: 1.25rem;
    color: #8a1113;
}

.vcsp-login-shield-footer {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #dcdcde;
    font-size: 0.75rem;
    color: #50575e;
    text-align: right;
}

.vcsp-login-shield-footer a {
    color: #0e4874;
    text-decoration: underline;
}

.vcsp-text-danger {
    color: #8a1113;
}

.vcsp-fw-bold {
    font-weight: 700;
}

.vcsp-wh-widget {
    border: 1px solid #8c8f94;
    padding: 16px;
    margin: 16px 0;
    background-color: #ffffff;
}

.vcsp-wh-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vcsp-wh-item {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px dashed #dcdcde;
    font-size: 0.92rem;
}

.vcsp-wh-item:last-child {
    border-bottom: none;
}

.vcsp-wh-hours {
    font-family: monospace;
    font-weight: 700;
    color: #005c12;
}

.vcsp-wh-closed {
    font-weight: 700;
    color: #8a1113;
}

/* ==========================================================================
   5. Tarcza Kwantowa 3D — Overlay oraz Inline (QuantumChallenge.php)
   ========================================================================== */
.vcsp-quantum-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background-color: rgba(13, 17, 23, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.vcsp-quantum-modal-card {
    width: 100%;
    max-width: 400px;
    background-color: #ffffff;
    color: #1d2327;
    border: 2px solid #0e4874;
    padding: 24px 22px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}

.vcsp-quantum-inline {
    border: 1px solid #8c8f94;
    background-color: #f6f7f7;
    padding: 16px;
    margin: 14px 0;
    text-align: center;
    box-sizing: border-box;
}

.vcsp-quantum-title {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: #0e4874;
}

.vcsp-quantum-brand {
    font-size: 0.78rem;
    margin-bottom: 6px;
}

.vcsp-quantum-brand a {
    color: #0e4874;
    text-decoration: none;
}

.vcsp-quantum-instruction {
    margin: 0 0 12px 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #1d2327;
    min-height: 24px;
}

.vcsp-quantum-color-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid #1d2327;
}

.vcsp-quantum-canvas-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    min-height: 200px;
}

.vcsp-quantum-canvas-container canvas {
    display: block;
    max-width: 100%;
    cursor: pointer;
    touch-action: manipulation;
}

.vcsp-wcag-toggle {
    background-color: #ffffff;
    color: #0e4874;
    border: 1px solid #0e4874;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
}

.vcsp-wcag-toggle:hover,
.vcsp-wcag-toggle:focus {
    background-color: #0e4874;
    color: #ffffff;
}

.vcsp-wcag-challenge {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #dcdcde;
    text-align: left;
}

.vcsp-wcag-question {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1d2327;
    margin-bottom: 8px;
}

.vcsp-wcag-controls {
    display: flex;
    gap: 8px;
}

.vcsp-wcag-answer {
    flex: 1;
    min-height: 38px;
    padding: 6px 10px;
    border: 1px solid #50575e;
    border-radius: 0;
    font-size: 1rem;
}

.vcsp-wcag-submit {
    min-height: 38px;
    padding: 6px 16px;
    background-color: #005c12;
    color: #ffffff;
    border: 1px solid #005c12;
    font-weight: 700;
    cursor: pointer;
    border-radius: 0;
}

.vcsp-quantum-verified-banner {
    padding: 12px 14px;
    margin: 12px 0;
    background-color: #edfaef;
    border: 1px solid #005c12;
    color: #00420d;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
}

/* ==========================================================================
   6. Formularz Incydentów KSC/NIS2 oraz Licznik Sesji
   ========================================================================== */
.vcsp-incident-form-card {
    max-width: 680px;
    margin: 24px auto;
    padding: 28px;
    background-color: #ffffff;
    border: 1px solid #8c8f94;
    box-sizing: border-box;
}

.vcsp-incident-form-title {
    margin: 0 0 18px 0;
    font-size: 1.3rem;
    color: #1d2327;
}

.vcsp-incident-auth-notice {
    padding: 16px;
    background-color: #f6f7f7;
    border-left: 4px solid #0e4874;
    color: #1d2327;
    font-weight: 600;
}

.vcsp-session-timer-inline {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background-color: #f6f7f7;
    border: 1px solid #8c8f94;
    font-size: 0.88rem;
    color: #1d2327;
}

.vcsp-extend-btn-front {
    padding: 4px 10px;
    background-color: #0e4874;
    color: #ffffff;
    border: 1px solid #0e4874;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0;
}

/* ==========================================================================
   7. Moduł Najczęściej Czytane (PopularPostsWidget — pełna personalizacja)
   ========================================================================== */
.vcsp-popular-container {
    --vcsp-pop-font: inherit;
    --vcsp-pop-title-size: 15px;
    --vcsp-pop-title-weight: 600;
    --vcsp-pop-title-color: #1d2327;
    --vcsp-pop-accent: #0e4874;
    --vcsp-pop-meta: #50575e;
    --vcsp-pop-thumb-size: 56px;
    --vcsp-pop-thumb-radius: 6px;
    --vcsp-pop-div-style: solid;
    --vcsp-pop-div-color: #dcdcde;
    --vcsp-pop-gap: 12px;

    font-family: var(--vcsp-pop-font);
    width: 100%;
    box-sizing: border-box;
}

.vcsp-popular-section-heading {
    margin: 0 0 14px 0;
    font-family: var(--vcsp-pop-font);
    color: var(--vcsp-pop-title-color);
    line-height: 1.3;
}

.vcsp-popular-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.vcsp-popular-item {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: var(--vcsp-pop-gap) 0;
    box-sizing: border-box;
}

/* Obsługa włączonej lub wyłączonej linii rozdzielającej */
.vcsp-popular-list.has-divider .vcsp-popular-item {
    border-bottom: 1px var(--vcsp-pop-div-style) var(--vcsp-pop-div-color);
}

.vcsp-popular-list.has-divider .vcsp-popular-item:first-child {
    padding-top: 2px;
}

.vcsp-popular-list.has-divider .vcsp-popular-item:last-child {
    border-bottom: none;
    padding-bottom: 2px;
}

.vcsp-popular-list.no-divider .vcsp-popular-item {
    border-bottom: none;
    padding: calc(var(--vcsp-pop-gap) * 0.65) 0;
}

/* Wariant układu: Osobne karty z obramowaniem */
.vcsp-popular-list.is-layout-cards .vcsp-popular-item {
    padding: 12px 14px !important;
    margin-bottom: var(--vcsp-pop-gap);
    background-color: #ffffff;
    border: 1px var(--vcsp-pop-div-style) var(--vcsp-pop-div-color) !important;
    border-radius: 6px;
}

.vcsp-popular-list.is-layout-cards .vcsp-popular-item:last-child {
    margin-bottom: 0;
}

/* Wariant układu: Kompaktowy */
.vcsp-popular-list.is-layout-compact .vcsp-popular-item {
    gap: 10px;
}

.vcsp-popular-rank {
    font-family: monospace;
    font-size: 1rem;
    font-weight: 800;
    color: var(--vcsp-pop-accent);
    min-width: 26px;
    line-height: 1;
    flex-shrink: 0;
}

.vcsp-popular-thumb {
    flex: 0 0 var(--vcsp-pop-thumb-size);
    width: var(--vcsp-pop-thumb-size);
    height: var(--vcsp-pop-thumb-size);
    border-radius: var(--vcsp-pop-thumb-radius);
    overflow: hidden;
    display: block;
    line-height: 0;
}

.vcsp-popular-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--vcsp-pop-thumb-radius) !important;
    display: block !important;
    margin: 0 !important;
}

.vcsp-popular-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Reset nagłówków H2-H6 wewnątrz elementu listy, aby przejmowały skonfigurowaną czcionkę */
.vcsp-popular-container .vcsp-popular-heading {
    margin: 0 !important;
    padding: 0 !important;
    font-family: var(--vcsp-pop-font) !important;
    font-size: var(--vcsp-pop-title-size) !important;
    font-weight: var(--vcsp-pop-title-weight) !important;
    line-height: 1.35 !important;
    letter-spacing: normal;
    text-transform: none;
}

.vcsp-popular-link {
    color: var(--vcsp-pop-title-color) !important;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

.vcsp-popular-link:hover,
.vcsp-popular-link:focus {
    color: var(--vcsp-pop-accent) !important;
    text-decoration: underline;
}

.vcsp-popular-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.vcsp-popular-meta {
    font-size: 0.8rem;
    color: var(--vcsp-pop-meta);
    line-height: 1.3;
}

.vcsp-popular-date::before {
    content: "• ";
    margin-right: 4px;
}

.vcsp-popular-meta:first-child.vcsp-popular-date::before {
    content: "";
    margin-right: 0;
}

@media (max-width: 480px) {
    .vcsp-auth-box,
    .vcsp-incident-form-card,
    .vcsp-quantum-modal-card {
        padding: 20px 16px;
    }
}