/* =========================
   ROOT
========================= */
.admin-page {
    --primary: #4f46e5;
    --bg: #f8fafc;
    --card: rgba(255,255,255,0.9);
    --text: #0f172a;

    background: linear-gradient(135deg, #eef2ff, #f8fafc);
    min-height: 100vh;
    font-family: 'Segoe UI', sans-serif;
}

/* =========================
   LAYOUT
========================= */
.admin {
    display: flex;
    min-height: 100vh;
}

.main {
    flex: 1;
    padding: 20px;
}

/* =========================
   SIDEBAR (FIX FINAL)
========================= */
.sidebar {
    width: 240px;
    background: #0f172a;
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* HEADER */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    font-weight: bold;
}

/* MENU */
.menu {
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #cbd5f5;
    text-decoration: none;
    transition: 0.2s;
}

.menu-item:hover {
    background: #1e293b;
    color: #fff;
}

.menu-item.active {
    background: var(--primary);
    color: #fff;
}

.menu-item .icon {
    width: 20px;
}

/* LOGOUT */
.menu-item.logout {
    margin-top: auto;
    color: #f87171;
}

/* =========================
   SIDEBAR COLLAPSE (FIX)
========================= */
.sidebar.collapsed {
    width: 70px;
}

.sidebar.collapsed .text {
    display: none;
}

.sidebar.collapsed .menu-item {
    justify-content: center;
}

.sidebar.collapsed .menu-item .icon {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.sidebar.collapsed .collapse-btn {
    display: none;
}

/* =========================
   TOPBAR
========================= */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(10px);

    padding: 15px 20px;
    border-radius: 14px;
    margin-bottom: 20px;
}

.subtitle {
    font-size: 12px;
    color: #64748b;
}

/* =========================
   CARD
========================= */
.card,
.card-stat {
    background: var(--card);
    border-radius: 16px;
    padding: 20px;

    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    transition: 0.3s;
}

.card:hover,
.card-stat:hover {
    transform: translateY(-4px);
}

/* =========================
   STATS GRID
========================= */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

/* =========================
   CARD STAT
========================= */
.card-stat {
    color: white;
}

.card-stat:nth-child(1) { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.card-stat:nth-child(2) { background: linear-gradient(135deg, #22c55e, #16a34a); }
.card-stat:nth-child(3) { background: linear-gradient(135deg, #f59e0b, #d97706); }
.card-stat:nth-child(4) { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.card-stat:nth-child(5) { background: linear-gradient(135deg, #ef4444, #dc2626); }

.card-stat h3 {
    font-size: 28px;
    margin: 0;
}

.card-stat p {
    color: rgba(255,255,255,0.9);
}

/* =========================
   GRID
========================= */
.grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* =========================
   TABLE
========================= */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: 12px;
    background: #f1f5f9;
    text-align: left;
}

td {
    padding: 12px;
    border-bottom: 1px solid #eee;
}

/* =========================
   FORM
========================= */
.form-box label {
    display: block;
    margin-top: 10px;
    font-weight: 500;
}

input, textarea, select {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* =========================
   BUTTON
========================= */
.btn {
    background: #64748b;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    text-decoration: none;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-small {
    background: #e2e8f0;
    color: #111;
    padding: 5px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
}

.btn-small:hover {
    background: #cbd5f5;
}

/* =========================
   FLEX UTIL
========================= */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mb-20 {
    margin-bottom: 20px;
}

/* =========================
   RESPONSIVE
========================= */
@media(max-width:768px){
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }
}