/* ==========================================================================
   Table of Contents
   ==========================================================================
   1. CSS Variables & Root Settings
   2. Base Layout & Typography
   3. Navigation Components
      3.1 Top Navbar
      3.2 Sidebar
      3.3 Dropdowns
   4. Content Layout
   5. Component Styles
      5.1 Cards & Containers
      5.2 Tables
      5.3 Forms & Inputs
      5.4 Modals & Overlays
   6. Theme Variations
      6.1 Light Theme
      6.2 Dark Theme
   7. Utility Classes
   8. Responsive Adjustments
   9. Analytics Dashboard Components
   ========================================================================== */

   
/* 1. CSS Variables & Root Settings
   ========================================================================== */
:root {
    /* Z-index Layers */
    --z-base: 1;
    --z-content: 10;
    --z-sidebar: 900;
    --z-navbar: 1000;
    --z-modal: 1100;
    --z-dropdown: 1200;
    
    /* Layout Measurements */
    --navbar-height: 144px;
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 103px;

    /* Add these critical theme defaults */
    --primary-color: #000000;
    --primary-text: #ffffff;  /* Text color for primary backgrounds */
    --light-bg: #ffffff;
    --light-text: #333333;
    --dark-bg: #1e1e1e;
    --dark-text: #ffffff;
    
    /* Content Area Colors */
    --light-content-bg: #f5f5f5;  /* Light gray for light mode */
    --dark-content-bg: #121212;   /* Darker shade for dark mode */

    /* Theme Colors */
    --surface-color: #ffffff;
    --surface-text: var(--text-on-light);  /* Auto black text on light surface */
    --text-color: #333333;
    --border-color: #e0e0e0;
    --hover-color: #f5f5f5;
    --input-bg: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --success-color: #28a745;
    --danger-color: #dc3545;
    --text-muted: #6c757d;

    /* Base colors */
    --primary-color: #000000;
    --primary-text: #ffffff;  /* Text color for primary backgrounds */
    
    /* Auto-contrast text colors */
    --text-on-light: #000000;  /* Black text for light backgrounds */
    --text-on-dark: #ffffff;   /* White text for dark backgrounds */
    
    /* Theme colors with auto-contrast */
    --surface-color: #ffffff;
    --surface-text: var(--text-on-light);  /* Auto black text on light surface */
    
    /* Update dropdown colors to use contrast system */
    --dropdown-bg: var(--primary-color);
    --dropdown-text: var(--primary-text);
    --dropdown-hover-bg: rgba(255, 255, 255, 0.2);
    --dropdown-hover-text: var(--primary-text);
    --dropdown-active-bg: rgba(255, 255, 255, 0.3);
    --dropdown-active-text: var(--primary-text);

    /* Button and interactive element colors */
    --btn-primary-bg: var(--primary-color);
    --btn-primary-border: var(--primary-color);
    --btn-primary-color: var(--primary-text);
}

/* 2. Base Layout & Typography
   ========================================================================== */
/* Font Imports */
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,400&display=swap');

/* Base Typography */
body {
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--light-bg);
    color: var(--light-text);
}

/* Core Layout */
.app-container {
    position: relative;
    min-height: 100vh;
    padding-top: var(--navbar-height);
    width: 100%;
    overflow-x: hidden;
}

.wrapper {
    display: flex;
    width: 100%;
    position: relative;
}

.content-wrapper {
    position: relative;
    width: 100%;
    min-height: calc(100vh - var(--navbar-height));
    overflow-x: hidden;
    z-index: var(--z-content);
    pointer-events: auto;
}

.content-main {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

#content {
    background-color: var(--light-content-bg);
    color: var(--light-text);
    position: relative;
    z-index: var(--z-content);
    margin-top: 0;
    margin-left: var(--sidebar-width);
    min-height: calc(100vh - var(--navbar-height));
    padding: 2rem;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Typography Scale */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Roboto', sans-serif;
    margin-bottom: 1rem;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

h2 {
    font-size: 2rem;
    font-weight: 500;
    letter-spacing: -0.3px;
}

h3 {
    font-size: 1.75rem;
    font-weight: 500;
}

h4 {
    font-size: 1.5rem;
    font-weight: 500;
}

h5 {
    font-size: 1.25rem;
    font-weight: 500;
}

h6 {
    font-size: 1rem;
    font-weight: 500;
}

/* Text Elements */
p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.text-small {
    font-size: 0.875rem;
}

.text-large {
    font-size: 1.125rem;
}

/* Container Utilities */
.container-fluid {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 1rem;
}

/* Dark Theme Base Adjustments */
body.dark-theme {
    background-color: #000000 !important;
    color: var(--dark-text);
    
    /* Update dark theme variables */
    --surface-color: #2d2d2d;
    --surface-text: var(--text-on-dark);
    --text-color: #ffffff;
    --border-color: #404040;
    --hover-color: #3d3d3d;
    --input-bg: #1e1e1e;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.3);
    --text-muted: #a0a0a0;
    
    /* Add dark theme specific colors */
    --dark-sidebar-bg: #121212;  /* Darker black for sidebar */
    --dark-navbar-bg: #121212;   /* Darker black for navbar */

    /* Update link colors for dark theme */
    --bs-link-color: var(--primary-text);
    --bs-link-hover-color: var(--primary-text);
}

body.dark-theme #wrapper,
body.dark-theme #content {
    background-color: #000000 !important;
    color: var(--dark-text);
}

body.dark-theme main,
body.dark-theme .content-wrapper,
body.dark-theme .content-wrapper.unauthenticated {
    background-color: #000000 !important;
}

body.dark-theme .auth-container {
    background-color: #333333;
}

/* 3. Navigation Components
   ========================================================================== */

/* 3.1 Top Navbar */
body .app-container .top-navbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: var(--navbar-height) !important;
    background-color: #ffffff !important;
    z-index: var(--z-navbar);
    padding: 0 1rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

/* Dark theme navbar override - make more specific */
body.dark-theme .app-container .top-navbar,
body.dark-theme.authenticated .app-container .top-navbar,
body.dark-theme:not(.authenticated) .app-container .top-navbar {
    background-color: var(--primary-color) !important;
    background: var(--primary-color) !important;
    border-bottom: none !important;
}

/* Add this new rule to catch any other potential overrides */
body.dark-theme nav.top-navbar[style*="background-color"] {
    background-color: var(--primary-color) !important;
    background: var(--primary-color) !important;
}

/* Container layout - remove background color */
.top-navbar .container-fluid {
    height: 72px;
    margin: 36px auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
    background: transparent;  /* Remove background color */
}

/* Dark theme container override */
body.dark-theme .top-navbar .container-fluid {
    background: transparent !important;  /* Force transparent background in dark mode */
}

