/* Globální pseudo-3D stín pod tlačítka — viditelný bez hover (mobil) */
button, a.btn-login, .hero-btn, .cta-btn { box-shadow: 0 1px 0 0 #94A3B8; }

/* Skippable rendering off-screen → drasticky zrychluje rychlé scrolování
   na mobilu (Chrome/Edge/Safari 18+). Body je jediný scroll container,
   a bez content-visibility: auto renderuje paint engine celý strom na
   každý frame → checkerboarding (bílé tiles). contain-intrinsic-size
   rezervuje approximate výšku pro scrollbar positioning. */
.perf-contain {
    content-visibility: auto;
    /* Větší rezervace (400px) lépe pokryje rozbalené karty se seznamem
       souborů — menší layout shift při fast scrollu. Po prvním renderu
       browser stejně použije reálnou výšku (auto keyword). */
    contain-intrinsic-size: auto 400px;
    /* Layout/paint containment izoluje kartu od zbytku stránky —
       změna v jedné kartě nepřepočítá layout celého dokumentu. */
    contain: layout paint;
}
:root {
    --bg-color: #FFFFFF;
    --sidebar-bg: #FFFFFF;
    --text-color: #1E293B;
    --muted: #64748B;
    --border: #E2E8F0;
    --accent: #6891b3;
    --error: #cb8989;
    --card-bg: #F8FAFC;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Space Grotesk', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
}
@supports (height: 100dvh) {
    body { height: 100dvh; }
}
button, input, select, label {
    font-family: 'Space Grotesk', sans-serif;
}

* {
    box-sizing: border-box;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent) !important;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--text-color);
    border-radius: 3px;
    background: white;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background: white;
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-color);
}

/* Branding checkbox — žlutý okraj + žlutá fajfka pro vizuální soulad
   s žlutým rámečkem a textem celé sekce "+logo na projekt". */
input[type="checkbox"].branding {
    border-color: #c8b27a;
}
input[type="checkbox"].branding:checked::after {
    color: #c8b27a;
}

button:active {
    transform: translateY(1px);
}

select {
    -webkit-appearance: none;
    appearance: none;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748B'><path d='M1 4l5 5 5-5'/></svg>") no-repeat right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

input:disabled {
    background-color: var(--card-bg);
    color: #94A3B8;
    cursor: not-allowed;
    border-color: var(--border);
}

.error-field {
    border-color: var(--error) !important;
    background-color: #f4e7e7 !important;
}

.admin-input {
    padding: 6px;
    border: 1px solid #e9eef3;
    border-radius: 4px;
    width: 90%;
    font-size: 13px;
}

/* NOVÁ ARCHITEKTURA ROZLOŽENÍ */
body {
    display: flex;
    flex-direction: column;
}

#jp-header {
    flex-shrink: 0;
}

#root {
    flex: 1;
    width: 100%;
    overflow: hidden;
}

#app-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* Tenký scrollbar pro LoginScreen card */
.auth-card {
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}
.auth-card::-webkit-scrollbar { width: 6px; }
.auth-card::-webkit-scrollbar-track { background: transparent; }
.auth-card::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
.auth-card::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

.jp-md {
    font-family: 'Roboto Condensed', 'Segoe UI', system-ui, sans-serif;
    color: #334155;
    line-height: 1.6;
}
.jp-md-h1 {
    font-size: 18px;
    font-weight: 400;
    color: #1E293B;
    margin: 0 0 12px;
    line-height: 1.3;
}
.jp-md-h2 {
    font-size: 16px;
    font-weight: 400;
    color: #1E293B;
    margin: 18px 0 8px;
    line-height: 1.3;
}
.jp-md-h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1E293B;
    margin: 16px 0 6px;
    line-height: 1.3;
}
.jp-md-strong {
    color: #0F172A;
}
.jp-md-meta {
    font-size: 11px;
    color: #64748B;
    margin-bottom: 2px;
}
.jp-md-meta-block {
    margin-bottom: 12px;
}
.jp-md-meta-value {
    color: #1E293B;
}
.jp-md-bullet {
    margin-bottom: 1px;
    line-height: 1.3;
    color: #334155;
    font-size: 11px;
    padding-left: 12px;
}
.jp-md-bullet-comfy {
    margin-bottom: 4px;
    line-height: 1.6;
}
.jp-md-numbered {
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #1E293B;
}
.jp-md-numbered-comfy {
    line-height: 1.4;
}
.jp-md-separator {
    border: 0;
    border-bottom: 1px solid #E2E8F0;
    margin: 16px 0;
}
.jp-md-date {
    font-size: 11px;
    color: #334155;
    text-align: right;
    margin-top: 16px;
}
.jp-md-link {
    color: var(--accent);
    word-break: break-all;
}
.jp-md-link-counsel {
    color: #a966a2;
    text-decoration: underline;
    font-weight: 700;
}
.jp-md-table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
}
.jp-md-th {
    font-size: 11px;
    font-weight: 700;
    color: #1E293B;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid #CBD5E1;
    background: #F1F5F9;
}
.jp-md-td {
    font-size: 11px;
    color: #334155;
    padding: 5px 8px;
    border-bottom: 1px solid #E2E8F0;
    vertical-align: top;
}

