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

:root {
    --sidebar-bg: #1A2035;
    --sidebar-text: #8B94A6;
    --primary: #3B5BDB;
    --primary-light: #EEF2FF;
    --bg-main: #F5F6FA;
    --white: #FFFFFF;
    --text-dark: #1C1F2E;
    --text-gray: #9CA3AF;
    --success: #10B981;
    --success-bg: #D1FAE5;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --info: #3B82F6;
    --info-bg: #DBEAFE;
    --sidebar-width: 260px;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 4px 16px rgba(0,0,0,0.04);
    --transition: all 0.2s ease;
    --radius: 12px;
}

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

body { font-family: 'Inter', sans-serif; background: var(--bg-main); color: var(--text-dark); line-height: 1.6; }

/* ── WRAPPER ── */
.wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed; top: 0; left: 0;
    height: 100vh; z-index: 200;
    display: flex; flex-direction: column;
    transition: left 0.3s ease;
    overflow-y: auto;
}
.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-brand {
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    width: 100%;
}
.sidebar-logo-img {
    width: 180px;
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: opacity 0.2s;
}
.sidebar-logo-img:hover { opacity: 0.85; }
.sidebar-menu { padding: 16px 0; list-style: none; flex: 1; }
.menu-label {
    font-size: 0.68rem; font-weight: 600; letter-spacing: 1.2px;
    text-transform: uppercase; color: #4B5563;
    padding: 12px 28px 6px;
}
.menu-item { margin: 2px 12px; border-radius: 8px; }
.menu-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; color: var(--sidebar-text);
    text-decoration: none; font-size: 0.9rem; font-weight: 500;
    border-radius: 8px; transition: var(--transition);
}
.menu-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.menu-link.active { color: #fff; background: var(--primary); }
.menu-link .menu-icon { font-size: 1rem; width: 18px; text-align: center; }
.sidebar-footer {
    padding: 16px 28px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user img { width: 34px; height: 34px; border-radius: 50%; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.85rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.72rem; color: var(--sidebar-text); }
.sidebar-logout { color: var(--sidebar-text); font-size: 1rem; text-decoration: none; transition: var(--transition); }
.sidebar-logout:hover { color: var(--danger); }

/* ── MAIN CONTENT ── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── TOP NAVBAR ── */
.top-navbar {
    height: 68px; background: var(--white);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text-dark); }
.page-breadcrumb { font-size: 0.8rem; color: var(--text-gray); }
.nav-right { display: flex; align-items: center; gap: 20px; }
.search-wrap { position: relative; }
.search-wrap input {
    padding: 8px 16px 8px 38px;
    border: 1px solid var(--border-color);
    border-radius: 50px; font-family: 'Inter', sans-serif;
    font-size: 0.85rem; width: 220px;
    background: var(--bg-main); transition: var(--transition);
}
.search-wrap input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.search-wrap .si { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-gray); font-size: 0.85rem; }
.nav-avatar { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.nav-avatar img { width: 34px; height: 34px; border-radius: 50%; }
.nav-avatar-name { font-size: 0.85rem; font-weight: 600; }
.btn-hamburger { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; color: var(--text-dark); }

/* ── CONTENT AREA ── */
.content-area { padding: 28px 32px; flex: 1; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card {
    background: var(--white); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.stat-icon {
    width: 52px; height: 52px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
.stat-info {}
.stat-label { font-size: 0.8rem; color: var(--text-gray); font-weight: 500; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-dark); line-height: 1.2; }
.stat-sub { font-size: 0.75rem; color: var(--success); margin-top: 2px; }

/* ── CARDS ── */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.card-title { font-size: 1rem; font-weight: 700; }
.card-body { padding: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 0.875rem; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #2F4AC5; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D97706; }
.btn-secondary { background: var(--bg-main); color: var(--text-dark); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--border-color); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 7px; border-radius: 8px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 11px 16px; font-size: 0.78rem; font-weight: 600; color: var(--text-gray); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); text-align: left; white-space: nowrap; }
tbody td { padding: 13px 16px; font-size: 0.88rem; border-bottom: 1px solid var(--border-color); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FAFBFF; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 50px; font-size: 0.72rem; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gray { background: #F3F4F6; color: #6B7280; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-group { margin-bottom: 18px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; color: var(--text-dark); }
.form-control {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px; font-family: 'Inter', sans-serif;
    font-size: 0.9rem; background: #FAFBFC;
    transition: var(--transition); color: var(--text-dark);
}
.form-control:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-light); }
.form-control::placeholder { color: var(--text-gray); }
.form-section-title { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; color: var(--text-gray); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }

/* ── ALERTS ── */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 20px; font-size: 0.88rem; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--success-bg); color: #065F46; border: 1px solid #6EE7B7; }
.alert-danger { background: var(--danger-bg); color: #991B1B; border: 1px solid #FCA5A5; }
.alert-warning { background: var(--warning-bg); color: #92400E; border: 1px solid #FCD34D; }
.alert-info { background: var(--info-bg); color: #1E40AF; border: 1px solid #93C5FD; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header-left h2 { font-size: 1.3rem; font-weight: 700; }
.page-header-left p { font-size: 0.85rem; color: var(--text-gray); margin-top: 2px; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; align-items: center; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--border-color); flex-wrap: wrap; }
.filter-bar input, .filter-bar select { padding: 8px 12px; border: 1px solid var(--border-color); border-radius: 8px; font-family: 'Inter', sans-serif; font-size: 0.85rem; background: var(--bg-main); }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: var(--primary); }

/* ── AVATAR ── */
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-placeholder { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }

/* ── LOGIN PAGE ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1A2035 0%, #2D3A5C 50%, #1A2035 100%); }
.login-box { background: var(--white); border-radius: 20px; padding: 48px 44px; width: 100%; max-width: 420px; box-shadow: 0 25px 60px rgba(0,0,0,0.25); }
.login-logo { text-align: center; margin-bottom: 20px; }
.login-logo-img { width: 200px; height: auto; object-fit: contain; }
.login-logo p { font-size: 0.85rem; color: var(--text-gray); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-btn { width: 100%; padding: 13px; background: var(--primary); color: #fff; border: none; border-radius: 10px; font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600; cursor: pointer; transition: var(--transition); margin-top: 8px; }
.login-btn:hover { background: #2F4AC5; transform: translateY(-1px); }
.login-footer { text-align: center; margin-top: 28px; font-size: 0.78rem; color: var(--text-gray); }

/* ════════════════════════════════════════
   RESPONSIVE — MOBILE FIRST
   Desktop styles above are NEVER modified.
   All rules below are media-query-scoped.
   ════════════════════════════════════════ */

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Small Tablet / Large Phone (≤992px) ── */
@media (max-width: 992px) {
    /* Sidebar slides off-screen, revealed by hamburger */
    .sidebar { left: -280px; box-shadow: none; }
    .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.35); }
    .main-content { margin-left: 0; }

    /* Hamburger visible */
    .btn-hamburger { display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 8px; transition: background 0.2s; }
    .btn-hamburger:hover { background: var(--primary-light); }

    /* Dark overlay behind sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.55);
        z-index: 199;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.show { display: block; }

    /* Tighten the navbar */
    .top-navbar { padding: 0 20px; height: 60px; }
    .page-title { font-size: 1.05rem; }
    .page-breadcrumb { display: none; }
    .nav-avatar-name { display: none; }
    .nav-right { gap: 12px; }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
    /* Layout */
    .content-area { padding: 16px 12px; }
    .top-navbar { padding: 0 14px; height: 56px; }
    .search-wrap { display: none; }

    /* Stats grid: 2 columns on mobile, not 1 */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
    .stat-card { padding: 14px 16px; gap: 12px; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; border-radius: 10px; }
    .stat-value { font-size: 1.3rem; }
    .stat-label { font-size: 0.72rem; }
    .stat-sub { font-size: 0.68rem; }

    /* Cards */
    .card-header { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
    .card-title { font-size: 0.92rem; }
    .card-body { padding: 14px 16px; }
    .grid-2 { grid-template-columns: 1fr; gap: 14px; margin-bottom: 16px; }

    /* Tables — horizontal scroll */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
    table { min-width: 520px; }
    thead th { padding: 9px 12px; font-size: 0.72rem; }
    tbody td { padding: 10px 12px; font-size: 0.82rem; }

    /* Forms */
    .form-grid { grid-template-columns: 1fr; gap: 0; }
    .form-group.full { grid-column: 1; }
    .form-group { margin-bottom: 14px; }
    .form-control { font-size: 0.92rem; padding: 10px 12px; }

    /* Buttons — wrap nicely */
    .btn { font-size: 0.82rem; padding: 8px 14px; }
    .btn-sm { padding: 6px 10px; font-size: 0.75rem; }

    /* Page header — stack on very small screens */
    .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
    .page-header-left h2 { font-size: 1.1rem; }

    /* Filter bar — wrap items */
    .filter-bar { padding: 12px 16px; gap: 8px; }
    .filter-bar input, .filter-bar select { font-size: 0.82rem; padding: 7px 10px; width: 100%; }

    /* Badges */
    .badge { font-size: 0.68rem; padding: 2px 8px; }

    /* Alerts */
    .alert { font-size: 0.82rem; padding: 12px 14px; }

    /* Pay info box */
    .pay-info-box { flex-direction: column; gap: 8px; padding: 14px; }

    /* Toast — full-width at bottom */
    #toast-container { bottom: 16px; right: 12px; left: 12px; align-items: stretch; }
    .toast { min-width: unset; max-width: unset; width: 100%; }
}

/* ── Very small phone (≤480px) ── */
@media (max-width: 480px) {
    /* Stats cards: keep 2 columns but make them more compact */
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px 10px; gap: 8px; flex-direction: column; align-items: flex-start; }
    .stat-icon { width: 36px; height: 36px; font-size: 1rem; border-radius: 8px; }
    .stat-value { font-size: 1.15rem; }

    /* Login page — remove heavy padding on tiny screens */
    .login-box { padding: 32px 20px; border-radius: 14px; margin: 16px; max-width: 100%; }
    .login-logo-img { width: 160px; }

    /* Navbar items */
    .top-navbar { padding: 0 12px; height: 52px; }
    .page-title { font-size: 0.95rem; }

    /* Content area */
    .content-area { padding: 12px 10px; }

    /* Table rows tighter */
    thead th { padding: 8px 10px; }
    tbody td { padding: 9px 10px; }

    /* Sidebar logo slightly smaller */
    .sidebar-logo-img { width: 150px; }

    /* Sidebar footer compact */
    .sidebar-footer { padding: 12px 20px; }
    .sidebar-user img { width: 28px; height: 28px; }
    .sidebar-user-name { font-size: 0.78rem; }
    .sidebar-user-role { font-size: 0.65rem; }
}

