/* =============================================
   Scientific Magazine Archive — Dark Theme
   Designed for Avada / noomega.ba
   ============================================= */

/* --- CSS CUSTOM PROPERTIES --- */
.sma-archive {
    --sma-year-bg: #434549;
    --sma-edition-bg: #3a3d41;
    --sma-pdf-bg: #ff0000;
    --sma-accent: #ff0000;
    --sma-text: #f2f3f5;
    --sma-text-muted: #a0a3a8;
    --sma-border: rgba(255, 255, 255, 0.08);
    --sma-row-alt: rgba(255, 255, 255, 0.03);
    --sma-row-hover: rgba(255, 0, 0, 0.06);
}

/* --- CONTAINER --- */
.sma-archive {
    font-family: inherit;
    color: var(--sma-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- TOOLBAR (Search + Expand/Collapse) --- */
.sma-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sma-search-wrap {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.sma-search {
    width: 100%;
    padding: 10px 14px;
    background: #2c2e31;
    border: 1px solid var(--sma-border);
    border-bottom: 2px solid transparent;
    border-radius: 5px;
    color: var(--sma-text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s ease, background 0.25s ease;
}

.sma-search::placeholder {
    color: var(--sma-text-muted);
}

.sma-search:focus {
    border-bottom-color: var(--sma-accent);
    background: #333538;
}

.sma-toolbar-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sma-toolbar-buttons button {
    padding: 9px 18px;
    background: transparent;
    border: 1px solid var(--sma-accent);
    border-radius: 5px;
    color: var(--sma-accent);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.sma-toolbar-buttons button:hover {
    background: var(--sma-accent);
    color: #fff;
}

/* --- EMPTY STATE --- */
.sma-empty {
    padding: 40px 24px;
    text-align: center;
    color: var(--sma-text-muted);
    font-size: 15px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    border: 1px solid var(--sma-border);
}

/* --- YEAR LEVEL --- */
.sma-year {
    margin-bottom: 10px;
}

.sma-year-header {
    background: var(--sma-year-bg);
    color: var(--sma-text);
    padding: 16px 24px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--sma-accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: filter 0.25s ease, box-shadow 0.25s ease;
    user-select: none;
}

.sma-year-header:hover {
    filter: brightness(1.12);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35), -4px 0 8px rgba(255, 0, 0, 0.15);
}

.sma-year-header:focus-visible {
    outline: 2px solid var(--sma-accent);
    outline-offset: 2px;
}

.sma-year-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding-left: 22px;
    border-left: 2px solid var(--sma-border);
    margin-left: 12px;
}

.sma-year-body.is-open {
    max-height: 5000px;
}

/* --- EDITION LEVEL --- */
.sma-edition {
    margin: 6px 0;
}

.sma-edition-header {
    position: relative;
    background: var(--sma-edition-bg);
    color: var(--sma-text);
    padding: 12px 18px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 3px solid rgba(255, 0, 0, 0.5);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    transition: filter 0.25s ease, box-shadow 0.25s ease;
    user-select: none;
}

.sma-edition-header:hover {
    filter: brightness(1.1);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
}

.sma-edition-header:focus-visible {
    outline: 2px solid var(--sma-accent);
    outline-offset: 2px;
}

.sma-edition-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    padding-left: 8px;
}

.sma-edition-body.is-open {
    max-height: 5000px;
}

/* --- ARTICLE COUNT BADGE --- */
.sma-count {
    display: inline-block;
    background: var(--sma-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 12px;
    margin-left: 10px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

/* --- CSS CHEVRON --- */
.sma-chevron {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--sma-text);
    border-bottom: 2px solid var(--sma-text);
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.sma-chevron.is-open {
    transform: rotate(45deg);
}

/* --- TABLE — DARK THEME --- */
.sma-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 5px;
    overflow: hidden;
}

.sma-table thead th {
    background: #2c2e31;
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--sma-text-muted);
    border-bottom: 2px solid var(--sma-accent);
}

.sma-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--sma-border);
    font-size: 14px;
    vertical-align: middle;
    color: var(--sma-text);
}

