/* ==========================================================================
   CRMS Modern Light Theme System
   Primary Accent: Red/Coral (#e11d48)
   ========================================================================== */

:root {
    --crms-bg: #f8fafc;
    --crms-sidebar-bg: #ffffff;
    --crms-topbar-bg: #ffffff;
    --crms-card-bg: #ffffff;
    
    /* Text Colors */
    --crms-text-main: #0f172a;
    --crms-text-muted: #64748b;
    --crms-text-light: #94a3b8;
    
    /* Brand Primary Red/Coral */
    --crms-red: #e11d48;
    --crms-red-hover: #be123c;
    --crms-red-light: #fff1f2;
    --crms-red-border: #fecdd3;
    
    /* Category Colors */
    --crms-blue: #3b82f6;
    --crms-blue-light: #eff6ff;
    --crms-purple: #8b5cf6;
    --crms-purple-light: #f5f3ff;
    --crms-green: #10b981;
    --crms-green-light: #ecfdf5;
    --crms-orange: #f59e0b;
    --crms-orange-light: #fffbeb;
    
    /* Borders & Shadows */
    --crms-border: #e2e8f0;
    --crms-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --crms-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    --crms-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08);

    /* Layout Dimensions */
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 64px;
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background-color: var(--crms-bg);
    color: var(--crms-text-main);
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

/* ==========================================================================
   1. SIDEBAR NAVIGATION
   ========================================================================== */
.crms-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--crms-sidebar-bg);
    border-right: 1px solid var(--crms-border);
    z-index: 1040;
    transition: all 0.25s ease-in-out;
    display: flex;
    flex-direction: column;
}

.crms-sidebar-brand {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--crms-border);
}

.crms-brand-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.crms-brand-icon {
    color: var(--crms-red);
}

.crms-sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
}

.crms-menu-heading {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #94a3b8;
    letter-spacing: 0.08em;
    padding: 0.75rem 0.75rem 0.35rem;
}

.crms-nav-item {
    margin-bottom: 0.25rem;
}

.crms-nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.85rem;
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 0.625rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.crms-nav-link i {
    font-size: 1.1rem;
    margin-right: 0.75rem;
    color: #64748b;
    width: 20px;
    text-align: center;
}

.crms-nav-link:hover {
    color: var(--crms-red);
    background-color: var(--crms-red-light);
}

.crms-nav-link:hover i {
    color: var(--crms-red);
}

.crms-nav-link.active {
    color: var(--crms-red);
    background-color: var(--crms-red-light);
    font-weight: 700;
}

.crms-nav-link.active i {
    color: var(--crms-red);
}

/* ==========================================================================
   2. TOP BAR & MAIN CONTENT WRAPPER
   ========================================================================== */
.crms-main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s ease-in-out;
}

/* Collapsed Mini Sidebar (Icon-Only Mode) */
.crms-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.crms-sidebar.collapsed .crms-brand-text,
.crms-sidebar.collapsed .crms-menu-heading,
.crms-sidebar.collapsed .crms-nav-text {
    display: none !important;
}

.crms-sidebar.collapsed .crms-sidebar-brand {
    padding: 0 0.5rem;
    justify-content: center;
}

.crms-sidebar.collapsed .crms-nav-link {
    justify-content: center;
    padding: 0.75rem 0;
}

.crms-sidebar.collapsed .crms-nav-link i {
    margin-right: 0;
}

.crms-main-wrapper.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed-width) !important;
}

/* Table Filter Bar */
.crms-filter-bar {
    background-color: #ffffff;
    border: 1px solid var(--crms-border);
    border-radius: 0.875rem 0.875rem 0 0;
    padding: 1rem 1.25rem;
    border-bottom: none;
}

