/*
 * AWebBee Agency ERP & CRM
 * Premium Apple-Inspired Light Theme
 * Light Mode ONLY — Clean, White, Soft Shadows
 */

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

:root {
    /* ── Core Background ── */
    --bg-page:        #F2F4F7;
    --bg-sidebar:     #FFFFFF;
    --bg-topbar:      rgba(255, 255, 255, 0.92);
    --bg-card:        #FFFFFF;

    /* ── Text ── */
    --text-dark:      #111827;
    --text-body:      #374151;
    --text-muted:     #9CA3AF;
    --text-label:     #6B7280;

    /* ── Borders ── */
    --border:         #E5E7EB;
    --border-light:   #F3F4F6;

    /* ── Module Colors (Apple palette) ── */
    --color-crm:      #2563EB;   /* Blue   — CRM */
    --color-comms:    #7C3AED;   /* Violet — Communications */
    --color-finance:  #059669;   /* Green  — Finance */
    --color-projects: #D97706;   /* Amber  — Projects */
    --color-hr:       #EA580C;   /* Orange — HR */
    --color-security: #DC2626;   /* Red    — Security */
    --color-ai:       #0891B2;   /* Cyan   — AI/BI */

    /* ── Shadows ── */
    --shadow-xs:  0 1px 2px  rgba(0,0,0,0.04);
    --shadow-sm:  0 2px 8px  rgba(0,0,0,0.05);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.07);
    --shadow-lg:  0 8px 32px rgba(0,0,0,0.08);

    /* ── Radius ── */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  20px;

    /* Alias for legacy variables used in views */
    --accent:             var(--color-crm);
    --primary-color:      var(--color-crm);
    --accent-finance:     var(--color-finance);
    --accent-projects:    var(--color-projects);
    --warning-color:      #F59E0B;
}

/* ════════════════════════════════════════
   RESET & BASE
════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-body);
    font-size: 0.9rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

a { text-decoration: none; color: inherit; }

/* ════════════════════════════════════════
   LAYOUT
════════════════════════════════════════ */
#wrapper { display: flex; min-height: 100vh; }

/* ════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════ */
#sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
    transition: width 0.25s ease;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hide scrollbar but keep scrollable */
#sidebar::-webkit-scrollbar { width: 0; }

.sidebar-brand {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-brand-icon i { color: var(--color-crm); }
.sidebar-brand-text { font-size: 1rem; font-weight: 800; color: var(--text-dark); letter-spacing: -0.03em; }

/* Sidebar section labels */
#sidebar .px-4.mt-4 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 1.25rem 1.25rem 0.4rem !important;
    margin: 0 !important;
}

/* Sidebar links */
#sidebar ul.components { padding: 0.5rem 0; }
#sidebar ul.components li { list-style: none; }

#sidebar ul.components li a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    margin: 0.1rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-label);
    font-weight: 500;
    font-size: 0.845rem;
    transition: background 0.15s ease, color 0.15s ease;
}

#sidebar ul.components li a i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

#sidebar ul.components li a:hover,
#sidebar ul.components li.active a {
    background: var(--border-light);
    color: var(--text-dark);
}

/* Module color hover highlights */
.module-crm a:hover      { background: rgba(37,99,235,0.07) !important;  color: var(--color-crm) !important; }
.module-comms a:hover    { background: rgba(124,58,237,0.07) !important; color: var(--color-comms) !important; }
.module-finance a:hover  { background: rgba(5,150,105,0.07) !important;  color: var(--color-finance) !important; }
.module-projects a:hover { background: rgba(217,119,6,0.07) !important;  color: var(--color-projects) !important; }
.module-hr a:hover       { background: rgba(234,88,12,0.07) !important;  color: var(--color-hr) !important; }
.module-security a:hover { background: rgba(220,38,38,0.07) !important;  color: var(--color-security) !important; }
.module-ai a:hover       { background: rgba(8,145,178,0.07) !important;  color: var(--color-ai) !important; }

/* ════════════════════════════════════════
   TOPBAR
════════════════════════════════════════ */
#content-wrapper { flex: 1; overflow-x: hidden; }

.topbar {
    background: var(--bg-topbar);
    backdrop-filter: saturate(200%) blur(20px);
    -webkit-backdrop-filter: saturate(200%) blur(20px);
    border-bottom: 1px solid var(--border);
    height: 60px;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

/* Page content padding */
.container-fluid { padding: 1.75rem 2rem; }

/* ════════════════════════════════════════
   CARDS
════════════════════════════════════════ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.card-header h6 { font-size: 0.875rem; font-weight: 700; color: var(--text-dark); }
.card-body { padding: 1.25rem; }

/* Stat cards */
.stat-card {
    border-left: 3px solid transparent;
    padding: 1.2rem 1.25rem;
}
.stat-card .stat-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 0.25rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; color: var(--text-dark); line-height: 1; }