/* Control items in dark mode */
body.dark-theme .nav-controls .control-item .btn-link,
body.dark-theme .nav-controls .control-item .nav-link {
    color: var(--dark-text) !important;  /* Force white text/icons */
}

body.dark-theme .nav-controls .control-item i {
    color: var(--dark-text) !important;  /* Force white icons */
}

/* Theme toggle specific adjustments for dark mode */
body.dark-theme .theme-toggle-wrapper .switch {
    background-color: transparent;
}

body.dark-theme .theme-toggle-wrapper .slider {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Container layout */
.top-navbar .container-fluid {
    height: 72px;
    margin: 36px auto;
    border-radius: 8px;
    display: flex;
    align-items: center;
}

/* Control items */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0;
}

.control-item {
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.logo-container a {
    height: 100%;
    display: flex;
    align-items: center;
}

.logo {
    width: auto;
    max-width: none;
    object-fit: contain;
}

.logo-long {
    height: 69%;
    display: block;
}

.logo-small {
    display: none;
    max-height: 32px;
}

.selector-container {
    position: relative;
    min-width: 180px;
    height: 48px;
    display: flex;
    align-items: center;
}

.selector-container .dropdown {
    height: 100%;
}

.selector-container .dropdown-toggle {
    height: 48px;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 12px;
    color: var(--primary-text);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.selector-container .dropdown-toggle span {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selector-container .dropdown-menu {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--primary-color);
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-dropdown);
}

.selector-container .dropdown-menu.show {
    display: block;
}

.selector-container .dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--primary-text) !important;  /* Force white text */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
    width: 100%;
}

.selector-container .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text) !important;
}

.selector-container .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Ensure the dropdown button doesn't change on click */
.selector-container .dropdown-toggle:active,
.selector-container .dropdown-toggle:focus {
    outline: none;
    box-shadow: none;
}

/* Navbar Dropdowns */
.navbar-right .dropdown-menu {
    background-color: var(--primary-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 200px;
    margin-top: 4px;
    padding: 8px 0;
}

.navbar-right .dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    color: var(--primary-text);
}

.navbar-right .dropdown-menu .dropdown-item i {
    width: 20px;
    text-align: center;
    font-size: 1em;
}

/* 3.2 Sidebar
   ========================================================================== */
#sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 240px;
    z-index: var(--z-sidebar);
    background-color: #ffffff !important;
    color: var(--text-color);
    padding-top: var(--navbar-height);
    transition: width 0.3s ease;
    border-right: 1px solid var(--border-color);
}

/* Add padding to the nav container */
#sidebar .nav {
    padding-top: 32px;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

/* Sidebar Navigation */
#sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 12px;
    white-space: nowrap;
    color: var(--primary-color);
    text-transform: capitalize;
}

#sidebar .nav-link i {
    margin-right: 8px;
    font-size: 1.5em;
    color: var(--primary-color);
}

#sidebar .nav-link span {
    display: block;
    font-weight: 500;
    text-transform: capitalize;
}

#sidebar.collapsed .nav-link span {
    display: none;
}

#sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 0;
    width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed .nav-link i {
    margin-right: 0;
    font-size: 1.5em;
}

/* Hamburger Controller */
#sidebar .sidebar-footer {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    align-items: center;
}

#sidebar .sidebar-footer button {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1.5em;
}

/* 3.3 Dropdowns */
.dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    min-width: 200px;
}

/* Sidebar dropdown styles */
#sidebar .nav-item .dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    margin-top: 0;
    border-radius: 4px;
    padding: 8px 0;
}

#sidebar .nav-item .dropdown-item {
    color: var(--primary-color) !important;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: capitalize;
    font-weight: 500;
    width: 100%;
}

#sidebar .nav-item .dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary-color) !important;
}

#sidebar .nav-item .dropdown-item:hover {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;
}

#sidebar .nav-item .dropdown-item:hover i {
    color: var(--primary-text) !important;
}

/* Dark theme overrides */
body.dark-theme #sidebar .nav-item .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme #sidebar .nav-item .dropdown-item,
body.dark-theme #sidebar .nav-item .dropdown-item i {
    color: var(--primary-text) !important;
}

body.dark-theme #sidebar .nav-item .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Portal and Org Selector styles */
.navbar-center .selector-container .dropdown-menu {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
    background-color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.1);
}

.navbar-center .selector-container .dropdown-item {
    color: var(--primary-text) !important;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-center .selector-container .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dark theme overrides */
body.dark-theme .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .dropdown-item {
    color: var(--dark-text);
}

body.dark-theme .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Ensure dropdowns show properly */
.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* 4. Content Layout
   ========================================================================== */

/* Main Content Area */
.content-area {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--light-bg);
    min-height: calc(100vh - var(--navbar-height));
}

