:root {
    --primary: #4f6ef7;
    --primary-light: #eef1ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --dark: #1e293b;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-700: #334155;
    --radius: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.08);
    --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

html { font-size: 14px; position: relative; min-height: 100%; }
body { margin-bottom: 60px; background-color: var(--gray-50); font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; color: var(--dark); }
.footer { position: absolute; bottom: 0; width: 100%; background: white; border-top: 1px solid var(--gray-200); }

/* ===== Admin Sidebar ===== */
#adminWrapper { min-height: 100vh; }
.admin-sidebar {
    width: 240px; min-height: 100vh; position: sticky; top: 0; z-index: 1020;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    box-shadow: 2px 0 12px rgba(0,0,0,.15);
}
.admin-sidebar .sidebar-brand {
    padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.admin-sidebar .sidebar-brand h5 {
    font-size: 1.1rem; font-weight: 700; letter-spacing: .5px;
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.admin-sidebar .sidebar-brand small { color: rgba(255,255,255,.4); font-size: .75rem; }
.admin-sidebar .nav { padding: 12px 12px; }
.admin-sidebar .nav-link {
    padding: 10px 14px; border-radius: 8px; margin-bottom: 2px;
    color: rgba(255,255,255,.55) !important; font-size: .9rem;
    transition: all var(--transition); display: flex; align-items: center; gap: 10px;
}
.admin-sidebar .nav-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.admin-sidebar .nav-link:hover { background: rgba(255,255,255,.08); color: rgba(255,255,255,.9) !important; }
.admin-sidebar .nav-link.active { background: rgba(79,110,247,.3); color: #fff !important; font-weight: 600; }
.admin-sidebar .nav-divider { border-color: rgba(255,255,255,.08); margin: 8px 12px; }

/* ===== Admin Main Area ===== */
.admin-main { overflow-x: auto; background: var(--gray-50); }
.admin-topbar {
    background: white; border-bottom: 1px solid var(--gray-200);
    padding: 12px 24px; display: flex; justify-content: space-between; align-items: center;
    position: sticky; top: 0; z-index: 1010;
}
.admin-topbar .breadcrumb { margin: 0; font-size: .85rem; }
.admin-topbar .breadcrumb-item a { color: var(--gray-500); text-decoration: none; }
.admin-topbar .breadcrumb-item.active { color: var(--dark); font-weight: 600; }
.admin-topbar .user-info {
    display: flex; align-items: center; gap: 10px; font-size: .9rem; color: var(--gray-700);
}
.admin-topbar .user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: .85rem;
}
.admin-content { padding: 24px; }
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--dark); margin: 0; }

/* ===== Cards ===== */
.card {
    border: none; border-radius: var(--radius); box-shadow: var(--shadow);
    transition: box-shadow var(--transition); margin-bottom: 1.25rem;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: white; border-bottom: 1px solid var(--gray-100);
    padding: 14px 20px; border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-header h5, .card-header h6 { font-weight: 600; color: var(--dark); margin: 0; }
.card-body { padding: 20px; }
.card-footer {
    background: var(--gray-50); border-top: 1px solid var(--gray-100);
    padding: 12px 20px; border-radius: 0 0 var(--radius) var(--radius) !important;
}

/* ===== Stat Cards ===== */
.stat-card { border: none; border-radius: var(--radius); overflow: hidden; }
.stat-card .card-body { padding: 20px 24px; }
.stat-card .stat-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 1.4rem;
    margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }
.stat-card .stat-label { font-size: .85rem; opacity: .85; margin-bottom: 4px; }
.stat-card .stat-detail { font-size: .78rem; opacity: .65; margin-top: 6px; }
.stat-card.primary { background: linear-gradient(135deg, #4f6ef7, #6366f1); color: white; }
.stat-card.primary .stat-icon { background: rgba(255,255,255,.2); }
.stat-card.success { background: linear-gradient(135deg, #10b981, #059669); color: white; }
.stat-card.success .stat-icon { background: rgba(255,255,255,.2); }
.stat-card.warning { background: linear-gradient(135deg, #f59e0b, #d97706); color: white; }
.stat-card.warning .stat-icon { background: rgba(255,255,255,.2); }
.stat-card.info { background: linear-gradient(135deg, #06b6d4, #0891b2); color: white; }
.stat-card.info .stat-icon { background: rgba(255,255,255,.2); }
.stat-card.danger { background: linear-gradient(135deg, #ef4444, #dc2626); color: white; }
.stat-card.danger .stat-icon { background: rgba(255,255,255,.2); }
.stat-card.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); color: white; }
.stat-card.purple .stat-icon { background: rgba(255,255,255,.2); }

/* ===== Tables ===== */
.table-card { border-radius: var(--radius); overflow: hidden; }
.table-card .table { margin-bottom: 0; }
.table-card .table thead th {
    background: var(--gray-50); border-bottom: 2px solid var(--gray-200);
    font-size: .8rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: .5px; color: var(--gray-500); padding: 12px 16px;
    white-space: nowrap;
}
.table-card .table tbody td { padding: 12px 16px; vertical-align: middle; font-size: .9rem; }
.table-card .table tbody tr { transition: background var(--transition); }
.table-card .table tbody tr:hover { background: var(--primary-light); }
.table > :not(caption) > * > * { border-bottom-color: var(--gray-100); }

/* ===== Badges & Tags ===== */
.badge { padding: 5px 10px; border-radius: 6px; font-weight: 500; font-size: .78rem; }
.badge-soft-primary { background: var(--primary-light); color: var(--primary); }
.badge-soft-success { background: #d1fae5; color: #065f46; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-info { background: #cffafe; color: #0e7490; }

/* ===== Buttons ===== */
.btn { border-radius: 8px; padding: 8px 16px; font-weight: 500; transition: all var(--transition); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #3b5de7; border-color: #3b5de7; }
.btn-outline-secondary { border-color: var(--gray-300); color: var(--gray-700); }
.btn-outline-secondary:hover { background: var(--gray-100); border-color: var(--gray-300); color: var(--dark); }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* ===== Forms ===== */
.form-control, .form-select {
    border-radius: 8px; border: 1px solid var(--gray-200); padding: 9px 14px;
    font-size: .9rem; transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,.15);
}
.form-label { font-weight: 500; color: var(--gray-700); font-size: .85rem; margin-bottom: 6px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ===== Pagination ===== */
.pagination { gap: 4px; }
.page-link {
    border-radius: 8px !important; border: none; color: var(--gray-700);
    padding: 6px 14px; font-size: .9rem; transition: all var(--transition);
}
.page-link:hover { background: var(--primary-light); color: var(--primary); }
.page-item.active .page-link { background: var(--primary); color: white; }

/* ===== Search Bar ===== */
.search-box { background: white; border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }

/* ===== Alerts ===== */
.alert { border: none; border-radius: 10px; font-size: .9rem; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }

/* ===== Animations ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeInUp .4s ease-out; }
.stat-card { animation: fadeInUp .4s ease-out; }
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }

/* ===== Product Card ===== */
.product-card { transition: transform 0.2s; }
.product-card:hover { transform: translateY(-2px); }
.product-card .card-img-top { height: 200px; object-fit: cover; }

/* ===== Status badges ===== */
.badge-status { padding: 4px 10px; border-radius: 12px; font-size: 0.8rem; }

/* ===== Bottom nav for mobile ===== */
.bottom-nav { z-index: 1000; box-shadow: 0 -2px 8px rgba(0,0,0,0.1); }
.bottom-nav a { color: #666; }
.bottom-nav a.active { color: #dc3545; }

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .admin-sidebar { position: fixed; z-index: 1050; width: 240px; }
    .admin-sidebar.d-none { display: none !important; }
    .admin-content { padding: 16px; }
}
@media (max-width: 768px) {
    .container { padding-left: 10px; padding-right: 10px; }
    .card-img-top { height: 150px !important; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .stat-card .stat-value { font-size: 1.35rem; }
}