/* ==========================================================================
   ADMIN.CSS — Admin panel styles
   ========================================================================== */

/* LOGIN SCREEN */
#loginScreen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(13,47,85,0.92) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 70%, rgba(35,125,78,0.55) 0%, transparent 60%),
        #06182d;
    min-height: 100vh;
}

.login-card {
    width: min(420px, calc(100% - 40px));
    padding: 48px 40px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    backdrop-filter: blur(20px);
    text-align: center;
}

.login-logo {
    width: 60px; height: 60px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 22px;
    border-radius: 16px;
    background: linear-gradient(135deg, #174a78, #0d2f55);
    border: 2px solid rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.6rem;
}

.login-card h1 {
    color: #fff;
    font-size: 1.55rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.login-card p {
    color: rgba(255,255,255,0.5);
    font-size: 0.84rem;
    margin-bottom: 32px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    margin-bottom: 18px;
}

.login-field label {
    color: rgba(255,255,255,0.7);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.login-field input {
    height: 48px;
    padding: 0 16px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 0.94rem;
    outline: none;
    transition: border-color 200ms;
}

.login-field input:focus { border-color: #64e4ff; }
.login-field input::placeholder { color: rgba(255,255,255,0.3); }

.login-btn {
    width: 100%;
    height: 50px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #174a78, #237d4e);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 200ms, transform 200ms;
    margin-top: 4px;
}

.login-btn:hover { opacity: 0.88; transform: translateY(-1px); }

.login-error {
    display: none;
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(192,57,43,0.18);
    border: 1px solid rgba(192,57,43,0.4);
    color: #f1948a;
    font-size: 0.82rem;
}

/* ==========================================================================
   ADMIN APP LAYOUT
   ========================================================================== */

#adminApp {
    display: none;
    min-height: 100vh;
    flex-direction: column;
}

#adminApp.flex { display: flex; }

.admin-layout {
    display: flex;
    flex: 1;
    min-height: calc(100vh - 68px);
}

/* ADMIN TOPBAR */
.admin-topbar {
    height: 68px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    background: var(--navy-950);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.admin-topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-topbar-logo .logo-badge {
    width: 38px; height: 38px;
    border-radius: 9px;
    background: linear-gradient(135deg, #174a78, #237d4e);
    display: grid; place-items: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    border: 1px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
}

.admin-topbar-logo span {
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
}

.admin-topbar-logo small {
    display: block;
    color: rgba(255,255,255,0.4);
    font-size: 0.68rem;
    font-weight: 500;
}

.topbar-sep { flex: 1; }

.topbar-main-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 200ms, border-color 200ms;
}

.topbar-main-btn:hover {
    background: rgba(255,255,255,0.14);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.topbar-main-btn::before { content: "↗"; }

.logout-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(192,57,43,0.15);
    border: 1px solid rgba(192,57,43,0.3);
    color: #f1948a;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 200ms;
}

.logout-btn:hover {
    background: rgba(192,57,43,0.28);
    border-color: rgba(192,57,43,0.5);
}

/* SIDEBAR */
.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--navy-900);
    border-right: 1px solid rgba(255,255,255,0.07);
    padding: 24px 0;
    position: sticky;
    top: 68px;
    height: calc(100vh - 68px);
    overflow-y: auto;
}

.sidebar-section-label {
    padding: 0 20px;
    margin: 20px 0 6px;
    color: rgba(255,255,255,0.35);
    font-size: 0.64rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-section-label:first-child { margin-top: 4px; }

.sidebar-nav { list-style: none; margin: 0; padding: 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.6);
    font-size: 0.83rem;
    font-weight: 600;
    transition: background 180ms, color 180ms;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.09);
    color: #fff;
    border-left-color: var(--cyan-400);
    font-weight: 800;
}

/* MAIN CONTENT AREA */
.admin-main {
    flex: 1;
    min-width: 0;
    padding: 32px 36px;
    background: var(--background);
    overflow-y: auto;
}

.admin-section { display: none; }
.admin-section.active { display: block; }

.section-header {
    margin-bottom: 28px;
}

.section-header h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--navy-900);
    margin-bottom: 6px;
}

.section-header p {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

/* CARDS */
.admin-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-small);
}

.admin-card-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--navy-900);
    margin: 0 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line-soft);
}

/* FORM ELEMENTS */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0,1fr));
    gap: 16px;
}