/* Card Layouts */
.card {
    background-color: var(--light-bg);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.25rem;
    background-color: var(--light-bg);
    border-bottom: 1px solid var(--light-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background-color: var(--light-bg);
    border-top: 1px solid var(--light-border);
}

/* Grid Layouts */
.grid-container {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* Dashboard Layout */
.dashboard-container {
    padding: 1.5rem;
    background-color: var(--light-input-bg);
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.metrics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    padding: 1.25rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Chart Layouts */
.chart-container {
    position: relative;
    background-color: var(--light-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    min-height: 400px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-footer {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--light-border);
    font-size: 0.875rem;
}

/* Table Container */
.table-container {
    background-color: var(--light-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

/* Form Layouts */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem;
}

.form-section {
    margin-bottom: 2rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* Dark Theme Content Adjustments */
body.dark-theme .content-area {
    background-color: var(--dark-bg);
}

body.dark-theme .card {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

body.dark-theme .card-header,
body.dark-theme .card-footer {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-border);
}

body.dark-theme .dashboard-container {
    background-color: var(--dark-card-bg);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

body.dark-theme .metric-card {
    background-color: var(--dark-card-bg);
}

body.dark-theme .chart-container,
body.dark-theme .table-container {
    background-color: var(--dark-card-bg);
}

body.dark-theme .chart-footer {
    border-color: var(--dark-border);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .content-area {
        padding: 1rem;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    .metrics-container {
        grid-template-columns: 1fr;
    }

    .form-container {
        padding: 1rem;
    }
}

/* 5. Component Styles
   ========================================================================== */

/* 5.1 Cards & Containers
   ========================================================================== */
.asset-container {
    border: 1px solid var(--light-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.image-preview-container {
    position: relative;
    display: inline-block;
    margin: 5px;
}

.image-preview-container img {
    max-height: 100px;
    width: auto;
    border-radius: 4px;
}

.image-preview-container .delete-asset {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 6px;
    opacity: 0;
    transition: opacity 0.2s;
}

.image-preview-container:hover .delete-asset {
    opacity: 1;
}

.existing-assets {
    min-height: 100px;
    border: 1px dashed var(--border-color);
    padding: 10px;
    border-radius: 4px;
    background-color: var(--light-bg);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.existing-assets:empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.existing-assets:empty::after {
    content: 'No assets uploaded yet';
    color: var(--light-text);
    font-style: italic;
}

/* 5.2 Tables
   ========================================================================== */
.table {
    width: 100%;
    margin-bottom: 1rem;
    background-color: transparent;
    border-collapse: collapse;
    color: var(--text-color);
}

.table th,
.table td {
    padding: 0.75rem;
    vertical-align: middle;
    border-top: 1px solid var(--border-color);
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid var(--border-color);
    background-color: var(--theme-bg);
    font-weight: 500;
}

.table tbody tr:hover {
    background-color: var(--theme-hover);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 5.3 Forms & Inputs
   ========================================================================== */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--light-text);
    background-color: var(--light-bg);
    border: 1px solid var(--light-border);
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-text-rgb), 0.25);
}

/* 5.4 Modals & Overlays
   ========================================================================== */
/* Override Bootstrap's modal backdrop */
.modal-backdrop {
    display: none !important;  /* Completely disable Bootstrap's backdrop */
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-modal);
    display: none;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;  /* Make modal container transparent to clicks */
}

.modal.show {
    display: flex !important;
}

.modal-dialog {
    max-width: 500px;
    width: 90%;
    margin: auto;
    z-index: calc(var(--z-modal) + 1);
    pointer-events: auto;  /* Re-enable pointer events for the dialog */
}

.modal-content {
    position: relative;
    background-color: var(--light-bg);
    border: 1px solid var(--light-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    width: 100%;
}

/* Make sure form elements within modal are interactive */
.modal-content input,
.modal-content button,
.modal-content select,
.modal-content textarea {
    pointer-events: all;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--light-border);
    background-color: var(--light-bg);
    border-radius: 8px 8px 0 0;
}

.modal-body {
    position: relative;
    padding: 1rem;
    max-height: calc(90vh - 130px);
    overflow-y: auto;
    background-color: var(--light-bg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Dark Theme Component Adjustments */
body.dark-theme .asset-container {
    border-color: var(--dark-border);
}

body.dark-theme .existing-assets {
    border-color: var(--dark-border);
    background-color: var(--dark-input-bg);
}

body.dark-theme .existing-assets:empty::after {
    color: var(--dark-text);
}

body.dark-theme .table th,
body.dark-theme .table td {
    border-color: var(--dark-border);
}

body.dark-theme .table thead th {
    background-color: var(--dark-card-bg);
    border-color: var(--dark-border);
}

body.dark-theme .table tbody tr:hover {
    background-color: var(--dark-card-bg);
}

body.dark-theme .form-control {
    color: var(--dark-text);
    background-color: var(--dark-input-bg);
    border-color: var(--dark-border);
}

body.dark-theme .modal-content {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
}

body.dark-theme .modal-header,
body.dark-theme .modal-footer {
    border-color: var(--dark-border);
}

/* 6. Theme Variations
   ========================================================================== */

/* 6.1 Light Theme (Default)
   ========================================================================== */
:root {
    /* Light Theme Colors */
    --theme-bg: var(--light-bg);
    --theme-text: var(--light-text);
    --theme-border: var(--light-border);
    --theme-input-bg: var(--light-input-bg);
    --theme-card-bg: var(--light-bg);
    --theme-hover: rgba(0, 0, 0, 0.05);
}

/* Theme Toggle Styling - Refined */
.theme-toggle-wrapper {
    width: 48px;  /* Reduced from 96px */
    height: 48px;  /* Match other control items */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
}

.switch {
    position: relative;
    width: 44px;  /* Reduced width */
    height: 24px;  /* Reduced height */
    margin: 0;
}

.switch input { 
    display: none; 
}

.slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    cursor: pointer;
    transition: 0.3s;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;  /* Reduced knob size */
    width: 18px;  /* Reduced knob size */
    left: 3px;    /* Adjusted position */
    bottom: 1px;  /* Adjusted position */
    background-color: #ffffff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.switch .fa-sun,
.switch .fa-moon {
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
    color: #ffffff;
    font-size: 12px;  /* Reduced icon size */
}

.switch .fa-moon { 
    left: 6px; 
}

.switch .fa-sun { 
    right: 6px;
}

input:checked + .slider:before {
    transform: translateX(20px);  /* Adjusted translation distance */
}

/* Hover effect */
.theme-toggle-wrapper:hover .slider {
    border-color: rgba(255, 255, 255, 0.3);
    background-color: rgba(0, 0, 0, 0.5);
}

/* Dark theme adjustments */
body.dark-theme .slider {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .slider:before {
    background-color: #ffffff;
}

body.dark-theme .theme-toggle-wrapper:hover .slider {
    border-color: rgba(255, 255, 255, 0.4);
    background-color: rgba(255, 255, 255, 0.3);
}

/* 6.2 Dark Theme
   ========================================================================== */
body.dark-theme {
    --theme-bg: var(--dark-bg);
    --theme-text: var(--dark-text);
    --theme-border: var(--dark-border);
    --theme-input-bg: var(--dark-input-bg);
    --theme-card-bg: var(--dark-card-bg);
    --theme-hover: rgba(255, 255, 255, 0.05);
}

/* Date Controls Dark Theme */
body.dark-theme .date-preset {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
    color: var(--dark-text);
}

body.dark-theme .date-preset:hover {
    background-color: var(--dark-card-bg);
}

body.dark-theme .date-preset.active {
    background: var(--primary-color);
    color: var(--primary-text) !important; /* Force white text in both themes */
    border-color: var(--primary-color);
}

/* Input Elements Dark Theme */
body.dark-theme input::placeholder,
body.dark-theme select::placeholder,
body.dark-theme .form-control::placeholder {
    color: #999999;
}

/* Dropdown Dark Theme */
body.dark-theme .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
}

body.dark-theme .dropdown-item {
    color: var(--dark-text);
}

body.dark-theme .dropdown-item:hover {
    background-color: var(--dark-card-bg);
    color: var(--dark-text);
}

body.dark-theme .dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--primary-text);
}

body.dark-theme .dropdown-item:hover,
body.dark-theme .dropdown-item:focus,
body.dark-theme .dropdown-item.active:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: var(--primary-text);
}

/* Navigation Dark Theme */
body.dark-theme .nav-link:hover {
    background-color: var(--dark-card-bg);
    color: var(--dark-text);
}

/* Filter Controls Dark Theme */
body.dark-theme .filter-select {
    background-color: var(--dark-bg);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

/* Export Button Dark Theme */
body.dark-theme .export-button {
    background-color: var(--dark-bg);
    color: var(--dark-text);
    border-color: var(--dark-border);
}

body.dark-theme .export-button:hover {
    background-color: var(--dark-card-bg);
}

/* 7. Utility Classes
   ========================================================================== */

/* Layout Utilities */
.d-flex {
    display: flex !important;
}

.flex-column {
    flex-direction: column !important;
}

.flex-row {
    flex-direction: row !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-center {
    justify-content: center !important;
}

.align-items-center {
    align-items: center !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.flex-grow-1 {
    flex-grow: 1 !important;
}

/* Spacing Utilities */
.m-0 { margin: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mx-auto { 
    margin-left: auto !important;
    margin-right: auto !important;
}

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

/* Text Utilities */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }
.text-muted { color: var(--text-muted) !important; }
.text-small { font-size: 0.875rem !important; }
.text-large { font-size: 1.25rem !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-normal { font-weight: 400 !important; }

/* Display Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.invisible { visibility: hidden !important; }

/* Position Utilities */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }

/* Width & Height Utilities */
.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }
.min-w-0 { min-width: 0 !important; }
.max-w-100 { max-width: 100% !important; }

/* Border Utilities */
.border { border: 1px solid var(--theme-border) !important; }
.border-0 { border: 0 !important; }
.rounded { border-radius: 4px !important; }
.rounded-circle { border-radius: 50% !important; }

/* Background Utilities */
.bg-transparent { background-color: transparent !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.bg-theme { background-color: var(--theme-bg) !important; }

/* Interaction Utilities */
.pointer { cursor: pointer !important; }
.user-select-none { user-select: none !important; }

/* Gap Utilities */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }

/* Overflow Utilities */
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }
.overflow-scroll { overflow: scroll !important; }

/* 8. Responsive Adjustments
   ========================================================================== */

/* Large Screens (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
    
    .content-wrapper {
        padding: 2rem;
    }
}

/* Medium Screens (992px to 1199px) */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    .metrics-container {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* Small Screens (768px to 991px) */
@media (max-width: 991px) {
    .container {
        max-width: 720px;
    }
    
    #sidebar {
        width: var(--sidebar-collapsed-width);
    }
    
    .content-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }
    
    .logo-container img.logo {
        max-width: 120px;
    }
}

/* Extra Small Screens (576px to 767px) */
@media (max-width: 767px) {
    .container {
        max-width: 540px;
    }
    
    .top-navbar {
        padding: 0 0.5rem;
    }
    
    .nav-controls {
        gap: 0.5rem;
    }
    
    .help-settings-stack,
    .theme-logout-stack {
        margin-left: 0.5rem;
    }
    
    .content-wrapper {
        margin-left: 0;
        padding: 1rem;
    }
    
    #sidebar {
        transform: translateX(-100%);
    }
    
    #sidebar.show {
        transform: translateX(0);
        width: 100%;
    }
    
    .date-controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .org-selector {
        margin-right: 0;
        width: 100%;
    }
}

/* Mobile Screens (575px and down) */
@media (max-width: 575px) {
    .container {
        width: 100%;
        padding-right: 15px;
        padding-left: 15px;
    }
    
    .logo-container img.logo {
        max-width: 100px;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .table-responsive {
        margin: 0 -15px;
        padding: 0 15px;
        width: calc(100% + 30px);
    }
    
    .date-presets {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .content-wrapper {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .table {
        width: 100% !important;
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
}

/* When sidebar is collapsed */
#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed + #content {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
}

/* Add specific display rules for theme modes */
body:not(.dark-theme) .logo.dark-mode,
body.dark-theme .logo.light-mode {
    display: none;
}

body.dark-theme .logo.dark-mode,
body:not(.dark-theme) .logo.light-mode {
    display: block;
}

/* Logo Containers and Sizing */
.logo-container {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
}

.logo-container a {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Logo visibility rules for different screen sizes */

.logo-small {
    display: none;
    max-height: 32px;
}

/* Responsive adjustments for logos */
@media (max-width: 768px) {
    .logo-long {
        height: 32px;
    }
    
    .logo-small {
        display: block;
        max-width: 80px;
    }
}

/* Theme-specific logo display */
body:not(.dark-theme) .logo.dark-mode,
body.dark-theme .logo.light-mode {
    display: none !important;
}

body.dark-theme .logo.dark-mode,
body:not(.dark-theme) .logo.light-mode {
    display: block;
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-left {
        min-width: auto;
    }
    
    .logo-long {
        display: none;
    }
    
    .logo-small {
        display: block;
    }
    
    .navbar-center {
        display: none;
    }
}

/* Theme toggle - more specific selectors */
.navbar-right .control-item .theme-toggle-wrapper {
    height: 40px;
    display: flex;
    align-items: center;
    background: transparent;
}

.navbar-right .control-item .switch {
    position: relative;
    width: 50px;
    height: 26px;
    margin: 0;
    background: transparent;
}

.navbar-right .control-item .slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 34px;
}

/* Debugging - remove after fixing */
.debug { border: 1px solid red; }
.navbar-left.debug { border-color: blue; }
.navbar-center.debug { border-color: green; }
.navbar-right.debug { border-color: yellow; }

/* Target navbar sections specifically */
body .app-container .top-navbar .navbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

body .app-container .top-navbar .nav-controls {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    height: 100% !important;
    background: transparent !important;
}

.logo-square {
    height: 40px;
    max-width: 40px;
    display: none;
    margin-left: -13px;
}

/* Show long logo when sidebar is expanded */
#sidebar:not(.collapsed) .logo-long {
    display: block;
}

/* Show square logo when sidebar is collapsed */
#sidebar.collapsed .logo-square {
    display: block;
}

/* Remove dropdown indicators */
#sidebar .nav-item.dropdown .dropdown-toggle::after {
    display: none;
}

/* Portal and Organization Selectors */
.navbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 8px;
    margin: 0;
    margin-left: auto;
}

.selector-container {
    position: relative;
    height: 48px;
    min-width: 180px;
}

.selector-container .dropdown {
    height: 100%;
}

.selector-container .dropdown-toggle {
    height: 48px;
    width: 100%;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-text);
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: 4px;
    white-space: nowrap;
    justify-content: flex-start;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.selector-container .dropdown-toggle span {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selector-container .dropdown-menu {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--primary-color);
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-dropdown);
}

.selector-container .dropdown-menu.show {
    display: block;
}

.selector-container .dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--primary-text) !important;  /* Force white text */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
    width: 100%;
}