/* ── PAYMENT INFO BOX ── */
.pay-info-box {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    border: 1px solid #93C5FD;
    border-left: 4px solid var(--primary);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 24px;
}
.pay-info-icon {
    font-size: 1.4rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}
.pay-info-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1E40AF;
    margin-bottom: 4px;
}
.pay-info-desc {
    font-size: 0.83rem;
    color: #1E3A8A;
    line-height: 1.5;
}
.pay-info-desc strong {
    color: #1D4ED8;
    font-weight: 700;
}

/* ── TOAST NOTIFICATIONS ── */
#toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 300px;
    max-width: 380px;
    padding: 14px 16px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    pointer-events: all;
    position: relative;
    overflow: hidden;
    animation: toastIn 0.35s cubic-bezier(0.34,1.56,0.64,1) forwards;
    cursor: pointer;
}
.toast.hide {
    animation: toastOut 0.3s ease forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(60px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0)   scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0)   scale(1); }
    to   { opacity: 0; transform: translateX(60px) scale(0.95); }
}
.toast-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-size: 0.82rem; font-weight: 700; margin-bottom: 2px; }
.toast-msg   { font-size: 0.82rem; line-height: 1.45; }
.toast-close { background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.6; padding: 0; transition: opacity 0.2s; flex-shrink: 0; }
.toast-close:hover { opacity: 1; }
.toast-progress {
    position: absolute;
    bottom: 0; left: 0;
    height: 3px;
    border-radius: 0 0 12px 12px;
    animation: toastProgress linear forwards;
}
@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}
/* Toast types */
.toast-warning  { background: #FFFBEB; border: 1px solid #FCD34D; color: #78350F; }
.toast-warning  .toast-icon     { color: #F59E0B; }
.toast-warning  .toast-progress { background: #F59E0B; }
.toast-success  { background: #F0FDF4; border: 1px solid #6EE7B7; color: #064E3B; }
.toast-success  .toast-icon     { color: #10B981; }
.toast-success  .toast-progress { background: #10B981; }
.toast-danger   { background: #FFF1F2; border: 1px solid #FCA5A5; color: #7F1D1D; }
.toast-danger   .toast-icon     { color: #EF4444; }
.toast-danger   .toast-progress { background: #EF4444; }
.toast-info     { background: #EFF6FF; border: 1px solid #93C5FD; color: #1E3A8A; }
.toast-info     .toast-icon     { color: #3B82F6; }
.toast-info     .toast-progress { background: #3B82F6; }