/* HORNÍ LIŠTA */
#top-header {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 30px;
    height: 60px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 20;
}

/* PLOCHA POD LIŠTOU */
#content-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* LEVÉ MENU */
#sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    flex-shrink: 0;
}

/* HLAVNÍ OBSAH - Rozdělený na statickou a rolovací část */
#main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-color);
    position: relative;
}

#static-project-panel {
    padding: 30px 40px 10px 40px;
    flex-shrink: 0;
}

#scrollable-agent-area {
    flex: 1;
    overflow-y: auto;
    padding: 10px 40px 40px 40px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: 0.2s;
}

.menu-item:hover {
    background-color: #F8FAFC;
}

.menu-item.active {
    background-color: #e9eef3;
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 700;
}

.menu-item.active-counsel {
    background-color: #f3e8f3;
    color: #a966a2;
    border-left-color: #a966a2;
    font-weight: 700;
}

.menu-icon {
    margin-right: 12px;
    font-size: 18px;
    opacity: 0.7;
    filter: grayscale(100%);
}

.menu-item.active .menu-icon {
    opacity: 1;
    filter: grayscale(0%);
}

/* Scrollbar pro hezčí vzhled */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
}

.credit-badge {
    background: transparent;
    color: var(--text-color);
    border: none;
    padding: 4px 0;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.buy-button {
    width: 100%;
    margin-bottom: 12px;
    padding: 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    text-align: left;
    transition: 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.buy-button:hover {
    border-color: var(--accent);
    background: #e9eef3;
}

.buy-button-price {
    font-weight: 800;
    color: var(--text-color);
}

/* Mobilní tab-bar (schovaný na desktopu) */
.mobile-tab-bar {
    display: none;
    border-bottom: 1px solid var(--border);
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

.mobile-tab-bar button {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    transition: 0.2s;
}

.mobile-tab-bar button.active-scout {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.mobile-tab-bar button.active-counsel {
    color: #a966a2;
    border-bottom-color: #a966a2;
}

/* Vnořené bloky v pilířích */
.pillar-nested {
    margin-top: 10px;
    margin-left: 50px;
}

/* Formulář projekt — flex row */
.project-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.project-grid {
    display: flex;
    gap: 10px;
}
.project-grid > * {
    min-width: 0;
}
.project-grid > :first-child {
    flex: 1;
}
.project-grid > .grid-right {
    flex: 2;
    display: flex;
    gap: 10px;
}
.project-grid > .grid-right > * {
    min-width: 0;
}

/* Hero formulář */
.hero-form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.hero-form-row > * {
    min-width: 0;
}

.hero-grid {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}
.hero-grid > * {
    min-width: 0;
}
.hero-grid > :first-child {
    flex: 1;
}
.hero-grid > .grid-right {
    flex: 2;
    display: flex;
    gap: 15px;
}
.hero-grid > .grid-right > * {
    min-width: 0;
}

/* ── RESPONSIVE ──
   Mobile layout se aplikuje i v landscape na telefonu (výška < 600 px).
   Původní max-width: 768px ho propustil jen v portrétu; v landscape
   na moderním telefonu (např. iPhone 14 Pro 852×393) běžel desktop
   layout s overflow: hidden + height: 100vh → stránka se nedala
   posouvat, obsah pod foldem byl odříznutý.                         */
@media (max-width: 768px), (max-height: 600px) {
    #top-header {
        padding: 0 15px;
    }

    #top-header .header-subtitle {
        display: none;
    }

    #top-header .header-divider {
        display: none;
    }

    #content-wrapper {
        flex-direction: column;
    }

    #sidebar {
        display: none;
    }

    .mobile-tab-bar {
        display: flex;
    }

    #static-project-panel {
        padding: 15px 15px 10px 15px;
    }

    body {
        height: auto;
        min-height: 100dvh;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }
    @supports (min-height: 100dvh) {
        body { min-height: 100dvh; }
    }
    #root, #app-wrapper, #content-wrapper, #main-area {
        overflow: visible;
        height: auto;
    }
    #jp-header {
        position: sticky;
        top: 0;
        z-index: 30;
    }
    .mobile-tab-bar {
        position: sticky;
        top: var(--jp-header-h, 50px);
        z-index: 25;
    }
    #scrollable-agent-area {
        padding: 10px 15px 30px 15px;
        overflow: visible;
        flex: none;
    }

    .pillar-nested {
        margin-left: 15px;
    }

    .project-form-row {
        flex-direction: column;
    }

    .project-grid {
        flex-direction: column;
        gap: 15px;
    }
    .project-grid > .grid-right {
        flex-direction: column;
        gap: 15px;
    }

    .hero-form-row {
        flex-direction: column;
    }

    .hero-grid {
        flex-direction: column;
    }
    .hero-grid > .grid-right {
        flex-direction: column;
    }

    /* Admin panel: pilulkové zmenšené taby na mobilu */
    .admin-section-btn {
        padding: 5px 12px !important;
        font-size: 10px !important;
        border-radius: 999px !important;
        letter-spacing: 0.08em !important;
    }
    .admin-section-btn + .admin-section-btn {
        margin-left: -2px;
    }
}