/* ════════════════════════════════════════
   BUTTONS
════════════════════════════════════════ */
.btn {
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.845rem;
    padding: 0.45rem 1rem;
    transition: all 0.18s ease;
    border: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }

.btn-primary   { background: var(--color-crm);      color: #fff; }
.btn-success   { background: var(--color-finance);   color: #fff; }
.btn-warning   { background: var(--color-projects);  color: #fff; }
.btn-danger    { background: var(--color-security);  color: #fff; }
.btn-info      { background: var(--color-ai);        color: #fff; }
.btn-secondary { background: #E5E7EB; color: var(--text-body); box-shadow: none; }
.btn-secondary:hover { background: #D1D5DB; transform: none; box-shadow: none; }

.btn-light { background: var(--border-light); color: var(--text-body); border: 1px solid var(--border); box-shadow: none; }
.btn-light:hover { background: var(--border); transform: none; }

.btn-outline-primary { background: transparent; border: 1.5px solid var(--color-crm); color: var(--color-crm); }
.btn-outline-primary:hover { background: var(--color-crm); color: #fff; }

/* ════════════════════════════════════════
   TABLES
════════════════════════════════════════ */
.table { color: var(--text-body); margin-bottom: 0; }
.table thead th {
    background: var(--border-light);
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 0.75rem 1rem;
}
.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-body);
}
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background: rgba(0,0,0,0.015); }

/* ════════════════════════════════════════
   FORMS
════════════════════════════════════════ */
.form-label { font-size: 0.775rem; font-weight: 600; color: var(--text-label); margin-bottom: 0.3rem; }
.form-control, .form-select {
    background: var(--border-light);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.875rem;
    color: var(--text-dark);
    font-size: 0.875rem;
    transition: all 0.18s ease;
}
.form-control:focus, .form-select:focus {
    background: #FFFFFF;
    border-color: var(--color-crm);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
    outline: none;
}
.form-control::placeholder { color: var(--text-muted); }

/* ════════════════════════════════════════
   BADGES
════════════════════════════════════════ */
.badge {
    border-radius: 6px;
    padding: 0.3em 0.65em;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ════════════════════════════════════════
   ALERTS & FLASH MESSAGES
════════════════════════════════════════ */
.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
}
.alert-success { background: #ECFDF5; color: #065F46; }
.alert-danger  { background: #FEF2F2; color: #991B1B; }
.alert-warning { background: #FFFBEB; color: #92400E; }
.alert-info    { background: #EFF6FF; color: #1E40AF; }

/* ════════════════════════════════════════
   MODALS
════════════════════════════════════════ */
.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    background: var(--border-light);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border-bottom: 1px solid var(--border);
    padding: 1.1rem 1.5rem;
}
.modal-footer {
    background: var(--border-light);
    border-top: 1px solid var(--border);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: 0.875rem 1.5rem;
}
.modal-body { padding: 1.5rem; }

/* ════════════════════════════════════════
   DROPDOWNS
════════════════════════════════════════ */
.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    font-size: 0.875rem;
}
.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.875rem;
    color: var(--text-body);
    font-weight: 500;
}
.dropdown-item:hover { background: var(--border-light); color: var(--text-dark); }

/* ════════════════════════════════════════
   UTILITY OVERRIDES
════════════════════════════════════════ */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow    { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.text-primary   { color: var(--color-crm) !important; }
.text-success   { color: var(--color-finance) !important; }
.text-warning   { color: var(--color-projects) !important; }
.text-danger    { color: var(--color-security) !important; }
.text-info      { color: var(--color-ai) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-dark      { color: var(--text-dark) !important; }
.text-secondary { color: var(--text-label) !important; }

.bg-light { background-color: var(--border-light) !important; }
.bg-white { background-color: #FFFFFF !important; }
.border-0 { border: none !important; }

/* Fix for dark backgrounds accidentally applied */
.bg-dark, .bg-secondary { background-color: var(--border) !important; color: var(--text-dark) !important; }

/* ════════════════════════════════════════
   SCROLLBAR (Light & Thin)
════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #D1D5DB; }

/* ════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════ */
@media (max-width: 768px) {
    #sidebar { position: fixed; z-index: 999; left: -240px; top: 0; transition: left 0.25s ease; }
    #sidebar.toggled { left: 0; }
    .container-fluid { padding: 1rem; }
}
