/* ── ADMIN PANEL STYLESHEET ───────────────────────────────── */
.admin-body { background: #f1f5f9; margin: 0; }
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar-backdrop { display:none; }

/* ── SIDEBAR ─────────────────────────────────────────────── */
.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #0f2340;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    overflow-y: auto;
    transition: transform 0.25s;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.sidebar-section {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #334155;
    padding: 1.25rem 1.25rem 0.35rem;
}
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.58rem 0.75rem;
    border-radius: 4px;
    color: #94a3b8;
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav a:hover  { background: rgba(255,255,255,0.05); color: #e2e8f0; }
.sidebar-nav a.active { background: rgba(201,168,76,0.12); color: #c9a84c; font-weight: 600; }
.sidebar-nav a svg    { flex-shrink: 0; opacity: 0.65; }
.sidebar-nav a.active svg { opacity: 1; }
.badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    min-width: 18px;
    text-align: center;
}
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.sidebar-footer a { color: #475569; font-size: 0.82rem; text-decoration: none; transition: color 0.15s; }
.sidebar-footer a:hover { color: #94a3b8; }
.logout-btn { display: flex; align-items: center; gap: 0.4rem; color: #ef4444 !important; }
.logout-btn:hover { color: #dc2626 !important; }

/* ── MAIN AREA ───────────────────────────────────────────── */
.admin-main { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ── TOPBAR ──────────────────────────────────────────────── */
.admin-topbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.8rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.sidebar-toggle { background: none; border: none; cursor: pointer; color: #64748b; padding: 0.3rem; display: none; }
.topbar-title { font-family: 'Playfair Display', serif; font-size: 1.05rem; color: #1e3a5f; flex: 1; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: 0.83rem; color: #64748b; }
.topbar-user a { color: #ef4444; font-weight: 600; text-decoration: none; }
.topbar-user a:hover { text-decoration: underline; }

/* ── CONTENT ─────────────────────────────────────────────── */
.admin-content { padding: 2rem 1.75rem; flex: 1; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: #fff;
    border-radius: 6px;
    padding: 1.2rem 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 8px rgba(30,58,95,0.06);
    border: 1px solid #e2e8f0;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(30,58,95,0.1); }
.stat-icon {
    width: 42px; height: 42px;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-icon.purple { background: #ede9fe; color: #6d28d9; }
.stat-icon.yellow { background: #fef9c3; color: #92400e; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-label-sm { font-size: 0.72rem; color: #9ca3af; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; }
.stat-num { font-size: 1.75rem; font-weight: 700; color: #1e3a5f; line-height: 1; margin-top: 0.15rem; }

/* ── PANEL CARD ──────────────────────────────────────────── */
.panel {
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 8px rgba(30,58,95,0.06);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    margin-bottom: 1.75rem;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    background: #fafafa;
}
.panel-header h2 {
    font-size: 0.95rem;
    color: #1e3a5f;
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}
.panel-body { padding: 1.5rem; }

/* ── TABLE ───────────────────────────────────────────────── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.admin-table th {
    background: #f8fafc;
    padding: 0.65rem 1rem;
    text-align: left;
    font-weight: 700;
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid #e2e8f0;
}
.admin-table td { padding: 0.85rem 1rem; border-bottom: 1px solid #f1f5f9; color: #374151; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fafc; }

/* ── STATUS PILLS ────────────────────────────────────────── */
.pill { display: inline-block; padding: 0.18rem 0.65rem; border-radius: 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.pill-green  { background: #dcfce7; color: #15803d; }
.pill-gray   { background: #f1f5f9; color: #64748b; }
.pill-red    { background: #fee2e2; color: #dc2626; }
.pill-yellow { background: #fef9c3; color: #92400e; }
.pill-blue   { background: #dbeafe; color: #1d4ed8; }

/* ── ACTION BUTTONS ──────────────────────────────────────── */
.btn-sm {
    padding: 0.32rem 0.75rem;
    font-size: 0.78rem;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    transition: opacity 0.15s;
    letter-spacing: 0.02em;
}
.btn-sm:hover   { opacity: 0.82; }
.btn-edit   { background: #dbeafe; color: #1d4ed8; }
.btn-delete { background: #fee2e2; color: #dc2626; }
.btn-toggle { background: #f1f5f9; color: #475569; }
.btn-view   { background: #ede9fe; color: #6d28d9; }
.actions-row { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* ── FORM PAGE ───────────────────────────────────────────── */
.admin-form { max-width: 760px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.admin-form .form-group { margin-bottom: 1.25rem; }
.admin-form label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: #374151;
    margin-bottom: 0.38rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.admin-form input[type=text],
.admin-form input[type=email],
.admin-form input[type=number],
.admin-form input[type=file],
.admin-form input[type=url],
.admin-form textarea,
.admin-form select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #1f2937;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: #c9a84c;
    box-shadow: 0 0 0 3px rgba(201,168,76,0.1);
    background: #fff;
}
.admin-form textarea { resize: vertical; min-height: 160px; }
.check-row { display: flex; align-items: center; gap: 0.6rem; }
.check-row input[type=checkbox] { width: 16px; height: 16px; accent-color: #c9a84c; }
.check-row label { margin: 0; font-size: 0.9rem; text-transform: none; letter-spacing: 0; }
.img-preview { max-width: 160px; border-radius: 4px; margin-top: 0.5rem; border: 1px solid #e2e8f0; }
.hint { font-size: 0.75rem; color: #9ca3af; margin-top: 0.2rem; font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ── GALLERY ADMIN GRID ──────────────────────────────────── */
.gallery-admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}
.gallery-admin-item {
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.gallery-admin-item img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}
.gallery-admin-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, #1e3a5f, #2d5184);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(201,168,76,0.4);
}
.gallery-admin-placeholder svg { width: 36px; height: 36px; }
.gallery-admin-caption { padding: 0.55rem 0.75rem; font-size: 0.78rem; color: #374151; font-weight: 500; }
.gallery-admin-actions { padding: 0 0.75rem 0.75rem; }

/* ── UPLOAD ZONE ─────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed #c9a84c;
    border-radius: 4px;
    padding: 2.5rem;
    text-align: center;
    background: #fffbf0;
    cursor: pointer;
    transition: background 0.15s;
}
.upload-zone:hover { background: #fef3c7; }
.upload-zone p { color: #6b7280; margin: 0.5rem 0 0; font-size: 0.88rem; }

/* ── PROGRAMS TABLE ──────────────────────────────────────── */
.prog-icon-cell {
    width: 44px; height: 44px;
    background: rgba(201,168,76,0.08);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: #c9a84c;
}
.prog-desc-preview {
    font-size: 0.77rem;
    color: #9ca3af;
    margin-top: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 360px;
}

/* ── DELETE POPOVER ──────────────────────────────────────── */
.del-popover-wrap { position: relative; display: inline-block; }
.del-popover {
    display: none;
    position: absolute;
    z-index: 9999;
    background: #fff;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 0.75rem 1rem;
    min-width: 190px;
    white-space: nowrap;
    font-size: 0.82rem;
    color: #374151;
    font-family: 'Inter', sans-serif;
    margin-left: 8px;
}
.del-popover.open { display: block; }
.del-popover-title { font-weight: 700; color: #dc2626; margin-bottom: 0.3rem; font-size: 0.8rem; }
.del-popover-msg { color: #6b7280; margin-bottom: 0.6rem; font-size: 0.78rem; white-space: normal; max-width: 160px; }
.del-popover-actions { display: flex; gap: 0.4rem; }
.del-popover-yes {
    flex: 1; padding: 0.32rem 0.55rem; background: #ef4444; color: #fff;
    border: none; border-radius: 3px; font-size: 0.78rem; font-weight: 700;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: background 0.15s;
}
.del-popover-yes:hover { background: #dc2626; }
.del-popover-no {
    flex: 1; padding: 0.32rem 0.55rem; background: #f1f5f9; color: #374151;
    border: 1px solid #e2e8f0; border-radius: 3px; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: background 0.15s;
}
.del-popover-no:hover { background: #e2e8f0; }

/* ── CONFIRM MODAL ───────────────────────────────────────── */
.sw-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99999; display: none;
    align-items: center; justify-content: center;
}
.sw-overlay.open { display: flex !important; }
.sw-box {
    background: #fff; border-radius: 6px;
    width: 92%; max-width: 360px;
    padding: 2rem 1.75rem 1.75rem;
    text-align: center;
    box-shadow: 0 16px 48px rgba(0,0,0,0.22);
    animation: swPop 0.22s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
}
@keyframes swPop { from { opacity:0; transform:scale(0.7); } to { opacity:1; transform:scale(1); } }
.sw-icon-ring {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1.25rem;
}
.sw-icon-ring.red    { background: #fef2f2; border: 3px solid #ef4444; }
.sw-icon-ring.amber  { background: #fffbeb; border: 3px solid #f59e0b; }
.sw-icon-ring.green  { background: #f0fdf4; border: 3px solid #22c55e; }
.sw-icon-ring.blue   { background: #eff6ff; border: 3px solid #3b82f6; }
.sw-title { font-size: 1.2rem; font-weight: 800; color: #111827; margin-bottom: 0.4rem; font-family: 'Inter', sans-serif; }
.sw-text  { font-size: 0.86rem; color: #6b7280; line-height: 1.55; margin-bottom: 0.3rem; }
.sw-name  {
    display: inline-block; background: #f1f5f9; color: #1e3a5f;
    font-weight: 700; padding: 0.22rem 0.8rem; border-radius: 3px;
    font-size: 0.83rem; margin: 0.3rem 0 0.5rem;
    border: 1px solid #e2e8f0;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sw-note    { font-size: 0.73rem; color: #ef4444; font-weight: 600; margin-bottom: 1.4rem; }
.sw-actions { display: flex; gap: 0.65rem; }
.sw-cancel {
    flex: 1; padding: 0.72rem; background: #f3f4f6; border: 1.5px solid #e5e7eb;
    border-radius: 4px; font-weight: 600; font-size: 0.88rem; color: #374151;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: background 0.15s;
}
.sw-cancel:hover { background: #e5e7eb; }
.sw-ok {
    flex: 1; padding: 0.72rem; border: none; border-radius: 4px;
    font-weight: 700; font-size: 0.88rem; color: #fff;
    cursor: pointer; font-family: 'Inter', sans-serif; transition: opacity 0.15s;
}
.sw-ok:hover { opacity: 0.85; }
.sw-ok.red   { background: #ef4444; }
.sw-ok.amber { background: #f59e0b; }
.sw-ok.green { background: #22c55e; }
.sw-ok.blue  { background: #3b82f6; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 1.5rem; right: 1.5rem;
    z-index: 9999;
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    border-radius: 4px;
    font-size: 0.88rem; font-weight: 600;
    max-width: 360px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.14);
    animation: toastIn 0.3s ease, toastOut 0.4s ease 3.8s forwards;
}
.toast-success { background: #059669; color: #fff; }
.toast-error   { background: #ef4444; color: #fff; }
.toast-info    { background: #1e3a5f; color: #fff; }
@keyframes toastIn  { from { opacity:0; transform: translateY(14px); } to { opacity:1; transform: none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform: translateY(6px); } }

/* ── GALLERY UPLOAD TABS ─────────────────────────────────── */
.upload-tabs {
    display: flex; gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 0;
}
.upload-tab {
    padding: 0.55rem 1rem; border: none; background: none;
    cursor: pointer; font-size: 0.86rem; font-weight: 600; color: #6b7280;
    border-bottom: 3px solid transparent; margin-bottom: -2px;
    border-radius: 3px 3px 0 0; transition: all 0.15s;
}
.upload-tab:hover  { color: #1e3a5f; background: #f8fafc; }
.upload-tab.active { color: #1e3a5f; border-bottom-color: #c9a84c; background: #fff; }

.media-field-card {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 4px; padding: 1rem; margin-bottom: 0.75rem;
}
.media-field-card label {
    display: block; font-size: 0.75rem; font-weight: 700;
    color: #374151; margin-bottom: 0.28rem; letter-spacing: 0.05em; text-transform: uppercase;
}
.media-field-card input[type=text],
.media-field-card textarea {
    width: 100%; padding: 0.48rem 0.72rem;
    border: 1.5px solid #e2e8f0; border-radius: 3px;
    font-size: 0.86rem; outline: none; margin-bottom: 0.5rem;
    font-family: 'Inter', sans-serif;
}
.media-field-card textarea { resize: vertical; min-height: 70px; }
.media-field-card input:focus,
.media-field-card textarea:focus { border-color: #c9a84c; }
.media-field-label {
    font-size: 0.7rem; color: #9ca3af; margin-bottom: 0.5rem; display: block;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gallery-play-badge {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 38px; height: 38px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.9rem; pointer-events: none;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 1024px) {
    .admin-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .admin-sidebar { width:min(82vw, 300px); transform: translateX(-100%); box-shadow:8px 0 28px rgba(0,0,0,.28); }
    .admin-sidebar.open { transform: translateX(0); }
    .sidebar-backdrop { display:block; position:fixed; inset:0; z-index:190; border:0; background:rgba(15,35,64,.48); opacity:0; pointer-events:none; transition:opacity .25s; }
    .sidebar-backdrop.open { opacity:1; pointer-events:auto; }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .topbar-user span { display: none; }
    .admin-content { padding: 1.25rem 1rem; }
    .admin-topbar { padding: 0.85rem 1rem; }
    .admin-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .panel-header { flex-wrap:wrap; gap:.75rem; }
    .panel-header .btn { width:100%; }
    .actions-row { flex-wrap:wrap !important; gap:.45rem; }
    .admin-form { max-width:100%; }
}
@media (max-width: 480px) {
    .admin-content { padding: 1rem 0.75rem; }
    .admin-topbar h1 { font-size: 1.1rem; }
    .admin-stats { grid-template-columns: 1fr; }
    .admin-form input[type=text], .admin-form input[type=email], .admin-form input[type=number], .admin-form input[type=file], .admin-form input[type=url], .admin-form textarea, .admin-form select { font-size: 16px; }
    .gallery-admin-grid { grid-template-columns: 1fr; }
    .admin-table th, .admin-table td { padding: 0.7rem 0.75rem; }
    .topbar-user { gap:.55rem; font-size:.76rem; }
    .sidebar-brand { padding:1rem; }
    .sidebar-nav { padding:.4rem .5rem; }
    .btn, .btn-sm { min-height:42px; display:inline-flex; align-items:center; justify-content:center; }
    .check-row { align-items:flex-start; }
}