.selector-container .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text) !important;
}

.selector-container .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Ensure buttons and links within control items are properly centered */
.nav-controls .control-item .btn-link,
.nav-controls .control-item .nav-link {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    color: var(--primary-text) !important;
    text-decoration: none;
    background: transparent;
}

/* Ensure icons are centered */
.nav-controls .control-item i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.2rem;
}

/* Adjust dropdown positioning */
.nav-controls .control-item .dropdown {
    height: 100%;
    width: 100%;
}

.nav-controls .control-item .dropdown .nav-link {
    width: 100%;
    height: 100%;
}

/* Filter Modal Styling */
.filter-options {
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.filter-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
}

.filter-option:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.filter-option label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

.filter-option-count {
    color: #666;
    font-size: 0.875rem;
}

.filter-search {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

.filter-search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Dark theme adjustments */
body.dark-theme .filter-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .filter-option-count {
    color: #999;
}

body.dark-theme .filter-search {
    border-bottom-color: #333;
}

body.dark-theme .filter-search-input {
    background-color: #333;
    border-color: #444;
    color: #fff;
}

/* Analytics Dashboard Components
   ========================================================================== */

/* Analytics Container */
.analytics-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
}

/* Bento Box */
.bento-box {
    background: var(--surface-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Date Controls */
.date-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-color);
}

