/* ==========================================
   MATERIÁLY - STRÁNKOVÉ STYLY
   ========================================== */

/* --- VYHLEDÁVÁNÍ V MATERIÁLECH --- */
.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 14px 20px;
    transition: border-color 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.search-box:focus-within { border-color: var(--primary); }

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark);
}
.search-box input::placeholder { color: #94a3b8; font-weight: 500; }

/* Zvýraznit hledaný text */
mark.search-highlight {
    background: rgba(230, 57, 70, 0.18);
    color: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

/* Dark mode */
[data-theme="dark"] .search-box { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .search-box input { color: #e2e8f0; }
[data-theme="dark"] .search-box:focus-within { border-color: var(--primary); }

/* --- MATERIÁLY --- */
/* --- STYLY PRO SEZNAM MATERIÁLŮ (AKORDEON) --- */
.materials-list-section { padding: 60px 0; background: var(--bg-gray); min-height: 60vh; }

/* Lepsi vyuziti prostoru na sirokych monitorech */
.materials-list-section > .container {
    max-width: min(1700px, 94vw);
}

.materials-list-section .search-section .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.subject-category {
    background: white;
    margin-bottom: 15px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

summary {
    padding: 25px 35px;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--dark);
    transition: 0.3s;
}

summary:hover { background: #fdfdfd; }

.summary-content { display: flex; align-items: center; gap: 20px; }
.summary-content i { color: var(--primary); font-size: 1.5rem; width: 30px; text-align: center; }

.arrow { transition: 0.4s; font-size: 0.9rem; opacity: 0.5; }
details[open] .arrow { transform: rotate(180deg); color: var(--primary); opacity: 1; }

/* NOVÉ STYLY PRO MATURITNÍ OTÁZKY */
.subject-category {
    margin-bottom: 30px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

details summary {
    list-style: none;
    padding: 30px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
details summary::-webkit-details-marker { display: none; }

.summary-content { display: flex; align-items: center; gap: 20px; }
.summary-content i { font-size: 2rem; color: #e63946; }
.summary-content h2 { margin: 0; font-size: 1.4rem; font-weight: 800; }

.arrow { transition: transform 0.3s; color: var(--text-muted); font-size: 1.2rem; }
details[open] .arrow { transform: rotate(180deg); }

.question-group { border-top: 1px solid var(--border); }

@media (min-width: 1200px) {
    .question-group {
        column-count: 2;
        column-gap: 18px;
        padding: 16px;
        border-top: 1px solid var(--border);
    }

    .question-number-badge,
    .sub-question-list {
        break-inside: avoid;
    }

    .question-number-badge {
        margin: 0;
        border: 1px solid var(--border);
        border-bottom: 0;
        border-radius: 14px 14px 0 0;
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .sub-question-list {
        margin: 0 0 14px;
        border: 1px solid var(--border);
        border-top: 0;
        border-radius: 0 0 14px 14px;
        background: #ffffff;
        padding: 12px;
    }
}

.question-number-badge {
    background: #f1f5f9;
    color: #1e293b;
    padding: 12px 30px;
    font-weight: 900;
    font-size: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}
[data-theme="dark"] .question-number-badge { background: #161e2e; color: #fff; }

.sub-question-list {
    list-style: none;
    margin: 0;
    padding: 14px 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.sub-question-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
}

.sub-question-item .info {
    min-width: 0;
}

.q-text { font-weight: 700; color: var(--text-main); font-size: 1rem; display: block; }
.q-author { font-size: 0.75rem; color: var(--text-muted); display: block; margin-top: 5px; }
.q-author span { color: #e63946; font-weight: 600; }

.btn-download-main {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #e63946;
    color: white !important;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.75rem;
    white-space: nowrap;
    transition: all 0.3s;
}
.btn-download-main:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4); }

[data-theme="dark"] .sub-question-item {
    background: #0f172a;
    border-color: #334155;
}

@media (min-width: 1200px) {
    [data-theme="dark"] .sub-question-list {
        background: #0b1220;
        border-color: #334155;
    }

    [data-theme="dark"] .question-number-badge {
        border-color: #334155;
        background: #161e2e;
    }
}

@media (max-width: 900px) {
    .sub-question-list {
        grid-template-columns: 1fr;
        padding: 12px;
    }

    .sub-question-item {
        gap: 10px;
        padding: 14px;
    }

    .btn-download-main {
        justify-content: center;
        width: 100%;
    }
}

/* Aby schované otázky nezabíraly místo */
.sub-question-item {
    transition: background-color 0.3s ease;
}

/* ==========================================
   MATERIÁLY - REDESIGN (jen pro materials page)
========================================== */
.materials-page .materials-list-section {
    padding: 42px 0 96px;
    background:
        radial-gradient(900px 380px at 10% 0%, rgba(230, 57, 70, 0.07), transparent 60%),
        radial-gradient(900px 380px at 90% 0%, rgba(15, 23, 42, 0.06), transparent 60%),
        var(--bg-gray);
}

.materials-page .materials-list-section > .container {
    max-width: min(1760px, 96vw);
}

.materials-page .search-section {
    margin-bottom: 24px !important;
}

.materials-page .search-section .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.materials-page .search-box {
    border-radius: 18px;
    border-width: 1px;
    padding: 16px 20px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.materials-page .subject-category {
    margin-bottom: 28px;
    background: transparent;
    border: 0;
    border-radius: 24px;
    box-shadow: none;
    overflow: visible;
}

.materials-page .subject-category > details {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.09);
}

.materials-page details summary {
    padding: 22px 28px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.materials-page .summary-content {
    gap: 16px;
}

.materials-page .summary-content h2 {
    font-size: clamp(1rem, 1.45vw, 1.35rem);
}

.materials-page .summary-content p {
    margin-top: 4px !important;
}

.materials-page .question-group {
    border-top: 1px solid #e2e8f0;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    background: #f8fafc;
}

.materials-page .question-card {
    border: 1px solid #dbe5f1;
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.materials-page .question-number-badge {
    padding: 10px 14px;
    font-size: 0.86rem;
    border-bottom: 1px solid #dbe5f1;
    background: #f1f5f9;
}

.materials-page .sub-question-list {
    margin: 0;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    background: transparent;
    border: 0;
}

.materials-page .sub-question-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.materials-page .q-text {
    font-size: 0.93rem;
    line-height: 1.35;
}

.materials-page .q-author {
    margin-top: 6px;
    font-size: 0.72rem;
}

.materials-page .btn-download-main {
    width: 100%;
    justify-content: center;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    background: #fff5f6;
    color: #9f1239 !important;
    border: 1px solid #fecdd3;
    box-shadow: none;
}

.materials-page .btn-download-main i {
    color: #e11d48;
}

.materials-page .btn-download-main:hover {
    background: #ffe4e6;
    border-color: #fda4af;
    color: #881337 !important;
    box-shadow: 0 8px 18px rgba(190, 24, 93, 0.14);
}

.materials-empty-state {
    display: none;
    margin: 10px 0 0;
    padding: 26px 20px;
    border-radius: 18px;
    border: 1px dashed #cbd5e1;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    text-align: center;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.materials-empty-state i {
    font-size: 1.15rem;
    color: #be123c;
    margin-bottom: 8px;
}

.materials-empty-state h3 {
    margin: 0 0 6px;
    color: #0f172a;
    font-size: 1.1rem;
    font-weight: 900;
}

.materials-empty-state p {
    margin: 0;
    color: #64748b;
    font-weight: 600;
}

@media (max-width: 1300px) {
    .materials-page .question-group {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .materials-page .materials-list-section {
        padding: 36px 0 82px;
    }

    .materials-page .subject-category > details {
        border-radius: 18px;
    }

    .materials-page details summary {
        padding: 16px;
    }

    .materials-page .sub-question-list {
        grid-template-columns: 1fr;
    }
}

[data-theme="dark"] .materials-page .materials-list-section {
    background:
        radial-gradient(900px 380px at 10% 0%, rgba(230, 57, 70, 0.14), transparent 65%),
        radial-gradient(900px 380px at 90% 0%, rgba(59, 130, 246, 0.09), transparent 65%),
        #0b1220;
}

/* --- MODAL: MATERIAL SE PRIPRAVUJE --- */
.pending-material-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
}

.pending-material-modal.is-open {
    display: block;
}

.pending-material-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.64);
}

.pending-material-modal__panel {
    position: relative;
    width: min(680px, calc(100vw - 30px));
    margin: 9vh auto 0;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 26px 56px rgba(2, 6, 23, 0.32);
    padding: 18px 18px 16px;
}

.pending-material-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 0;
    background: transparent;
    color: #64748b;
    font-size: 1.05rem;
    cursor: pointer;
}

.pending-material-modal__panel h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: #0f172a;
    font-weight: 900;
}

.pending-material-modal__panel p {
    margin: 0 0 12px;
    color: #475569;
    font-weight: 600;
}

.pending-material-table-wrap {
    overflow-x: auto;
}

.pending-material-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.pending-material-table th,
.pending-material-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.9rem;
}

.pending-material-table th {
    background: #f8fafc;
    color: #334155;
    font-weight: 800;
}

.pending-material-table td {
    color: #1e293b;
    font-weight: 600;
}

.pending-material-table tbody tr:last-child td {
    border-bottom: 0;
}

[data-theme="dark"] .pending-material-modal__panel {
    background: #111827;
    border-color: #334155;
}

[data-theme="dark"] .pending-material-modal__panel h3 {
    color: #e2e8f0;
}

[data-theme="dark"] .pending-material-modal__panel p,
[data-theme="dark"] .pending-material-modal__close {
    color: #94a3b8;
}

[data-theme="dark"] .pending-material-table,
[data-theme="dark"] .pending-material-table th,
[data-theme="dark"] .pending-material-table td {
    border-color: #334155;
}

[data-theme="dark"] .pending-material-table th {
    background: #0f172a;
    color: #cbd5e1;
}

[data-theme="dark"] .pending-material-table td {
    color: #e2e8f0;
}

[data-theme="dark"] .materials-page .search-box {
    background: #111827;
    border-color: #334155;
    box-shadow: 0 14px 32px rgba(2, 6, 23, 0.55);
}

[data-theme="dark"] .materials-page .subject-category > details {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.5);
}

[data-theme="dark"] .materials-page details summary {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
}

[data-theme="dark"] .materials-page .question-group {
    background: #0b1220;
    border-top-color: #334155;
}

[data-theme="dark"] .materials-page .question-card {
    background: #111827;
    border-color: #334155;
}

[data-theme="dark"] .materials-page .question-number-badge {
    background: #1e293b;
    border-bottom-color: #334155;
}

[data-theme="dark"] .materials-page .sub-question-item {
    background: #0f172a;
    border-color: #334155;
}

[data-theme="dark"] .materials-page .btn-download-main {
    background: #2b1320;
    border-color: #7f1d3a;
    color: #fecdd3 !important;
}

[data-theme="dark"] .materials-page .btn-download-main i {
    color: #fb7185;
}

[data-theme="dark"] .materials-page .btn-download-main:hover {
    background: #3b1427;
    border-color: #9f1239;
    color: #ffe4e6 !important;
    box-shadow: 0 10px 20px rgba(244, 63, 94, 0.18);
}

[data-theme="dark"] .materials-empty-state {
    border-color: #334155;
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    box-shadow: 0 14px 30px rgba(2, 6, 23, 0.45);
}

[data-theme="dark"] .materials-empty-state h3 {
    color: #e2e8f0;
}

[data-theme="dark"] .materials-empty-state p {
    color: #94a3b8;
}
