/* ============================================================
   Oroma TV — admin panel stylesheet
   ============================================================ */

:root {
    --maroon: #800000;
    --maroon-dark: #5c0000;
    --navy: #1a1a2e;
    --navy-light: #23233d;
    --gold: #c9a84c;
    --gold-light: #e0c375;

    --bg: #f4f3f7;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b6b7a;
    --border: #e8e7ee;

    --radius-md: 16px;
    --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #101019;
        --card-bg: #17172a;
        --text: #f0eef2;
        --text-muted: #9a99ab;
        --border: #262638;
    }
}

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

html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- login screen ---------- */

.login-screen {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(150deg, var(--navy) 0%, #0d0d17 100%);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--card-bg);
    border-radius: 24px;
    padding: 36px 32px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.login-card img { height: 56px; margin: 0 auto 8px; }
.login-card h1 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.login-card p.sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }

/* ---------- shared form elements ---------- */

.form-group { margin-bottom: 18px; text-align: left; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: inherit;
    /* 16px avoids iOS Safari auto-zooming the page when a field is focused. */
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-control:focus { border-color: var(--maroon); }

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

select.form-control { appearance: auto; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--maroon), var(--maroon-dark)); color: #fff; }
.btn-primary:hover { opacity: 0.92; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); }

.alert {
    padding: 10px 14px;
    font-size: 12px;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.08);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    text-align: left;
}

/* ---------- app shell ---------- */

.admin-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--navy);
    color: #e5e5ee;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.admin-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar .brand img { height: 32px; }
.admin-sidebar .brand span { font-weight: 700; font-size: 16px; }

.admin-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.15s ease;
}

.admin-nav a i { width: 18px; text-align: center; }

.admin-nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.admin-nav a.active {
    background: var(--maroon);
    color: #fff;
}

.nav-badge {
    background: var(--gold);
    color: var(--navy);
    font-size: 11px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-sidebar .foot {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-sidebar .foot a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    padding: 8px 4px;
}

.admin-sidebar .foot a:hover { color: var(--gold-light); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-topbar h1 { font-size: 19px; font-weight: 700; }

.admin-topbar .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.admin-topbar .user-chip .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--maroon);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.admin-content { padding: 28px; flex: 1; }

.menu-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--text); cursor: pointer; }

@media (max-width: 900px) {
    .admin-sidebar {
        position: fixed;
        left: 0; top: 0;
        transform: translateX(-100%);
        z-index: 100;
        transition: transform 0.25s ease;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    .admin-content { padding: 18px; }
}

/* ---------- article editor: content + sidebar layout ---------- */

.article-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 22px;
    align-items: start;
}

@media (max-width: 900px) {
    .article-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .article-form-grid .card {
        padding: 16px;
    }

    #editor {
        min-height: 220px !important;
    }

    .ql-toolbar.ql-snow {
        padding: 6px !important;
        position: sticky;
        top: 0;
        z-index: 5;
        background: #fff;
    }

    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 6px !important;
    }

    .ql-snow.ql-toolbar button {
        width: 32px;
        height: 32px;
    }
}

/* ---------- flash messages ---------- */

.flash-stack { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }

.flash {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.flash-success { background: rgba(46, 125, 50, 0.1); color: #2e7d32; }
.flash-error { background: rgba(192, 57, 43, 0.1); color: #c0392b; }

/* ---------- stat cards ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-card .icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: rgba(128, 0, 0, 0.08);
    color: var(--maroon);
}

.stat-card .value { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---------- cards / tables ---------- */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-bottom: 22px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    gap: 12px;
    flex-wrap: wrap;
}

.card-head h2 { font-size: 16px; font-weight: 700; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }

.data-table th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

.data-table .thumb {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: var(--bg);
    overflow: hidden;
}

.data-table .thumb img { width: 100%; height: 100%; object-fit: cover; }

.status-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 40px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-published { background: rgba(46, 125, 50, 0.1); color: #2e7d32; }
.status-draft { background: rgba(201, 168, 76, 0.15); color: #8a6d1f; }
.status-admin { background: rgba(128, 0, 0, 0.1); color: var(--maroon); }
.status-editor { background: rgba(26, 26, 46, 0.08); color: var(--text-muted); }

.row-actions { display: flex; gap: 8px; }

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
}

.icon-btn:hover { background: var(--bg); color: var(--text); }

.empty-row td { text-align: center; padding: 40px; color: var(--text-muted); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.image-preview {
    width: 100%;
    max-width: 280px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 10px;
}

.image-preview img { width: 100%; display: block; }

.toggle-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-switch input { width: 36px; height: 20px; accent-color: var(--maroon); }