.date-presets {
    display: flex;
    gap: 0.5rem;
}

.date-preset {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    cursor: pointer;
    color: var(--text-color);
}

.date-preset:hover {
    background: var(--hover-color);
}

.date-preset.active {
    background: var(--primary-color);
    color: var(--primary-text) !important; /* Force white text in both themes */
    border-color: var(--primary-color);
}

/* Remove the dark theme override since we want white text in both themes */
body.dark-theme .date-preset.active {
    color: var(--primary-text) !important;  /* Keep white text in dark mode too */
}

/* Hover state for active preset */
.date-preset.active:hover {
    opacity: 0.9;
    color: var(--primary-text) !important;
}

/* Metrics Cards */
.metrics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    padding: 1.25rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Filter Controls */
.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-pill {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
}

.filter-pill:hover {
    background: var(--hover-color);
}

.filter-tag {
    background: var(--hover-color);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.25rem;
}

.filter-tag .remove {
    cursor: pointer;
    opacity: 0.7;
}

.filter-tag .remove:hover {
    opacity: 1;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--surface-color);
    color: var(--text-color);
    padding: 1.5rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.7;
    padding: 0;
}

.close-modal:hover {
    opacity: 1;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.apply-filters {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: var(--primary-text);
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.apply-filters:hover {
    opacity: 0.9;
}

/* Filter Options within Modal */
.filter-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.filter-search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
}

.filter-options {
    max-height: 400px;
    overflow-y: auto;
}

.filter-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-color);
}

.filter-option:hover {
    background: var(--hover-color);
}

.filter-option-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-option input[type="checkbox"] {
    margin: 0;
}

.filter-option-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Chart Layouts */
.charts-container {
    display: flex;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.chart-box {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.chart-box-large {
    flex: 2;
}

.chart-box-small {
    flex: 1;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-controls select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
}

/* Add these styles to the existing CSS file */

.bento-grid {
    display: grid;
    gap: 2rem;  /* Increased spacing between grid items */
    padding: 2rem;  /* Added padding around the entire grid */
}

.kpi-section {
    padding: 2rem;
    margin: 0;
}

.kpi-container {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.kpi-card {
    flex: 1;
    text-align: center;
    min-width: 300px;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kpi-card h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Adjust gauge size */
#gauge1, #gauge2 {
    width: 100%;
    height: 300px;
    margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .kpi-container {
        flex-direction: column;
        align-items: center;
        gap: 3rem;
    }

    .kpi-card {
        width: 100%;
        max-width: 350px;
    }
    
    #gauge1, #gauge2 {
        height: 350px;
    }
}

/* Authentication Pages
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: #ffffff;
}

body.dark-theme .auth-wrapper {
    background-color: #000000 !important;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    background: #ffffff;
    border-radius: 12px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    margin-top: -10vh;
}

body.dark-theme .auth-container {
    background: #333333;
}

.auth-logo-container {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center; /* Center the logo */
}

.auth-logo {
    max-width: 180px; /* Slightly smaller logo */
    height: auto;
    margin: 0 auto; /* Ensure center alignment */
}

/* Show/hide logos based on theme */
.light-theme-logo {
    display: block;
}

.dark-theme-logo {
    display: none;
}

body.dark-theme .light-theme-logo {
    display: none;
}

body.dark-theme .dark-theme-logo {
    display: block;
}

.auth-form {
    width: 100%;
}

.auth-input-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.auth-input-container {
    margin-bottom: 1.5rem;
    width: 100%;
}

.auth-input-container.half-width {
    width: calc(50% - 0.5rem);
}

.auth-input-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.auth-input-field input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: var(--text-color);
    font-size: 1rem;
}

.auth-input-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

