/* =============================================
   RCSVIT MEDIA ARCHIVE – NOVICHOK STYLE
   (matches all public & admin pages)
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f4f4;
    color: #222;
    line-height: 1.5;
}

/* ---------- HEADER (same black bar for every page) ---------- */
.site-header, .black-header {
    background: #000;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.site-title, .black-header .brand {
    color: #fff;
    font-size: 32px;
    font-weight: bold;
    text-decoration: none;
}
.black-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
}
.black-header .nav-links a {
    color: #fff;
    margin-left: 20px;
    font-size: 0.9rem;
    text-decoration: none;
    opacity: 0.8;
}
.black-header .nav-links a:hover { opacity: 1; }

/* ---------- MAIN CONTAINER ---------- */
.main-container, .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 48px;
}

/* ---------- BACK BUTTON ---------- */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #333;
    padding: 8px 14px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #d9d9d9;
    text-decoration: none;
    margin-bottom: 20px;
    transition: 0.2s;
}
.back-btn:hover {
    background: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateX(-3px);
}

/* ---------- PAGE HEADER (title area) ---------- */
.page-header {
    margin-bottom: 32px;
}
.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111;
}
.page-subtitle {
    font-size: 1rem;
    color: #777;
    margin-top: 4px;
}

/* ---------- GALLERY GRID (4/2/1 columns) ---------- */
.gallery-grid, .year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
}

/* Year cards and media cards inherit the same card style */
.gallery-card, .year-card, .media-card {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;  /* for <a> elements */
}
.gallery-card:hover, .year-card:hover, .media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 28px rgba(0,0,0,0.18);
}

/* Card link wrapper */
.card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Image wrapper – 3:2 aspect ratio */
.card-img-wrap, .thumbnail {
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    background: #e8e8e8;
    position: relative;
}
.card-img, .thumbnail img, .thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.gallery-card:hover .card-img, .media-card:hover .thumbnail img,
.media-card:hover .thumbnail video {
    transform: scale(1.04);
}

.card-body, .info {
    padding: 14px 16px 16px;
}
.card-title, .title {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-sub, .meta {
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Year card specific */
.year-card .year-number {
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    padding: 20px 0 10px;
}
.year-card .president, .year-card .media-count {
    text-align: center;
    color: #777;
    font-size: 0.9rem;
}

/* ---------- IMAGE DETAIL PAGE ---------- */
.image-detail, .detail-wrapper {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 40px;
}
.detail-img-wrap {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #e8e8e8;
    margin-bottom: 20px;
}
.detail-img, .media-display {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 560px;
    background: #fafafa;
}
.detail-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 10px;
}
.detail-desc {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* Metadata Table */
.meta-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
    font-size: 0.9rem;
}
.meta-table tbody tr {
    border-bottom: 1px solid #ececec;
}
.meta-table tbody tr:last-child {
    border-bottom: none;
}
.meta-table th {
    text-align: left;
    font-weight: 600;
    color: #333;
    padding: 10px 16px 10px 0;
    width: 140px;
    white-space: nowrap;
}
.meta-table td {
    padding: 10px 0;
    color: #555;
}

/* Action Buttons */
.action-btns, .detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: 2px solid transparent;
    transition: 0.2s;
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    background: #f1f5f9;
    color: #1e293b;
}
.btn-dark, .btn-primary {
    background: #000;
    color: #fff;
    border-color: #000;
}
.btn-dark:hover, .btn-primary:hover {
    background: #1a1a1a;
}
.btn-outline {
    background: #fff;
    color: #222;
    border-color: #bbb;
}
.btn-outline:hover {
    background: #f4f4f4;
    border-color: #888;
}
.btn-danger {
    background: #d32f2f;
    color: #fff;
}
.btn-danger:hover {
    background: #b71c1c;
}
.btn-block {
    width: 100%;
}

/* Previous / Next */
.prev-next-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.prev-next-nav .btn {
    min-width: 130px;
}

/* Related images heading */
.related-heading {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
    margin-bottom: 18px;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

/* ---------- ADMIN LOGIN ---------- */
.login-box {
    max-width: 400px;
    margin: 60px auto;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.form-group {
    margin-bottom: 18px;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: #000;
}

/* ---------- ADMIN DASHBOARD ---------- */
.admin-dashboard .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin: 24px 0;
}
.admin-dashboard .stat-card {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.admin-dashboard .stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: #000;
}
.admin-dashboard .stat-card .label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
    margin-top: 4px;
}
.admin-dashboard .chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}
.admin-dashboard .chart-box {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.admin-dashboard .table-wrap {
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
}
.admin-dashboard table {
    width: 100%;
    border-collapse: collapse;
}
.admin-dashboard th, .admin-dashboard td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eee;
}
.admin-dashboard th {
    background: #f9f9f9;
    font-weight: 600;
}

/* Admin modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}

/* ---------- FOOTER ---------- */
footer, .site-footer {
    border-top: 1px solid #d9d9d9;
    padding: 16px 20px;
    text-align: left;
    font-size: 0.85rem;
    color: #666;
    background: #fff;
}
footer a, .site-footer a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}
footer a:hover, .site-footer a:hover {
    text-decoration: underline;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .gallery-grid, .year-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }
    .page-title { font-size: 1.7rem; }
    .detail-title { font-size: 1.4rem; }
    .detail-img { max-height: 420px; }
    .meta-table th { width: 110px; }
}

@media (max-width: 600px) {
    .site-header, .black-header { height: 56px; }
    .site-title, .black-header .brand { font-size: 24px; }
    .main-container, .container { padding: 16px 12px 36px; }
    .back-btn { font-size: 0.85rem; padding: 7px 12px; }
    .page-header { margin-bottom: 20px; }
    .page-title { font-size: 1.4rem; }
    .page-subtitle { font-size: 0.85rem; }

    .gallery-grid, .year-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .image-detail, .detail-wrapper { padding: 16px; border-radius: 10px; }
    .detail-img { max-height: 300px; }
    .detail-title { font-size: 1.2rem; }

    /* Stack metadata table */
    .meta-table, .meta-table tbody, .meta-table tr, .meta-table th, .meta-table td {
        display: block;
        width: 100%;
    }
    .meta-table tr {
        margin-bottom: 10px;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 8px;
    }
    .meta-table th { padding: 0 0 2px 0; font-size: 0.78rem; color: #777; text-transform: uppercase; letter-spacing: 0.03em; width: auto; }
    .meta-table td { padding: 0 0 4px 0; font-size: 0.9rem; color: #222; }

    .action-btns, .detail-actions { flex-direction: column; gap: 10px; }
    .action-btns .btn, .detail-actions .btn { width: 100%; }
    .prev-next-nav { flex-direction: column; gap: 10px; }
    .prev-next-nav .btn { width: 100%; min-width: auto; }

    .admin-dashboard .chart-row { grid-template-columns: 1fr; }
    .admin-dashboard .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
