/* ==========================================================================
   JOB/SERVICE CRM - ENTERPRISE THEME (Shadcn/UI Style)
   ========================================================================== */

/* 1. FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap');


/* 2. CSS VARIABLES */
:root {
    /* Palette */
    --brand-dark:       #0E2D44; 
    --brand-dark-lite:  #163b3b;
    --primary:          #62D84E; 
    --primary-hover:    #04b97c;
    --primary-fg:       #0E2D44; 

    /* Semantic */
    --secondary:        #64748b; 
    --success:          #10b981; 
    --info:             #0ea5e9; 
    --warning:          #f59e0b; 
    --danger:           #ef4444; 
    
    /* Surfaces */
    --bg-body:          #f8fafc; 
    --bg-card:          #ffffff;
    --bg-muted:         #f1f5f9; 
    
    /* Type */
    --text-main:        #0f172a; 
    --text-muted:       #64748b; 
    --font-sans:        "Figtree", sans-serif;
    
    /* UI Metrics */
    --radius-sm:        0.375rem;
    --radius-md:        0.5rem;
    --radius-lg:        0.75rem;
    --input-height:     2.5rem;
    --sidebar-w:        260px;
    --sidebar-w-col:    80px;
    
    /* Focus */
    --ring-offset:      2px;
    --ring-color:       rgba(98, 216, 78, 0.4);
    --border-color:     #e2e8f0;
    --border-input:     #cbd5e1;
}

/* 3. GLOBAL RESET */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 0.875rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }

/* 4. BOOTSTRAP OVERRIDES */

/* Buttons */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    height: var(--input-height);
    padding: 0 1rem;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--primary-fg);
}
.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--primary-fg);
}

/* Forms */
.form-control, .form-select {
    height: var(--input-height);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-input);
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--ring-color);
    outline: none;
}
.form-label { font-weight: 500; margin-bottom: 0.375rem; font-size: 0.875rem; }

/* Cards & Tables */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}
.card-body { padding: 1.5rem; }

.table th {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
}
.table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-color); }