.auth-buttons-container {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.auth-button {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.auth-button.primary {
    background-color: #000000;
    color: #ffffff !important;  /* Force white text on black background */
    border: 1px solid #000000;
}

.auth-button.secondary {
    background-color: transparent;
    color: #000000;
    border: 1px solid #000000;
}

.auth-button:hover {
    opacity: 0.9;
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
}

.auth-links a {
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

/* Light mode specific */
body:not(.dark-theme) .auth-links a {
    color: var(--primary-color);
}

/* Dark mode specific */
body.dark-theme .auth-links a {
    color: var(--primary-color);
}

.auth-links a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.auth-message {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.errorlist {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    list-style: none;
    padding: 0;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .auth-container {
        padding: 1.5rem;
    }

    .auth-input-row {
        flex-direction: column;
        gap: 0;
    }

    .auth-input-container.half-width {
        width: 100%;
    }

    .auth-buttons-container {
        flex-direction: column;
    }
}

/* Add specific light mode link color */
body:not(.dark-theme) .auth-links a {
    color: var(--primary-color);
    opacity: 0.85;
}

body:not(.dark-theme) .auth-links a:hover {
    opacity: 1;
}

/* Add specific dark mode link color */
body.dark-theme .auth-links a {
    color: var(--primary-text);
    opacity: 0.9;
}

body.dark-theme .auth-links a:hover {
    opacity: 1;
}

/* Update the settings dropdown positioning */
.nav-controls .control-item .dropdown .dropdown-menu {
    right: auto;  /* Remove right alignment */
    left: 50%;    /* Center align with the button */
    transform: translateX(-50%);  /* Center the dropdown */
    margin-top: 4px;
}

/* Keep portal and org dropdowns right-aligned */
.navbar-center .selector-container .dropdown-menu {
    right: 0;
    left: auto;
    transform: none;
}

/* Prevent settings dropdown from going off-screen on mobile */
@media (max-width: 768px) {
    .nav-controls .control-item .dropdown .dropdown-menu {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* Standardize heights and alignment for all navbar elements */
.nav-controls,
.selector-container,
.control-item {
    height: 48px;  /* Set consistent height */
}

/* Ensure dropdown toggles are properly aligned */
.selector-container .dropdown-toggle,
.nav-controls .control-item .btn-link,
.nav-controls .control-item .nav-link {
    height: 48px;
    display: flex;
    align-items: center;
}

/* Adjust navbar center alignment */
.navbar-center {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    padding: 0 8px;
    margin: 0;
    margin-left: auto;
}

/* Ensure consistent vertical alignment */
.navbar-left,
.navbar-center,
.navbar-right {
    height: 100%;
    display: flex;
    align-items: center;
}

/* Update in the Dark Theme Base Adjustments section */
body.dark-theme {
    background-color: #000000 !important;
    color: var(--dark-text);
    
    /* Update dark theme variables */
    --surface-color: #2d2d2d;
    --surface-text: var(--text-on-dark);
    --text-color: #ffffff;
    --border-color: #404040;
    --hover-color: #3d3d3d;
    --input-bg: #1e1e1e;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.3);
    --text-muted: #a0a0a0;
    
    /* Add dark theme specific colors */
    --dark-sidebar-bg: #121212;  /* Darker black for sidebar */
    --dark-navbar-bg: #121212;   /* Darker black for navbar */
}

/* Update in the Top Navbar section */
body.dark-theme .top-navbar {
    background-color: var(--primary-color) !important;
}

body.dark-theme .top-navbar .container-fluid {
    background: transparent;  /* Remove background color in dark mode */
}

/* Update in the Sidebar section */
body.dark-theme #sidebar {
    background-color: var(--primary-color) !important;
    color: var(--primary-text);
    border-right: none;
}

body.dark-theme #sidebar .nav-link {
    color: var(--primary-text);
}

body.dark-theme #sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme #sidebar .sidebar-footer button {
    color: var(--primary-text);
}

/* Update dropdown styles for dark theme */
body.dark-theme .dropdown-menu {
    background-color: var(--dark-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .dropdown-item {
    color: var(--primary-text);
}

body.dark-theme .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
}

/* Update selector containers in dark mode */
body.dark-theme .selector-container .dropdown-toggle {
    color: var(--primary-text);
}

body.dark-theme .selector-container .dropdown-toggle i {
    color: var(--primary-text);
}

body.dark-theme .selector-container .dropdown-toggle span {
    color: var(--primary-text);
}

/* Update the container background in dark mode */
body.dark-theme .top-navbar .container-fluid {
    background: transparent;  /* Remove background color in dark mode */
}

/* Update dropdown styles for dark theme - make settings dropdown text visible */
body.dark-theme .nav-controls .dropdown-menu .dropdown-item {
    color: var(--primary-text);  /* Force white text in dark mode */
}

body.dark-theme .nav-controls .dropdown-menu .dropdown-item i {
    color: var(--primary-text);  /* Force white icons in dark mode */
}

body.dark-theme .nav-controls .dropdown-menu .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
}

/* Update light mode text colors for navbar */
.nav-controls .control-item .btn-link,
.nav-controls .control-item .nav-link,
.nav-controls .control-item i {
    color: var(--primary-color) !important;
}

/* Update light mode text colors for sidebar */
#sidebar .nav-link {
    color: var(--primary-color);
}

#sidebar .nav-link i {
    color: var(--primary-color);
}

#sidebar .sidebar-footer button {
    color: var(--primary-color);
}

/* Update selector containers in light mode */
.selector-container .dropdown-toggle {
    color: var(--primary-color);
}

.selector-container .dropdown-toggle i {
    color: var(--primary-color);
}

.selector-container .dropdown-toggle span {
    color: var(--primary-color);
}

/* Keep dark mode using primary-text color */
body.dark-theme .nav-controls .control-item .btn-link,
body.dark-theme .nav-controls .control-item .nav-link,
body.dark-theme .nav-controls .control-item i,
body.dark-theme #sidebar .nav-link,
body.dark-theme #sidebar .nav-link i,
body.dark-theme #sidebar .sidebar-footer button,
body.dark-theme .selector-container .dropdown-toggle,
body.dark-theme .selector-container .dropdown-toggle i,
body.dark-theme .selector-container .dropdown-toggle span {
    color: var(--primary-text) !important;
}

/* Dark theme table adjustments */
body.dark-theme .table {
    color: var(--dark-text);
    --bs-table-hover-color: var(--dark-text) !important;
}

body.dark-theme .table th,
body.dark-theme .table td {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .table thead th {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Make the hover styles more specific */
body.dark-theme .table tbody tr:hover,
body.dark-theme .table-hover tbody tr:hover,
body.dark-theme table.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--dark-text) !important;
}

/* Add this to override Bootstrap's hover variable */
body.dark-theme .table {
    --bs-table-hover-color: var(--dark-text);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.05);
}

/* Card styles update for dark mode */
body.dark-theme .card {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Form control dark mode updates */
body.dark-theme .form-control,
body.dark-theme .form-select {
    background-color: var(--dark-input-bg);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--dark-text);
}

body.dark-theme .form-control:focus,
body.dark-theme .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(98, 0, 238, 0.25);
}

/* Media Asset Form Styles */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.05);
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-prompt i {
    font-size: 2rem;
    color: var(--text-muted);
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.img-preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

.hero-grid, .video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.hero-item, .video-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.hero-item img, .video-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-asset {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
}

.character-counter {
    position: absolute;
    right: 0.5rem;
    bottom: -1.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.text-asset {
    padding-right: 3rem;
}

/* Dark theme adjustments */
body.dark-theme .upload-area {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .upload-area:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Ad Preview Base Styles */
.preview-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: white;
}

.ad-preview {
    min-height: 300px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* Google Search Ad */
.search-ad-content {
    font-family: Arial, sans-serif;
    max-width: 600px;
    padding: 1rem;
}

.search-ad-content .url {
    color: #006621;
    font-size: 14px;
    margin-bottom: 4px;
}

.search-ad-content .headline {
    color: #1a0dab;
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 4px;
    font-weight: normal;
}

.search-ad-content .description {
    color: #545454;
    font-size: 14px;
    line-height: 1.4;
}

/* Google Display Ad */
.display-ad-content {
    max-width: 300px;
    margin: 0 auto;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
}

/* Facebook Common Styles */
.fb-ad-content {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto;
    max-width: 500px;
    margin: 0 auto;
    background: white;
    border: 1px solid #dddfe2;
    border-radius: 8px;
}

.fb-ad-content .header {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #dddfe2;
}

.fb-ad-content .logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 8px;
}

.fb-ad-content .brand-name {
    font-weight: 600;
    color: #385898;
}

.fb-ad-content .text-content {
    padding: 12px;
}

.fb-ad-content .headline {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 4px;
    color: #1c1e21;
}

.fb-ad-content .description {
    font-size: 14px;
    color: #606770;
    line-height: 1.34;
}

/* Story Ad Specific */
.facebook-ad .hero-container.vertical {
    max-width: 300px;
    margin: 0 auto;
}

/* Dark theme adjustments */
body.dark-theme .preview-container {
    background: var(--dark-bg);
}

body.dark-theme .search-ad-content .url {
    color: #969ba1;
}

body.dark-theme .search-ad-content .headline {
    color: #8ab4f8;
}

body.dark-theme .search-ad-content .description {
    color: #bdc1c6;
}

/* Ad Preview Base Styles */
.preview-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: white;
}

.ad-preview {
    min-height: 300px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

/* Google Search Ad */
.search-ad-content {
    font-family: Arial, sans-serif;
    max-width: 600px;
    padding: 1rem;
}

/* Google Display Ad */
.display-ad-content .logo {
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
}

/* Facebook Common Styles */
.fb-ad-content .logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Hero containers for ad previews */
.ad-preview .hero-container {
    width: 100%;
    overflow: hidden;
    margin-bottom: 1rem;
}

.ad-preview .hero-container.landscape {
    aspect-ratio: 1.91/1;
}

.ad-preview .hero-container.vertical {
    aspect-ratio: 9/16;
}

.ad-preview .hero-container.square {
    aspect-ratio: 1/1;
}

.ad-preview .hero {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Rest of the ad preview styles... */

/* Buttons */
.btn-primary,
.save-creative-btn {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-text) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.save-creative-btn:hover {
    opacity: 0.9 !important;
}

/* Links and Icons */
a:not(.btn):not(.nav-link):not(.dropdown-item) {
    color: var(--primary-color);
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--primary-color);
    opacity: 0.9;
}

/* Form Elements */
.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-color-rgb), 0.25) !important;
}