.sma-table tbody tr:nth-child(even) {
    background: var(--sma-row-alt);
}

.sma-table tbody tr:last-child td {
    border-bottom: none;
}

.sma-table tbody tr:hover {
    background: var(--sma-row-hover);
}

/* Column widths */
.sma-table th:nth-child(1),
.sma-table td:nth-child(1) {
    width: 45%;
}

.sma-table th:nth-child(2),
.sma-table td:nth-child(2) {
    width: 40%;
}

.sma-table th:nth-child(3),
.sma-table td:nth-child(3) {
    width: 15%;
    text-align: center;
}

/* --- PDF BUTTON --- */
.sma-pdf-btn {
    display: inline-block;
    background: var(--sma-pdf-bg);
    color: #fff !important;
    padding: 6px 16px;
    border-radius: 5px;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sma-pdf-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.4);
}

.sma-no-pdf {
    color: var(--sma-text-muted);
}

/* --- EDITION PDF BUTTON (header) --- */
.sma-edition-pdf-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-block;
    background: var(--sma-pdf-bg);
    color: #fff !important;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    line-height: 1.4;
}

.sma-edition-pdf-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 0 12px rgba(255, 0, 0, 0.4);
}

/* --- SEARCH "NO RESULTS" --- */
.sma-no-results {
    padding: 24px;
    text-align: center;
    color: var(--sma-text-muted);
    font-size: 14px;
    display: none;
}

/* --- SEARCH HIGHLIGHT (hidden rows) --- */
.sma-article-row.sma-hidden {
    display: none;
}

.sma-edition.sma-hidden,
.sma-year.sma-hidden {
    display: none;
}

/* --- RESPONSIVE (≤768px) --- */
@media (max-width: 768px) {
    .sma-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sma-search-wrap {
        max-width: 100%;
    }

    .sma-toolbar-buttons {
        width: 100%;
    }

    .sma-toolbar-buttons button {
        flex: 1;
    }

    .sma-year-body {
        padding-left: 10px;
        margin-left: 6px;
    }

    .sma-edition-body {
        padding-left: 4px;
    }

    .sma-table thead {
        display: none;
    }

    .sma-table,
    .sma-table tbody,
    .sma-table tr,
    .sma-table td {
        display: block;
        width: 100%;
    }

    .sma-table tbody tr.sma-article-row {
        padding: 12px 14px;
        margin-bottom: 6px;
        border-bottom: none;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 5px;
        border-left: 3px solid var(--sma-accent);
    }

    .sma-table tbody tr.sma-article-row:hover {
        background: var(--sma-row-hover);
    }

    .sma-table tbody td {
        padding: 3px 0;
        border: none;
        text-align: left !important;
    }

    .sma-table tbody td:nth-child(1) {
        font-weight: 700;
        font-size: 15px;
        width: 100%;
    }

    .sma-table tbody td:nth-child(2) {
        width: 100%;
        color: var(--sma-text-muted);
        font-size: 13px;
    }

    .sma-table tbody td:nth-child(2)::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--sma-text-muted);
    }

    .sma-table tbody td:nth-child(3) {
        width: 100%;
        padding-top: 6px;
    }

    .sma-edition-header {
        flex-wrap: wrap;
        gap: 30px 8px;
        align-items: flex-start;
    }

    .sma-edition-title {
        flex: 1 1 calc(100% - 40px);
        min-width: 0;
    }

    .sma-count {
        display: block;
        margin-left: 0;
        margin-top: 4px;
        width: fit-content;
    }

    .sma-edition-pdf-btn {
        position: static;
        transform: none;
        order: 3;
        width: fit-content;
        margin: 0;
        padding: 3px 8px;
        font-size: 11px;
        display: block;
    }

    .sma-edition-pdf-btn:hover {
        transform: scale(1.05);
    }
}