.form-grid.full { grid-template-columns: 1fr; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.span-2 { grid-column: span 2; }

.form-group label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px 14px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--background-soft);
    color: var(--text);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 180ms;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--navy-700);
    background: var(--white);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-hint {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 2px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--background-soft);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--green-500);
    cursor: pointer;
    padding: 0; border: none; background: none;
}

.form-checkbox span {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text-soft);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    flex-wrap: wrap;
}

/* TABLES */
.admin-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
}

.admin-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background: var(--white);
}

.admin-table th {
    padding: 12px 16px;
    background: var(--navy-900);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    white-space: nowrap;
}

.admin-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.84rem;
    color: var(--text);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--background-soft); }

.td-body {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
}

.empty-cell {
    text-align: center;
    padding: 36px !important;
    color: var(--muted);
    font-style: italic;
}

.muted { color: var(--muted); font-size: 0.75rem; }

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
}

/* STATUS BADGES */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-live {
    background: #edf9f2;
    color: #18734a;
    border: 1px solid #79c59d;
}

.status-draft {
    background: #fef9ec;
    color: #8a5c00;
    border: 1px solid #e8c96b;
}

/* BUTTONS */
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 180ms, transform 180ms;
    white-space: nowrap;
}

.btn-sm:hover { opacity: 0.82; transform: translateY(-1px); }

.btn-primary { background: var(--navy-900); color: #fff; }
.btn-toggle  { background: var(--gold-500); color: #fff; }
.btn-danger  { background: #c0392b; color: #fff; }

.btn-full {
    width: 100%;
    min-height: 46px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: opacity 200ms, transform 200ms, box-shadow 200ms;
}

.btn-full:hover { opacity: 0.88; transform: translateY(-1px); box-shadow: var(--shadow-medium); }

.btn-full-green { background: var(--green-500); color: #fff; box-shadow: 0 4px 16px rgba(35,125,78,0.2); }
.btn-full-navy  { background: var(--navy-900);  color: #fff; }

/* STATS ROW */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    padding: 22px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-small);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: grid; place-items: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon-blue  { background: rgba(23,74,120,0.1); }
.stat-icon-green { background: rgba(35,125,78,0.1); }
.stat-icon-gold  { background: rgba(216,170,79,0.12); }

.stat-info strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--navy-900);
    line-height: 1;
}

.stat-info span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
}

/* INFO BOX */
.info-box {
    display: flex;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    background: #eff9f7;
    border: 1px solid #c8e8de;
    margin-bottom: 18px;
}

.info-box-icon { font-size: 1.2rem; flex-shrink: 0; }

.info-box p {
    margin: 0;
    color: #244d46;
    font-size: 0.82rem;
    line-height: 1.6;
}

/* TOAST NOTIFICATIONS */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    padding: 13px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 700;
    color: #fff;
    box-shadow: var(--shadow-medium);
    transform: translateY(20px);
    opacity: 0;
    transition: transform 300ms ease, opacity 300ms ease;
    pointer-events: none;
    max-width: 340px;
}

.toast-visible { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--green-500); }
.toast-error   { background: #c0392b; }

/* ==========================================================================
   RESPONSIVE ADMIN
   ========================================================================== */

@media (max-width: 860px) {
    .admin-sidebar {
        width: 200px;
    }
    .admin-main { padding: 24px 20px; }
    .form-grid { grid-template-columns: 1fr; }
    .form-group.span-2 { grid-column: span 1; }
    .stats-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid rgba(255,255,255,0.07);
        padding: 12px 0;
    }
    .sidebar-nav { display: flex; flex-wrap: wrap; padding: 0 12px; gap: 4px; }
    .sidebar-nav a { border-left: none; border-radius: 8px; padding: 7px 12px; font-size: 0.78rem; }
    .sidebar-nav a.active { border-left: none; background: rgba(255,255,255,0.12); }
    .sidebar-section-label { display: none; }
    .admin-topbar { padding: 0 16px; }
    .stats-row { grid-template-columns: 1fr 1fr; }
    .actions-cell { flex-wrap: wrap; }
}

/* ========================================================================== 
   OPEN SOURCE SECTION — ADMIN INSTITUTIONAL OVERRIDES
   ========================================================================== */
.login-card,
.admin-card,
.info-box,
.stat-card {
    border-radius: 6px;
}

.login-logo,
.admin-topbar-logo .logo-badge {
    border-radius: 50%;
}

.admin-topbar {
    border-bottom: 4px solid #d8aa4f;
}

.admin-sidebar {
    background: #0a2948;
}

.btn-full,
.btn-sm,
.topbar-main-btn,
.logout-btn {
    border-radius: 4px !important;
}