.form-check-input:checked {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

/* Tabs */
.nav-tabs .nav-link {
    color: var(--text-color);
    border-bottom: 2px solid transparent;
}

.nav-tabs .nav-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color) !important;
    background: transparent;
}

/* Progress bars */
.progress-bar {
    background-color: var(--primary-color) !important;
}

/* Badges */
.badge.bg-primary {
    background-color: var(--primary-color) !important;
    color: var(--primary-text) !important;
}

/* Dark theme specific adjustments */
body.dark-theme .nav-tabs .nav-link.active {
    color: var(--primary-text) !important;
    border-color: var(--primary-text) !important;
}

/* Asset action buttons */
.actions-cell {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Individual action buttons */
.action-btn {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: var(--primary-color) !important;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
}

.action-btn:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    transform: scale(1.1);
}

/* Specific action icons */
.action-btn i {
    font-size: 1rem;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dark theme adjustments */
body.dark-theme .action-btn {
    color: var(--primary-text) !important;
}

body.dark-theme .action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Update table link styles to be more specific and override Bootstrap */
.table a,
.table .text-primary,
table.dataTable a {
    color: var(--primary-color) !important;
    text-decoration: none;
}

.table a:hover,
.table .text-primary:hover,
table.dataTable a:hover {
    color: var(--primary-hover-color) !important;
    text-decoration: underline;
}

/* Dark theme adjustments */
body.dark-theme .table a,
body.dark-theme .table .text-primary,
body.dark-theme table.dataTable a {
    color: var(--primary-text) !important;
}

body.dark-theme .table a:hover,
body.dark-theme .table .text-primary:hover,
body.dark-theme table.dataTable a:hover {
    color: var(--primary-text) !important;
    opacity: 0.9;
}

/* Add styles for inverted logo containers */
.upload-area[data-type="long_logo_invert"],
.upload-area[data-type="square_logo_invert"] {
    background-color: #1a1a1a; /* Dark background for inverted logos */
}

/* Adjust the upload prompt text color for inverted logo areas */
.upload-area[data-type="long_logo_invert"] .upload-prompt,
.upload-area[data-type="square_logo_invert"] .upload-prompt {
    color: #ffffff;
}

.upload-area[data-type="long_logo_invert"] .upload-prompt i,
.upload-area[data-type="square_logo_invert"] .upload-prompt i {
    color: #ffffff;
}

/* Dark theme adjustments */
body.dark-theme .upload-area[data-type="long_logo_invert"],
body.dark-theme .upload-area[data-type="square_logo_invert"] {
    background-color: #000000;
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .upload-area[data-type="long_logo_invert"]:hover,
body.dark-theme .upload-area[data-type="square_logo_invert"]:hover {
    border-color: var(--primary-color);
    background-color: #000000;
}

/* Button styles with proper contrast */
.btn-primary,
.btn.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-text) !important; /* Force white text */
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn.btn-primary:hover,
.btn.btn-primary:focus,
.btn.btn-primary:active {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-text) !important; /* Keep white text on hover */
    opacity: 0.9;
}

/* Handle small buttons too */
.btn-sm.btn-primary {
    color: var(--primary-text) !important;
}

.btn-sm.btn-primary:hover,
.btn-sm.btn-primary:focus,
.btn-sm.btn-primary:active {
    color: var(--primary-text) !important;
}

/* Dropdown menu styles */
.dropdown-menu .dropdown-item {
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu .dropdown-item i {
    color: var(--primary-color) !important;
    width: 1.25em;
    text-align: center;
}

/* Hover state */
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;  /* White text on hover */
}

.dropdown-menu .dropdown-item:hover i,
.dropdown-menu .dropdown-item:focus i {
    color: var(--primary-text) !important;  /* White icon on hover */
}

/* Active state */
.dropdown-menu .dropdown-item.active,
.dropdown-menu .dropdown-item:active {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;
}

.dropdown-menu .dropdown-item.active i,
.dropdown-menu .dropdown-item:active i {
    color: var(--primary-text) !important;
}

/* Dropdown menu styles - Light Mode */
.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-menu .dropdown-item {
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-menu .dropdown-item i {
    color: rgba(var(--primary-color-rgb), 0.7) !important; /* Slightly dimmed icon for contrast */
    width: 1.25em;
    text-align: center;
}

/* Hover state - Light Mode */
.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;
}

.dropdown-menu .dropdown-item:hover i,
.dropdown-menu .dropdown-item:focus i {
    color: var(--primary-text) !important;
    opacity: 0.9; /* Slightly dimmed icon on hover */
}

/* Dark Mode Adjustments */
body.dark-theme .dropdown-menu {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .dropdown-menu .dropdown-item {
    color: var(--primary-text) !important;
}

body.dark-theme .dropdown-menu .dropdown-item i {
    color: rgba(255, 255, 255, 0.7) !important; /* Dimmed icon in dark mode */
}

/* Hover state - Dark Mode */
body.dark-theme .dropdown-menu .dropdown-item:hover,
body.dark-theme .dropdown-menu .dropdown-item:focus {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;
}

body.dark-theme .dropdown-menu .dropdown-item:hover i,
body.dark-theme .dropdown-menu .dropdown-item:focus i {
    color: var(--primary-text) !important;
    opacity: 0.9;
}

/* Dropdown menu styles - Light Mode */
.dropdown-menu {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Ensure nested dropdowns (submenu) also have white background in light mode */
.dropdown-menu .submenu.dropdown-menu,
.navbar-right .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Settings dropdown specific styles */
.navbar-right .dropdown-menu .dropdown-item {
    color: var(--primary-color) !important;
}

.navbar-right .dropdown-menu .dropdown-item i {
    color: rgba(var(--primary-color-rgb), 0.7) !important;
}

/* Dark theme modal styles for analytics dashboard */
body.dark-theme #filterModal .modal-content {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
}

body.dark-theme #filterModal .modal-header {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
}

