/* ======================================================
   TotalERP — Professional Stylesheet
   ====================================================== */

:root {
    --sidebar-bg:      #0f1623;
    --sidebar-hover:   #1e2a3a;
    --sidebar-active:  #1e3a5f;
    --sidebar-border:  #1e2d40;
    --sidebar-text:    #8fa3b8;
    --sidebar-text-active: #ffffff;
    --sidebar-width:   255px;
    --accent:          #2563eb;
    --accent-hover:    #1d4ed8;
    --topbar-bg:       #ffffff;
    --body-bg:         #f0f4f8;
    --card-bg:         #ffffff;
    --text-primary:    #1e293b;
    --text-muted:      #64748b;
    --border-color:    #e2e8f0;
    --success:         #10b981;
    --warning:         #f59e0b;
    --danger:          #ef4444;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--sidebar-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
    background: #080e17;
}

.sidebar-brand img { height: 36px; width: auto; }

.sidebar-brand-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-section {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #3d5166;
    padding: 18px 20px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.87rem;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--accent);
    font-weight: 600;
}

.sidebar-nav a .nav-icon {
    width: 18px;
    text-align: center;
    opacity: 0.8;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.sidebar-nav a.active .nav-icon { opacity: 1; }

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── TOP BAR ─────────────────────────────────────────── */
.topbar {
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ── PAGE BODY ───────────────────────────────────────── */
.page-body {
    padding: 24px;
    flex: 1;
}

/* ── CARDS ───────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-radius: 10px 10px 0 0 !important;
}

.card-body { padding: 18px; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
    padding: 20px;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.75;
    margin-bottom: 6px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-sub { font-size: 0.78rem; margin-top: 4px; opacity: 0.7; }

.stat-blue   { background: linear-gradient(135deg,#2563eb,#3b82f6); color:#fff; }
.stat-green  { background: linear-gradient(135deg,#059669,#10b981); color:#fff; }
.stat-amber  { background: linear-gradient(135deg,#d97706,#f59e0b); color:#fff; }
.stat-red    { background: linear-gradient(135deg,#dc2626,#ef4444); color:#fff; }
.stat-purple { background: linear-gradient(135deg,#7c3aed,#a78bfa); color:#fff; }

/* ── TABLES ──────────────────────────────────────────── */
.table { font-size: 0.87rem; }
.table thead th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 10px 14px;
    white-space: nowrap;
}
.table td { padding: 11px 14px; vertical-align: middle; border-color: #f1f5f9; }
.table tbody tr:hover { background: #f8fafc; }

/* ── BADGES ──────────────────────────────────────────── */
.badge-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-approved { background: #d1fae5; color: #065f46; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-active   { background: #dbeafe; color: #1e40af; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn-primary   { background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ── SEARCH BAR ──────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
    flex-wrap: wrap;
}

.search-bar .form-control,
.search-bar .form-select {
    font-size: 0.85rem;
    border-color: var(--border-color);
    border-radius: 6px;
}

/* ── FORMS ───────────────────────────────────────────── */
.form-label { font-weight: 600; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 4px; }
.form-control, .form-select {
    border-color: var(--border-color);
    border-radius: 7px;
    font-size: 0.88rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

/* ── ALERTS ──────────────────────────────────────────── */
.alert { border-radius: 8px; font-size: 0.875rem; border: none; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }

/* ── FILE UPLOAD ZONE ────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #fafbfc;
}

.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: #eff6ff;
}

.upload-zone .upload-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 8px; }

/* ── LOGIN PAGE (no sidebar) ─────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1623 0%, #1e3a5f 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.auth-card-header {
    background: linear-gradient(135deg, #0f1623, #1e3a5f);
    padding: 32px 36px 28px;
    text-align: center;
}

.auth-card-header img { height: 52px; width: auto; margin-bottom: 14px; }

.auth-card-header h1 {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
}

.auth-card-header p { color: #94a3b8; font-size: 0.85rem; margin: 4px 0 0; }

.auth-card-body { padding: 32px 36px; }

/* ── SCROLLBAR ───────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #2d4a6a; border-radius: 4px; }
