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

:root {
    --primary:        #6366F1;
    --primary-hover:  #4F46E5;
    --primary-light:  rgba(99, 102, 241, 0.12);
    --bg:             #0B0F1A;
    --bg2:            #111827;
    --card:           #161D2E;
    --card2:          #1E2A42;
    --border:         #263044;
    --text:           #F1F5F9;
    --text-muted:     #64748B;
    --text-sub:       #94A3B8;
    --success:        #22C55E;
    --danger:         #EF4444;
    --warning:        #F59E0B;
    --info:           #38BDF8;
    --radius:         14px;
    --radius-sm:      8px;
    --shadow:         0 8px 32px rgba(0,0,0,0.4);
    --shadow-sm:      0 2px 8px rgba(0,0,0,0.3);
    --transition:     0.25s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ─── Auth ─── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
      radial-gradient(ellipse 80% 60% at 20% -10%, rgba(99,102,241,0.3) 0%, transparent 60%),
      radial-gradient(ellipse 60% 50% at 80% 110%, rgba(99,102,241,0.15) 0%, transparent 60%),
      var(--bg);
}

.auth-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.75rem 2.5rem;
    width: min(420px, 92vw);
    box-shadow: var(--shadow);
}

.auth-logo {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-logo span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px; height: 52px;
    background: var(--primary);
    border-radius: 14px;
    font-size: 1.5rem;
}

.auth-box h2 {
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
    margin: 1rem 0 0.35rem;
}

.auth-box p.sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* ─── Form Elements ─── */
.form-group { margin-bottom: 1.25rem; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-sub);
    margin-bottom: 0.4rem;
}

.form-control, .form-select {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9375rem;
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition), box-shadow var(--transition);
    appearance: none;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.form-control::placeholder { color: var(--text-muted); }

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16A34A; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #D97706; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    color: var(--text-sub);
    border: 1px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-block { width: 100%; justify-content: center; padding: 0.75rem; font-size: 1rem; }

/* ─── Alerts ─── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.alert-danger  { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: #FCA5A5; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #86EFAC; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: #FCD34D; }

/* ─── Layout ─── */
.layout { display: flex; min-height: 100vh; }

/* ─── Sidebar ─── */
.sidebar {
    width: 260px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.brand-icon {
    width: 38px; height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.brand-tagline { font-size: 0.7rem; color: var(--text-muted); }

.nav-section {
    padding: 1rem 1rem 0.5rem;
    flex: 1;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.5rem 0.5rem 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-sub);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 450;
    margin-bottom: 0.15rem;
    transition: all var(--transition);
}
.nav-link:hover {
    background: var(--primary-light);
    color: var(--text);
}
.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.75rem; color: var(--text-muted); text-transform: capitalize; }
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* ─── Main ─── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    padding: 1.1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h1 {
    font-size: 1.1rem;
    font-weight: 700;
}
.topbar-left .breadcrumb {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.topbar-actions { display: flex; align-items: center; gap: 0.75rem; }

.page-content { padding: 2rem; flex: 1; }

/* ─── Stats Grid ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 14px 0 100%;
    opacity: 0.15;
}
.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before  { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-icon {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    display: inline-flex;
    width: 42px; height: 42px;
    background: var(--primary-light);
    border-radius: 10px;
    align-items: center;
    justify-content: center;
}
.stat-card.success .stat-icon { background: rgba(34,197,94,0.12); }
.stat-card.danger  .stat-icon { background: rgba(239,68,68,0.12); }
.stat-card.warning .stat-icon { background: rgba(245,158,11,0.12); }

.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.4rem; font-weight: 500; }
.stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.stat-change { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.up { color: var(--success); }
.down { color: var(--danger); }

/* ─── Card ─── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.card-title { font-size: 1rem; font-weight: 600; }
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-sub);
    vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(99,102,241,0.05); color: var(--text); }

.td-name { font-weight: 500; color: var(--text) !important; }

/* ─── Badge ─── */
.badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-danger  { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info    { background: rgba(56,189,248,0.15); color: var(--info); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 2rem;
    width: min(540px, 94vw);
    box-shadow: var(--shadow);
    animation: modalIn .3s ease;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-lg { width: min(780px, 94vw); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 1.3rem; cursor: pointer; line-height: 1; padding: 0.2rem; }
.modal-close:hover { color: var(--danger); }
.modal-footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

@keyframes modalIn { from { opacity:0; transform: translateY(-20px) scale(.97); } to { opacity:1; transform: none; } }

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-sub); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; margin-bottom: 1.5rem; }

/* ─── Search Bar ─── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap .icon { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input { padding-left: 2.5rem !important; }

/* ─── Invoice Print ─── */
.invoice-preview {
    background: #fff;
    color: #111;
    padding: 2.5rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar { position: fixed; left: -260px; transition: left .3s ease; }
    .sidebar.open { left: 0; }
    .page-content { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