.crms-topbar {
    height: var(--topbar-height);
    background: var(--crms-topbar-bg);
    border-bottom: 1px solid var(--crms-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.crms-search-box {
    position: relative;
    width: 280px;
}

.crms-search-input {
    background-color: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.45rem 2.25rem 0.45rem 0.85rem;
    font-size: 0.85rem;
    width: 100%;
    transition: all 0.2s ease;
}

.crms-search-input:focus {
    background-color: #ffffff;
    border-color: var(--crms-red);
    box-shadow: 0 0 0 0.2rem rgba(225, 29, 72, 0.15);
    outline: none;
}

.crms-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.crms-icon-btn:hover {
    color: var(--crms-red);
    background: var(--crms-red-light);
    border-color: var(--crms-red-border);
}

/* ==========================================================================
   3. CRMS CARDS & METRIC WIDGETS
   ========================================================================== */
.crms-card {
    background: var(--crms-card-bg);
    border: 1px solid var(--crms-border);
    border-radius: 0.875rem;
    box-shadow: var(--crms-shadow);
    padding: 1.25rem;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.crms-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.crms-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--crms-text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.crms-card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background-color: var(--crms-red);
    border-radius: 2px;
}

/* Stat Cards */
.crms-stat-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.crms-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: #ffffff;
}

.crms-icon-badge-red { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.crms-icon-badge-blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.crms-icon-badge-purple { background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%); }
.crms-icon-badge-green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }

.crms-pill-success {
    background-color: #dcfce7;
    color: #15803d;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
}

.crms-pill-danger {
    background-color: #ffe4e6;
    color: #be123c;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
}

/* Revenue Red Bar Visualization */
.crms-chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 180px;
    padding-top: 1rem;
}

.crms-bar {
    flex: 1;
    background-color: var(--crms-red);
    border-radius: 4px 4px 0 0;
    transition: height 0.4s ease, opacity 0.2s ease;
}

.crms-bar:hover {
    opacity: 0.85;
}

/* ==========================================================================
   4. CRMS AUTH PAGES (LOGIN / REGISTER)
   ========================================================================== */
.crms-auth-body {
    background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.crms-auth-card {
    background: #ffffff;
    border-radius: 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--crms-border);
    overflow: hidden;
    width: 100%;
    max-width: 440px;
}

.crms-auth-header {
    text-align: center;
    padding: 2.25rem 2rem 1rem;
}

.crms-btn-red {
    background-color: var(--crms-red);
    border-color: var(--crms-red);
    color: #ffffff;
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: 0.625rem;
    transition: all 0.2s ease;
}

.crms-btn-red:hover {
    background-color: var(--crms-red-hover);
    border-color: var(--crms-red-hover);
    color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(225, 29, 72, 0.35);
}

/* Demo Pills */
.demo-pill {
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.65rem;
    border-radius: 9999px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.demo-pill-admin { background-color: #ffe4e6; color: #9f1239; border-color: #fecdd3; }
.demo-pill-admin:hover { background-color: #fecdd3; }

.demo-pill-manager { background-color: #fef3c7; color: #92400e; border-color: #fde68a; }
.demo-pill-manager:hover { background-color: #fde68a; }

.demo-pill-user { background-color: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.demo-pill-user:hover { background-color: #bfdbfe; }

/* Role Badges */
.badge-role {
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35em 0.75em;
    border-radius: 0.375rem;
}

.badge-super_admin { background-color: #8b5cf6; color: #ffffff; }
.badge-admin { background-color: var(--crms-red); color: #ffffff; }
.badge-employee { background-color: var(--crms-blue); color: #ffffff; }

/* DataTables Modern Custom UI Polishing */
.dataTables_wrapper .dataTables_filter input {
    background-color: #f8fafc;
    border: 1px solid var(--crms-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input:focus {
    background-color: #ffffff;
    border-color: var(--crms-red);
    box-shadow: 0 0 0 0.2rem rgba(225, 29, 72, 0.15);
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 0.5rem;
    border: 1px solid var(--crms-border);
    padding: 0.3rem 1.8rem 0.3rem 0.6rem;
    font-size: 0.85rem;
}

.page-item.active .page-link {
    background-color: var(--crms-red) !important;
    border-color: var(--crms-red) !important;
    color: #ffffff !important;
    font-weight: 700;
}

.page-link {
    color: #475569;
    border-radius: 0.375rem;
    margin: 0 2px;
    font-size: 0.85rem;
}

.page-link:hover {
    color: var(--crms-red);
    background-color: var(--crms-red-light);
}

.table thead th {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid var(--crms-border);
}

.table-hover tbody tr:hover {
    background-color: rgba(225, 29, 72, 0.02) !important;
}
