/* Modernized Blesta Client CSS */

/* Smooth Theme Transition */
body,
body *,
.card-blesta,
.list-group-item,
.navbar,
.btn {
    transition: background-color 0.4s ease,
                color 0.4s ease,
                border-color 0.4s ease,
                box-shadow 0.4s ease !important;
}


/* 1. Base Styles & Smoothness */
body {
    background-color: theme_page_background_color;
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

a {
    color: theme_link_color;
    transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
    text-decoration: none;
}

a:hover {
    color: theme_link_color;
    filter: brightness(85%);
}

/* 2. Unified Gradients (Headers, Titles, Nav) */
.header,
.title,
.nav-content nav.navbar,
.card-blesta > .card-header {
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header {
    background: linear-gradient(180deg, theme_header_bg_color_top, theme_header_bg_color_bottom);
}

.title {
    background: linear-gradient(180deg, theme_page_title_background_color_top, theme_page_title_background_color_bottom);
    padding: 1.5rem 1rem;
}

.title h3 {
    color: theme_page_title_text_color;
    margin: 0;
    font-weight: 600;
}

/* 3. Navigation Modernization */
.nav-content nav.navbar {
    background: linear-gradient(180deg, theme_navigation_background_color_top, theme_navigation_background_color_bottom);
    padding: 0.75rem 1rem;
}

.nav-content nav.navbar .navbar-nav > li > a {
    color: theme_navigation_text_color !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.nav-content nav.navbar .navbar-nav > .active > a,
.nav-content nav.navbar .navbar-nav > li > a:hover,
.nav-content nav.navbar .navbar-nav > .open > a {
    color: theme_navigation_text_active_color !important;
    background: rgba(255, 255, 255, 0.1); /* Subtle highlight */
    border-radius: 4px;
}

/* 4. Cards & Lists */
.card-blesta {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.card-blesta > .card-header {
    color: theme_panel_header_text_color;
    background: linear-gradient(180deg, theme_panel_header_background_color_top, theme_panel_header_background_color_bottom);
    font-weight: 600;
    border-bottom: 0;
}

.list-group-item {
    transition: all 0.2s ease;
}

.list-group-item:hover,
.table-hover > tbody > tr:hover {
    background-color: theme_highlight_hover_color !important;
}

/* 5. Pagination & Buttons */
.pagination .page-link {
    border-radius: 4px;
    margin: 0 2px;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: theme_link_color;
    border-color: theme_link_color;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn {
    border-radius: 6px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: transform 0.1s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: theme_primary_button_text_color !important;
    background-color: theme_primary_button_background_color !important;
    border: none;
}

.btn-primary:hover {
    background-color: theme_primary_button_hover_color !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 6. Alerts */
.alert {
    border-radius: 8px;
    border: 0;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.alert-primary {
    color: theme_primary_alert_text_color;
    background: theme_primary_alert_background_color;
    border-left: 4px solid theme_primary_alert_border_color;
}

/* Change body.dark-mode to .dark-mode */
.dark-mode body {
    background-color: #121212 !important;
    color: #e0e0e0;
}

.dark-mode .card-blesta,
.dark-mode .list-group-item,
.dark-mode .modal-content {
    background-color: #1e1e1e !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: #ffffff;
}

.dark-mode .card-blesta > .card-header {
    background: linear-gradient(180deg, #2c2c2c, #1e1e1e) !important;
    color: #ffffff !important;
}

.dark-mode a { color: #8ab4f8; }

/* Keep system preference as a fallback */
@media (prefers-color-scheme: dark) {
    body:not(.light-mode) {
        /* You can copy the dark-mode styles here too for auto-detect */
    }
}

/* Fix for title div being covered in Dark Mode */
.dark-mode .title {
    position: relative;
    z-index: 10; /* Ensure title stays above background layers */
    margin-bottom: 20px; /* Force spacing between header and content */
    overflow: visible; /* Prevent clipping */
}

/* Ensure the main container doesn't overlap upwards */
.dark-mode .main-content,
.dark-mode .body-container {
    position: relative;
    z-index: 5;
    background-color: #121212 !important;
}

/* Optional: Add a subtle border to separate the title from the body */
.dark-mode .title {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Mobile Navigation Optimization */
@media (max-width: 767px) {
    /* Make the mobile menu items larger and easier to tap */
    .nav-content nav.navbar .navbar-nav > li > a {
        padding: 12px 20px !important;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        font-size: 1.1rem;
    }

    /* Sticky Bottom Mobile Bar (Optional Modern Trend) */
    /* This makes core actions always reachable with the thumb */
    .mobile-quick-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        display: flex;
        justify-content: space-around;
        padding: 10px;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }
}

/* Sidebar "Sticky" Behavior for Desktop */
@media (min-width: 992px) {
    .col-md-3 .list-group {
        position: sticky;
        top: 20px; /* Keeps the sidebar visible while scrolling long pages */
    }
}
/* Rotate animation for a modern feel when toggled */
#theme-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#dark-mode-toggle:hover #theme-icon {
    transform: rotate(15deg);
}

/* Specific colors for icons */
.fa-sun {
    color: #ffcc00; /* Sunny yellow */
}

.fa-moon {
    color: #5c7cfa; /* Soft night blue */
}
/* Fix for title div being covered in Dark Mode */
.dark-mode .title {
    position: relative;
    z-index: 10; /* Ensure title stays above background layers */
    margin-bottom: 20px; /* Force spacing between header and content */
    overflow: visible; /* Prevent clipping */
}

/* Ensure the main container doesn't overlap upwards */
.dark-mode .main-content,
.dark-mode .body-container {
    position: relative;
    z-index: 5;
    background-color: #121212 !important;
}

/* Optional: Add a subtle border to separate the title from the body */
.dark-mode .title {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* Apply to both modes */
.title {
    height: auto !important; /* Remove any fixed height */
    min-height: 60px; /* Ensures a consistent base height */
    padding: 20px 15px !important; /* Adds internal space */
    line-height: 1.4 !important; /* Prevents text from crowding the edges */
    overflow: visible !important; /* Ensures nothing is cut off */
    display: block;
}

.title h3 {
    margin: 0;
    padding: 0;
    display: inline-block;
    vertical-align: middle;
}
/* Prevents the body container from sliding under the title */
.main-content,
.body-container,
#main-container {
    margin-top: 20px !important;
    position: relative;
    clear: both;
}
/* Fix for high-contrast titles in Dark Mode */
.dark-mode .title h3,
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode .card-header {
    color: #ffffff !important; /* Forces pure white for headings */
}

/* Specifically targeting the Categories/Articles sidebar and list titles */
.dark-mode .list-group-item h4,
.dark-mode .list-group-item-heading,
.dark-mode .section-title {
    color: #ffffff !important;
}

/* If the text is still too faint, adjust the sub-text/links */
.dark-mode .list-group-item {
    color: #d1d1d1; /* Muted light gray for general list text */
}

/* Ensure the background behind them isn't too light */
.dark-mode .list-group-item {
    background-color: #1e1e1e !important;
}

/* Fix Knowledge Base / Page Title visibility in Dark Mode */
.dark-mode .title {
    /* Replace the light gradient with a dark one */
    background: #1a1a1a !important;
    background: linear-gradient(180deg, #252525, #1a1a1a) !important;

    /* Ensure a border separates it from the header if needed */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Ensure the text stays white/light against the new dark background */
.dark-mode .title h3,
.dark-mode .title h1 {
    color: #ffffff !important;
}

/* Fix for Knowledge Base search bar container if it also turned white */
.dark-mode .kb_search,
.dark-mode .search-container {
    background-color: #1e1e1e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
/* Fix for Card Body Titles in Dark Mode */
.dark-mode .card-body h4,
.dark-mode .card-body .h4 {
    color: #ffffff !important; /* Forces high-contrast white */
    margin-bottom: 10px;
}

/* Ensure the card body text is also readable */
.dark-mode .card-body {
    color: #d1d1d1 !important; /* Muted light gray for body content */
}

/* If you have specific 'primary' or 'info' cards that still look light: */
.dark-mode .card {
    background-color: #1e1e1e !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}
/* Fix for h5 and general headings in Dark Mode */
.dark-mode h5,
.dark-mode .h5,
.dark-mode .card-body h5,
.dark-mode .list-group-item h5 {
    color: #ffffff !important; /* Force high-contrast white */
}



