/* ============================================================
   assets/css/style.css - MODERN VERSION
   ============================================================ */

/* ===== ROOT VARIABLES ===== */
:root {
    /* Primary Colors */
    --primary: #4F46E5;
    --primary-light: #818CF8;
    --primary-dark: #3730A3;
    --secondary: #7C3AED;
    --secondary-light: #A78BFA;
    
    /* Status Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --info: #06B6D4;
    --info-light: #DBEAFE;
    
    /* Neutral Colors */
    --bg: #F1F5F9;
    --bg-dark: #0F172A;
    --card: #FFFFFF;
    --card-glass: rgba(255, 255, 255, 0.7);
    --text: #1E293B;
    --text-light: #64748B;
    --text-white: #FFFFFF;
    --border: #E2E8F0;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Border Radius */
    --radius: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Transition */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ===== LAYOUT ===== */
.wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--text-white);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: var(--radius-full); }

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    text-align: center;
    margin-bottom: 10px;
}

.sidebar-brand .brand-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 4px;
}

.sidebar-brand h3 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-brand small {
    opacity: 0.7;
    font-size: 12px;
    display: block;
    margin-top: 2px;
}

.sidebar-menu { list-style: none; padding: 0; }

.sidebar-menu .menu-label {
    padding: 15px 20px 5px;
    font-size: 10px;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: var(--transition);
    border-radius: 0;
    position: relative;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-menu li a i {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-menu li a:hover {
    background: rgba(255,255,255,0.12);
    color: var(--text-white);
}

.sidebar-menu li a.active {
    background: rgba(255,255,255,0.18);
    color: var(--text-white);
    box-shadow: inset 3px 0 0 var(--text-white);
}

.sidebar-menu li a .badge-sidebar {
    margin-left: auto;
    background: rgba(255,255,255,0.2);
    padding: 1px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
}

/* ===== CONTENT ===== */
.content {
    margin-left: 270px;
    padding: 25px 30px;
    flex: 1;
    width: 100%;
    min-height: 100vh;
    background: var(--bg);
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    padding: 16px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    backdrop-filter: blur(8px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left h2 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar .btn-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.topbar .btn-mobile:hover { background: var(--bg); }

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info .avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.user-info .user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-info .user-role {
    font-size: 12px;
    color: var(--text-light);
}

/* ===== STATS CARDS ===== */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card);
    padding: 22px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.6);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    font-size: 28px;
    color: var(--primary-light);
    margin-bottom: 6px;
}

.stat-card .stat-number {
    font-size: 30px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.stat-card .stat-trend.up { color: var(--success); }
.stat-card .stat-trend.down { color: var(--danger); }

/* ===== CARD ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(226, 232, 240, 0.6);
    padding: 24px;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--bg);
}

.card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i { color: var(--primary); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    font-family: inherit;
    line-height: 1.4;
}

.btn i { font-size: 15px; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-secondary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #D97706; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: white; }

.btn-sm { padding: 5px 14px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }

/* ===== TABLE ===== */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table thead {
    background: linear-gradient(135deg, var(--bg), #E8EDF5);
}

table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
}

table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr {
    transition: var(--transition);
}

table tbody tr:hover td {
    background: #F8FAFC;
}

table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGE ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-info { background: var(--info-light); color: #1E40AF; }
.badge-primary { background: #E0E7FF; color: var(--primary); }

/* ===== FORM ===== */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 5px;
}

.form-group label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--card);
    color: var(--text);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

.form-control::placeholder { color: var(--text-light); opacity: 0.6; }

.form-control-sm { padding: 7px 12px; font-size: 13px; }
.form-control-lg { padding: 14px 20px; font-size: 16px; }

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ===== ALERT / FLASH ===== */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    border-left: 4px solid transparent;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success {
    background: var(--success-light);
    color: #065F46;
    border-left-color: var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: #991B1B;
    border-left-color: var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: #92400E;
    border-left-color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #1E40AF;
    border-left-color: var(--info);
}

.alert i { font-size: 18px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 50%, #4F46E5 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -200px;
    right: -200px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
    bottom: -150px;
    left: -150px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 40px 44px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.3);
}

.login-card .login-logo {
    text-align: center;
    margin-bottom: 8px;
}

.login-card .login-logo .logo-icon {
    font-size: 48px;
    display: block;
}

.login-card h2 {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 28px;
}

.login-card .btn-login {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 16px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 992px) {
    .form-row { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    
    .content {
        margin-left: 0;
        padding: 16px;
    }
    
    .topbar .btn-mobile { display: inline-flex; }
    
    .stats { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-card .stat-number { font-size: 24px; }
    
    .card { padding: 16px; }
    .login-card { padding: 28px 20px; margin: 16px; }
    
    .topbar-left h2 { font-size: 17px; }
    .user-info .user-name { display: none; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr; }
    .stat-card .stat-number { font-size: 28px; }
    .topbar { flex-wrap: wrap; gap: 10px; padding: 12px 16px; }
}