/* --- Modern SaaS Design System v1.1 --- */

/* 
    IMPORTANT: 
    The following CSS variables are expected to be defined dynamically 
    in a <style> tag in your main PHP layout file (e.g., header.php or index.php)
    based on the admin's settings:
    --primary: (e.g., #ff0000 - the main brand color)
    --primary-dark: (e.g., #cc0000 - a darker shade for hover states)
    --primary-text: (e.g., #ffffff - text color for primary buttons, typically white)
*/

:root {
    /* Default Fallback Colors (Bootstrap's default primary) */
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --primary-text: #ffffff; 

    --secondary: #6c757d;
    --light: #f8f9fa;
    --dark: #212529;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #0dcaf0;

    --background: #eef2f7; /* Light gray background for the entire page */
    
    /* Sidebar Specific Colors */
    --sidebar-bg: #ffffff;
    --sidebar-text: #344767; /* Darker text for better readability on white */
    --sidebar-icon-bg: #e9ecef; /* Light background for icons */
    --sidebar-icon-color: var(--sidebar-text);
    --sidebar-active-bg: linear-gradient(195deg, #42424a 0%, #191919 100%); /* Dark gradient for active menu */
    --sidebar-active-text: #ffffff;
    --sidebar-active-icon-color: #ffffff;

    /* General Component Styling */
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.04); /* Softer shadow */
    --bs-border-radius: .375rem;
    --bs-border-radius-lg: .5rem;
}

body {
    background-color: var(--background);
    color: var(--dark);
    font-family: "Helvetica Neue", Arial, sans-serif; /* Standard, widely available font */
}

/* --- Login & Installer Page --- */
.auth-page {
    background-color: var(--background);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--bs-border-radius-lg);
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.175); /* More prominent shadow */
    width: 100%;
    max-width: 450px;
    border-top: 4px solid var(--primary); /* Uses the dynamic primary color */
}

/* --- Main App Layout (Sidebar & Content) --- */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
    box-shadow: var(--card-shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    margin-left: -260px;
}

#sidebar .sidebar-header {
    padding: 24px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
}

#sidebar .sidebar-header h3 {
    font-size: 1.4rem; /* Slightly smaller for better fit */
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
}
#sidebar .sidebar-header h3 img {
    max-height: 30px; /* Adjust logo size in sidebar */
    margin-right: 10px;
}


#sidebar ul.components {
    padding: 1rem;
    flex-grow: 1; /* Allows menu to fill space */
}

#sidebar ul li a {
    padding: 0.75rem 1rem; /* Slightly adjusted padding */
    font-size: 0.9rem;    /* Slightly adjusted font size */
    font-weight: 500;
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    border-radius: var(--bs-border-radius);
    margin-bottom: 0.25rem;
}

#sidebar ul li a i {
    color: var(--sidebar-icon-color);
    margin-right: 1rem;
    font-size: 1.1rem; /* Slightly adjusted icon size */
    width: 30px;       /* Adjusted icon wrapper size */
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-icon-bg);
    border-radius: var(--bs-border-radius);
    transition: all 0.2s;
}

#sidebar ul li a:hover {
    background: rgba(0,0,0,0.04); /* Subtle hover */
    color: var(--primary); /* Use primary color on hover for text */
}
#sidebar ul li a:hover i {
    background: var(--primary);
    color: var(--primary-text); /* Typically white */
}


#sidebar ul li.active > a, 
#sidebar ul li a[aria-expanded="true"] { /* For dropdowns if any */
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    box-shadow: 0 4px 12px -2px rgba(0,0,0,0.15), 0 3px 8px -3px rgba(0,0,0,0.1);
}

#sidebar ul li.active > a i {
    background: transparent;
    color: var(--sidebar-active-icon-color);
}

#sidebar .CTAs { /* For bottom buttons like logout */
    padding: 1rem;
    border-top: 1px solid #dee2e6;
}


#content {
    width: 100%;
    padding: 24px;
    min-height: 100vh;
    transition: all 0.3s;
}

/* --- Component Styles --- */
.card {
    border: none;
    border-radius: var(--bs-border-radius-lg); /* Larger radius for cards */
    box-shadow: var(--card-shadow);
    background-color: #fff;
    margin-bottom: 1.5rem; /* Default card margin */
}
.card-header {
    background-color: transparent;
    border-bottom: 1px solid #f0f0f0; /* Lighter border */
    padding: 1.25rem 1.5rem;
    font-size: 1.05rem; /* Slightly smaller card header */
    font-weight: 600;
}

.stat-card { /* Used in dashboards */
    border-radius: var(--bs-border-radius-lg);
    color: white;
    padding: 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}
.stat-card:hover {
    transform: translateY(-5px);
}
.stat-card .stat-icon {
    font-size: 4rem; /* Slightly smaller */
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.15; /* Less intrusive */
    transition: all 0.3s;
}
.stat-card:hover .stat-icon {
    opacity: 0.25;
    transform: translateY(-50%) scale(1.05);
}
.stat-card .stat-number {
    font-size: 2.25rem;
    font-weight: 700;
}
.stat-card .stat-text {
    font-size: 1rem;
    font-weight: 500;
}

.btn {
    font-weight: 500; /* Slightly less bold */
    padding: 0.6rem 1.2rem;
    border-radius: var(--bs-border-radius);
    transition: all 0.2s ease-in-out;
}

.btn-primary { /* This will now use the :root --bs-primary if defined */
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
}
.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--primary-text);
}

/* Custom Primary Button for specific overrides if needed */
.btn-custom-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: var(--primary-text) !important;
}
.btn-custom-primary:hover,
.btn-custom-primary:focus,
.btn-custom-primary:active {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    color: var(--primary-text) !important;
}


.form-control, .form-select {
    padding: 0.6rem 1rem;
    border-radius: var(--bs-border-radius);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25); /* Use bs-primary-rgb if defined */
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    #sidebar { margin-left: -260px; position: fixed; height: 100%; }
    #sidebar.active { margin-left: 0; }
    #content { padding: 15px; }
    #sidebarCollapse { display: inline-block; /* Changed to inline-block for better alignment */ }
}
@media (min-width: 769px) {
    #sidebarCollapse { display: none; }
}