/* Alerts */
.alert { border-radius: var(--radius-md); font-size: 0.875rem; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* Backgrounds */

.bg-primary { background-color: var(--primary) !important; color: var(--primary-fg) !important; }
.bg-secondary { background-color: var(--secondary) !important; color: #fff !important; }
.bg-success { background-color: var(--success) !important; color: #fff !important; }
.bg-info { background-color: var(--info) !important; color: #fff !important; }
.bg-warning { background-color: var(--warning) !important; color: #fff !important; }
.bg-danger { background-color: var(--danger) !important; color: #fff !important; }

.text-primary { color: var(--primary) !important; }
.text-secondary { color: var(--secondary) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-danger-emphasis{ color: #991b1b !important; }

/* ==========================================================================
   5. SIDEBAR (MOBILE FRIENDLY & PILL STYLE)
   ========================================================================== */
#wrapper {
    display: flex;
    width: 100%;
    position: relative;
}

/* Sidebar Base */
#sidebar-wrapper {
    width: var(--sidebar-w);
    height: 100vh;
    background-color: var(--brand-dark);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050; /* High z-index for mobile overlay */
    transition: width 0.3s ease, transform 0.3s ease;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
}

/* Header */
.sidebar-heading {
    height: 64px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-logo { max-height: 32px; width: 85%; object-fit: contain; }

/* Menu Container (Not List Group) */
.sidebar-menu {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-y: auto;
}

/* Menu Items (Pill Style) */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.75rem;
    margin: 0 0.75rem; /* The "Pill" Inset Margin */
    border-radius: var(--radius-md);
    
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 1.125rem;
    width: 20px;
    text-align: center;
    transition: color 0.2s;
}

/* Hover */
.nav-link:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
}

/* Active State (Bright Green Pill) */
.nav-link.active {
    background-color: var(--primary);
    color: var(--primary-fg);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.nav-link.active i { color: var(--primary-fg); }

/* Subheaders */
.nav-label {
    padding: 0.5rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    transition: opacity 0.2s;
}

/* Page Content */
#page-content-wrapper {
    width: 100%;
    margin-left: var(--sidebar-w); /* Desktop default */
    background-color: var(--bg-body);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Navbar */
.navbar-custom {
    background: var(--bg-card);
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

/* --- RESPONSIVE BEHAVIOR --- */

/* Desktop (Collapse Mode) */
@media (min-width: 769px) {
    /* When toggled on Desktop: Shrink Sidebar */
    body.sb-sidenav-toggled #sidebar-wrapper { width: var(--sidebar-w-col); }
    body.sb-sidenav-toggled #page-content-wrapper { margin-left: var(--sidebar-w-col); }
    
    /* Hide Text & Center Icons */
    body.sb-sidenav-toggled .nav-label,
    body.sb-sidenav-toggled .nav-link span,
    body.sb-sidenav-toggled .brand-text { display: none !important; }
    
    body.sb-sidenav-toggled .nav-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
        margin: 0 0.5rem; /* Tighter margins when collapsed */
    }
    body.sb-sidenav-toggled .sidebar-heading { justify-content: center; padding: 0; }
}

/* Mobile (Offcanvas Mode) */
@media (max-width: 768px) {
    /* Default Mobile: Sidebar Hidden (Off-screen) */
    #sidebar-wrapper {
        transform: translateX(-100%);
        width: var(--sidebar-w); /* Always full width when open */
    }
    #page-content-wrapper { margin-left: 0; }
    
    /* When Toggled on Mobile: Show Sidebar & Backdrop */
    body.sb-sidenav-toggled #sidebar-wrapper {
        transform: translateX(0);
        box-shadow: 0 0 20px rgba(0,0,0,0.3);
    }
    
    /* Backdrop Overlay */
    body.sb-sidenav-toggled::before {
        content: "";
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(15, 23, 42, 0.6); /* Dark dim */
        backdrop-filter: blur(2px);
        z-index: 1045; /* Below sidebar, above content */
        animation: fadeIn 0.3s;
    }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ==========================================================================
   6. AUTH PAGES
   ========================================================================== */
.auth-page-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-body);
    padding: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    background-color: var(--brand-dark);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    color: var(--bg-body)
}
.auth-header { padding: 2.5rem 2rem 1rem; text-align: center; }
.auth-body { padding: 1rem 2rem 2.5rem; }
.divider { height: 1px; background-color: var(--border-color); margin: 1.5rem 0; }
.success-message { text-align: center; padding: 3rem 2rem; }
.success-icon-circle {
    width: 64px; height: 64px;
    background-color: rgba(98, 216, 78, 0.1);
    color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex; align-items: center; justify-content: center;
}

/* ==========================================================================
   7. SETTINGS PAGE & TABS
   ========================================================================== */
.settings-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

/* Custom Pills (Vertical Sidebar Style for Settings) */
.nav-pills .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-pills .nav-link:hover {
    background-color: var(--bg-muted);
    color: var(--text-main);
}

.nav-pills .nav-link.active {
    background-color: var(--primary);
    color: var(--primary-fg);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.nav-pills .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Settings Card */
.settings-card {
    min-height: 400px;
}

/* Custom Field Row */
.custom-field-row {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}
.custom-field-row:hover {
    border-color: var(--border-input);
}

/* Responsive: Stack on mobile */
@media (max-width: 992px) {
    .settings-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .nav-pills {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        gap: 0.5rem;
    }
    .nav-pills .nav-link {
        white-space: nowrap;
    }
}

/* ==========================================================================
   8. DASHBOARD ADDITIONS
   ========================================================================== */

/* Circular Icons for Stat Cards */
.stat-icon-circle {
    width: 48px; 
    height: 48px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

/* Status Pills (Using your CSS Vars) */
.status-pill {
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

/* Map Statuses to your palette */
.status-primary   { background-color: rgba(98, 216, 78, 0.15); color: #04b97c; border: 1px solid rgba(98, 216, 78, 0.2); }
.status-success   { background-color: #ecfdf5; color: var(--success); border: 1px solid #d1fae5; }
.status-info      { background-color: #f0f9ff; color: var(--info); border: 1px solid #bae6fd; }
.status-warning   { background-color: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }
.status-danger    { background-color: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.status-secondary { background-color: var(--bg-muted); color: var(--text-muted); border: 1px solid var(--border-color); }

.stats-cards i{
    font-size: 2rem;
}