body.dark-theme #filterModal .modal-body {
    background-color: var(--dark-bg);
}

body.dark-theme #filterModal .modal-footer {
    background-color: var(--dark-bg);
    border-color: var(--dark-border);
}

body.dark-theme #filterModal .close-modal {
    color: var(--dark-text);
}

/* Add these styles for the metric comparisons */
.metric-comparison {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
}

.metric-comparison .value {
    font-weight: 500;
}

.metric-comparison .value.positive {
    color: #28a745;
}

.metric-comparison .value.negative {
    color: #dc3545;
}

.metric-comparison .arrow {
    font-size: 1rem;
}

/* Update metric card styles */
.metric-card {
    padding: 1.25rem;
    background-color: var(--light-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.metric-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.metric-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
}

/* Dark theme adjustments */
body.dark-theme .metric-card {
    background-color: var(--dark-bg);
}

/* Active Filters Tags */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background-color: var(--hover-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-tag .remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 1.2em;
    line-height: 1;
}

.filter-tag .remove:hover {
    opacity: 1;
}

/* Dark theme adjustments */
body.dark-theme .filter-tag {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Filter Options Styling */
.filter-options-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
}

.filter-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
}

.filter-option:hover {
    background-color: var(--hover-color);
}

.filter-option-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-option-count {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.error {
    text-align: center;
    padding: 2rem;
    color: var(--danger-color);
}

/* Dark theme adjustments */
body.dark-theme .filter-option:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Find and update the selector container styles */

/* Portal and Org Selector specific styles */
.navbar-center .selector-container .dropdown-menu {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--primary-color);
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--z-dropdown);
}

.navbar-center .selector-container .dropdown-menu.show {
    display: block;
}

.navbar-center .selector-container .dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--primary-text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
    width: 100%;
}

.navbar-center .selector-container .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text) !important;
}

.navbar-center .selector-container .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Keep the original dropdown styles for sidebar navigation */
#sidebar .dropdown-menu {
    /* Original dropdown menu styles */
    min-width: 200px;
}

#sidebar .dropdown-item {
    /* Original dropdown item styles */
    color: var(--text-color);
}

/* Add these styles */
.content-wrapper.full-width {
    margin-left: 0;
    width: 100%;
}

/* Style for limited navigation state */
.limited-nav .navbar-center,
.limited-nav .sidebar {
    display: none;
}

.limited-nav .content-wrapper {
    margin-left: 0;
    width: 100%;
}

/* Dark mode overrides */
body.dark-theme .auth-button.primary {
    background-color: #ffffff;
    color: #000000 !important;  /* Force black text on white background */
    border: 1px solid #ffffff;
}

body.dark-theme .auth-button.secondary {
    background-color: transparent;
    color: #ffffff !important;  /* Force white text */
    border: 1px solid #ffffff;
}

body.dark-theme .auth-message h2 {
    color: #ffffff;
}

body.dark-theme .auth-message p {
    color: #999999;
}

body.dark-theme .auth-container {
    background-color: #333333;
}

/* Sidebar Dropdown Styles */
#sidebar .dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    margin-top: 0;
    border-radius: 4px;
}

#sidebar .dropdown-item {
    color: var(--primary-color) !important;  /* Force consistent color in light mode */
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: capitalize;
}

#sidebar .dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary-color) !important;  /* Force consistent icon color */
}

#sidebar .dropdown-item:hover {
    background-color: var(--primary-color);
    color: var(--primary-text) !important;
}

#sidebar .dropdown-item:hover i {
    color: var(--primary-text) !important;
}

/* Dark theme overrides - keep these unchanged */
body.dark-theme #sidebar .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme #sidebar .dropdown-item,
body.dark-theme #sidebar .dropdown-item i {
    color: var(--primary-text) !important;
}

body.dark-theme #sidebar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Portal and Org Selector Styles */
.navbar-center .selector-container {
    position: relative;
}

.navbar-center .selector-container .dropdown-menu {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 4px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--primary-color);
}

.navbar-center .selector-container .dropdown-item {
    padding: 0.75rem 1rem;
    color: var(--primary-text) !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s ease;
}

.navbar-center .selector-container .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text) !important;
}

.navbar-center .selector-container .dropdown-item i {
    width: 20px;
    text-align: center;
}

/* Add these to ensure dropdowns show properly */
.dropdown-menu.show {
    display: block;
}

/* Dark theme overrides */
body.dark-theme .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .dropdown-item {
    color: var(--dark-text);
}

body.dark-theme .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Dropdown base styles */
.dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* Navigation dropdown specific styles */
#sidebar .dropdown-menu {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    margin-top: 0;
}

#sidebar .dropdown-item {
    color: var(--primary-text);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#sidebar .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Portal and Org Selector styles */
.navbar-center .selector-container .dropdown-menu {
    background-color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-text);
}

.navbar-center .selector-container .dropdown-item {
    color: var(--primary-text) !important;
}

/* Dark theme overrides */
body.dark-theme .dropdown-menu {
    background-color: var(--dark-bg);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .dropdown-item {
    color: var(--dark-text);
}

body.dark-theme .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Ensure dropdowns show properly */
.dropdown-menu.show {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Update in the Dropdowns section */

/* Settings dropdown in navbar */
.nav-controls .nav-item.dropdown .dropdown-menu {
    background-color: var(--dark-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 8px 0;
    min-width: 200px;
    margin-top: 4px;
}

.nav-controls .nav-item.dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-text);
    font-weight: 500;
}

.nav-controls .nav-item.dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
    color: var(--primary-text);
}

.nav-controls .nav-item.dropdown .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Light theme overrides for settings dropdown */
body:not(.dark-theme) .nav-controls .nav-item.dropdown .dropdown-menu {
    background-color: var(--surface-color);
    border-color: var(--border-color);
}

body:not(.dark-theme) .nav-controls .nav-item.dropdown .dropdown-item,
body:not(.dark-theme) .nav-controls .nav-item.dropdown .dropdown-item i {
    color: var(--primary-color);
}

body:not(.dark-theme) .nav-controls .nav-item.dropdown .dropdown-item:hover {
    background-color: var(--primary-color);
    color: var(--primary-text);
}

body:not(.dark-theme) .nav-controls .nav-item.dropdown .dropdown-item:hover i {
    color: var(--primary-text);
}