@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #1e3a8a;
    --primary-hover: #172e6e;
    --sidebar-bg: #0f172a;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(59, 130, 246, 0.22);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* Login Screen */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 22px;
    padding: 36px 32px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
}
.login-logo {
    text-align: center;
    margin-bottom: 24px;
}
.login-logo img {
    max-height: 54px;
    margin-bottom: 12px;
}
.login-logo h1 {
    font-size: 1.35rem;
    font-weight: 800;
}
.login-logo p {
    font-size: 0.88rem;
    color: var(--muted);
}

/* Admin Layout */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 268px;
    background: var(--sidebar-bg);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform 0.25s ease;
}
.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.05rem;
}
.sidebar-brand img {
    height: 30px;
    filter: brightness(0) invert(1);
}
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 12px 12px 6px;
}
.nav-item, .nav-parent {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    transition: all 0.16s ease;
}
.nav-item:hover, .nav-parent:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
.nav-item.active {
    background: var(--sidebar-active);
    color: #fff;
}
.nav-parent .chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}
.nav-group.open .nav-parent .chevron {
    transform: rotate(180deg);
}
.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 6px 26px;
}
.nav-group.open .nav-submenu {
    display: flex;
}
.nav-subitem {
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}
.nav-subitem:hover { color: #fff; background: var(--sidebar-hover); }
.nav-subitem.active { color: #fff; background: rgba(59, 130, 246, 0.28); }

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 268px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.menu-toggle {
    display: none;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 10px;
    cursor: pointer;
}
.page-title {
    font-size: 1.2rem;
    font-weight: 800;
}
.topbar-user {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.content-wrap {
    padding: 28px;
    max-width: 1180px;
    width: 100%;
}

.view-panel { display: none; }
.view-panel.active { display: block; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}
.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
}

/* Cards & Forms */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 22px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}
.card-header h2 {
    font-size: 1.08rem;
    font-weight: 800;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-group.full { grid-column: 1 / -1; }
.form-group label {
    font-size: 0.84rem;
    font-weight: 700;
    color: #334155;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text);
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}
textarea.form-control { min-height: 96px; resize: vertical; }
.form-hint { font-size: 0.78rem; color: var(--muted); }

/* Upload Preview */
.upload-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
}
.upload-preview {
    width: 82px;
    height: 82px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--border);
    object-fit: contain;
    padding: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: 10px;
    border: none;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; border-radius: 8px; }

/* Table */
.table-tools {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
th {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    background: #f8fafc;
}
.thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: contain;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 2px;
}
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
}
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #f1f5f9; color: #64748b; }
.actions-cell {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #0f172a;
    color: #fff;
    padding: 13px 20px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(0,0,0,0.22);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.25s ease;
    z-index: 200;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
    .content-wrap { padding: 18px; }
}
