/**
 * CLEAN THEME SYSTEM - ibmiles.com
 * Light and Dark theme support with smooth transitions
 */

:root {
    /* Primary Colors */
    --primary-color: #FFA200;
    --primary-rgb: 255, 162, 0;
    
    /* Transitions */
    --theme-transition: all 0.3s ease;
}

/* Light Theme */
[data-theme="light"],
.theme-light {
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #212529;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Dark Theme */
[data-theme="dark"],
.theme-dark {
    --bg-color: rgba(36, 36, 36. 0.1);
    --bg-secondary: #1a1a1a;
    --text-color: #ffffff;
    --text-muted: #adb5bd;
    --border-color: #495057;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Base Styles */
body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: var(--theme-transition);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

/* Dark Theme Background Image */
[data-theme="dark"] body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/src/img/theme/8.jpg');
    background-size: 100% 100%; /* Forces image to stretch to 100% width and 100% height */
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    opacity: 1.0; 
    filter: blur(8px); 
    z-index: -2;
    pointer-events: none;
}

/* Dark mode background image adjustment for mobile */
@media (max-width: 991.98px) {
    [data-theme="dark"] body::before {
        background-attachment: scroll;
        background-size: 100% 100%; /* Full coverage on mobile too */
        filter: blur(6px); /* Slightly less blur for mobile performance */
        opacity: 0.9; /* Keep 90% visibility on mobile */
    }
}



/* Dark Theme Overlay */
[data-theme="dark"] body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(36, 36, 36, 0.85) 0%,
        rgba(36, 36, 36, 0.75) 50%,
        rgba(36, 36, 36, 0.85) 100%
    );
    z-index: -1;
    pointer-events: none;
}

/* Ensure content stays above background */
[data-theme="dark"] * {
    position: relative;
    z-index: 1;
}

/* Navbar Styles */
.navbar {
    transition: var(--theme-transition);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: relative;
    z-index: 1030;
}

/* Light theme navbar - use dark theme's background color */
[data-theme="light"] .navbar {
    background-color: #242424 !important; /* Dark theme's background color */
    backdrop-filter: blur(15px);
}

/* Dark theme navbar */
[data-theme="dark"] .navbar {
    background-color: rgba(36, 36, 36, 0.9) !important;
    backdrop-filter: blur(15px);
}

.navbar-scrolled {
    box-shadow: 0 2px 10px var(--shadow);
    padding: 0.5rem 0;
}

/* Light theme navbar when scrolled */
[data-theme="light"] .navbar-scrolled {
    background-color: #242424 !important; /* Use dark theme's background color */
    backdrop-filter: blur(20px);
}

/* Dark theme navbar when scrolled */
[data-theme="dark"] .navbar-scrolled {
    background-color: rgba(36, 36, 36, 0.95) !important;
    backdrop-filter: blur(20px);
}

/* Navbar Brand Colors */
/* Light theme - black brand */
[data-theme="light"] .navbar-brand {
    /* color: #000000 !important; */
    color: var(--primary-color) !important;
    font-weight: bold;
    font-size: 1.5rem;
}

/* Dark theme - primary color brand */
[data-theme="dark"] .navbar-brand {
    color: var(--primary-color) !important;
    font-weight: bold;
    font-size: 1.5rem;
}

/* Navbar Links - keep them themed appropriately */
.navbar-nav .nav-link {
    transition: var(--theme-transition);
    font-weight: 500;
    margin: 0 0.5rem;
    position: relative;
}

/* Light theme nav links - white text on dark navbar */
[data-theme="light"] .navbar-nav .nav-link {
    color: #ffffff !important;
}

[data-theme="light"] .navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

/* Dark theme nav links */
[data-theme="dark"] .navbar-nav .nav-link {
    color: var(--text-color) !important;
}

[data-theme="dark"] .navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.navbar-nav .nav-link:hover::after {
    width: 100%;
}

/* Mobile Navbar Styles */
@media (max-width: 991.98px) {
    .navbar-collapse {
        border-radius: 10px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 5px 15px var(--shadow);
        border: 1px solid var(--border-color);
        position: relative;
        z-index: 1;
    }
    
    /* Light theme mobile navbar - dark background */
    [data-theme="light"] .navbar-collapse {
        background-color: #242424;
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    /* Dark theme mobile navbar */
    [data-theme="dark"] .navbar-collapse {
        background-color: rgba(36, 36, 36, 0.95);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 162, 0, 0.2);
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
        margin: 0;
    }
    
    /* Light theme mobile nav links - white text */
    [data-theme="light"] .navbar-nav .nav-link {
        color: #ffffff !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    /* Dark theme mobile nav links */
    [data-theme="dark"] .navbar-nav .nav-link {
        border-bottom: 1px solid var(--border-color);
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .navbar-nav .nav-link::after {
        display: none;
    }
    
    #theme-toggle {
        width: 38px;
        height: 38px;
    }
    
    #theme-toggle i {
        font-size: 1rem;
    }
}
/* ----------------------------------- */

/* Theme Toggle Button Styles */
#theme-toggle {
    background: none;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--theme-transition);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* Light theme - moon icon should be dark text color */
[data-theme="light"] #theme-toggle {
    color: var(--primary-color); /* Black in light mode */
    border-color: var(--text-color);
}

/* Dark theme - sun icon should be primary color */
[data-theme="dark"] #theme-toggle {
    color: var(--primary-color); /* Gold in dark mode */
    border-color: var(--primary-color);
}

/* Hover states */
[data-theme="light"] #theme-toggle:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] #theme-toggle:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

/* Focus states */
[data-theme="light"] #theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

[data-theme="dark"] #theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

#theme-toggle i {
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

/* Theme toggle animation */
#theme-toggle.switching i {
    transform: rotate(180deg);
}


/* Navbar toggler for mobile */
.navbar-toggler {
    border: 2px solid var(--primary-color);
    padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23FFA200' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    transition: var(--theme-transition);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

/* Dark mode card enhancement */
[data-theme="dark"] .card {
    background-color: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 162, 0, 0.2);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #000;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.btn-primary:hover {
    background-color: #e6920a;
    border-color: #e6920a;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-outline-secondary {
    color: var(--text-color);
    border-color: var(--border-color);
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.btn-outline-secondary:hover {
    background-color: var(--text-color);
    border-color: var(--text-color);
    color: var(--bg-color);
    transform: translateY(-2px);
}

/* Forms */
.form-control {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-color);
    transition: var(--theme-transition);
    position: relative;
    z-index: 1;
}

/* Dark mode form enhancement */
[data-theme="dark"] .form-control {
    background-color: rgba(26, 26, 26, 0.9);
    backdrop-filter: blur(10px);
    border-color: rgba(255, 162, 0, 0.3);
}

.form-control:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
    color: var(--text-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--primary-rgb), 0.25);
}

[data-theme="dark"] .form-control:focus {
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(15px);
}

.form-label {
    color: var(--text-color);
    font-weight: 500;
}

/* Text Colors */
.text-primary {
    color: var(--primary-color) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Mobile Navbar Styles */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background-color: var(--bg-color);
        border-radius: 10px;
        margin-top: 1rem;
        padding: 1rem;
        box-shadow: 0 5px 15px var(--shadow);
        border: 1px solid var(--border-color);
        position: relative;
        z-index: 1;
    }
    
    /* Dark mode mobile navbar */
    [data-theme="dark"] .navbar-collapse {
        background-color: rgba(36, 36, 36, 0.95);
        backdrop-filter: blur(20px);
        border: 1px solid rgba(255, 162, 0, 0.2);
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
        margin: 0;
    }
    
    .navbar-nav .nav-link:last-child {
        border-bottom: none;
    }
    
    .navbar-nav .nav-link::after {
        display: none;
    }
    
    #theme-toggle {
        width: 38px;
        height: 38px;
    }
    
    #theme-toggle i {
        font-size: 1rem;
    }
    
    /* Dark mode background image adjustment for mobile */
    [data-theme="dark"] body::before {
        background-attachment: scroll;
        filter: blur(1px);
        opacity: 0.1;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #e6920a;
}

/* Focus states */
button:focus,
.btn:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth transitions for all theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Utility classes */
.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary-color), #ffb84d);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), #ffb84d);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

.shadow-primary {
    box-shadow: 0 0.5rem 1rem rgba(var(--primary-rgb), 0.15) !important;
}

/* Content readability improvements for dark mode */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] p,
[data-theme="dark"] .lead {
    text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.3);
}

/* Enhanced backdrop blur for better visual separation */
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .popover,
[data-theme="dark"] .tooltip-inner {
    backdrop-filter: blur(20px);
    background-color: rgba(26, 26, 26, 0.95) !important;
    border: 1px solid rgba(255, 162, 0, 0.2);
}

/* Ensure proper stacking context */
[data-theme="dark"] .container,
[data-theme="dark"] .container-fluid {
    position: relative;
    z-index: 1;
}

/* Performance optimization for background image */
@media (prefers-reduced-motion: reduce) {
    [data-theme="dark"] body::before {
        animation: none;
        transition: none;
    }
    
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    [data-theme="dark"] body::before {
        opacity: 0.05;
        filter: blur(3px) contrast(1.5);
    }
    
    [data-theme="dark"] body::after {
        background: rgba(36, 36, 36, 0.95);
    }
}

/* Loading states */
.theme-loading {
    visibility: hidden;
}

.theme-loaded {
    visibility: visible;
}

/* Tooltip positioning - ensure it appears above all layers */
.tooltip {
    z-index: 9999 !important;
}

.tooltip-inner {
    background-color: var(--bg-secondary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--border-color);
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: var(--border-color);
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: var(--border-color);
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: var(--border-color);
}

/* Dark mode tooltip enhancements */
[data-theme="dark"] .tooltip-inner {
    background-color: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 162, 0, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Theme toggle specific animations */
@keyframes sunRise {
    from {
        transform: rotate(0deg) scale(0.8);
        opacity: 0.5;
    }
    to {
        transform: rotate(180deg) scale(1);
        opacity: 1;
    }
}

@keyframes moonRise {
    from {
        transform: rotate(0deg) scale(0.8);
        opacity: 0.5;
    }
    to {
        transform: rotate(-180deg) scale(1);
        opacity: 1;
    }
}

.theme-icon-sun {
    animation: sunRise 0.3s ease-in-out;
}

.theme-icon-moon {
    animation: moonRise 0.3s ease-in-out;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .display-4 {
        font-size: 2.5rem;
    }
    
    .lead {
        font-size: 1.1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Print styles */
@media print {
    [data-theme="dark"] body::before,
    [data-theme="dark"] body::after {
        display: none;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .navbar,
    #theme-toggle {
        display: none;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #FFD700;
    }
    
    [data-theme="dark"] {
        --text-color: #ffffff;
        --bg-color: #000000;
        --border-color: #ffffff;
    }
    
    [data-theme="light"] {
        --text-color: #000000;
        --bg-color: #ffffff;
        --border-color: #000000;
    }
}

/* Focus visible for better keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color) !important;
    outline-offset: 2px !important;
}

/* Ensure theme toggle is always visible and accessible */
#theme-toggle {
    min-width: 42px;
    min-height: 42px;
    flex-shrink: 0;
}

/* Prevent layout shift during theme transitions */
html {
    scroll-behavior: smooth;
}

body {
    overflow-anchor: none;
}

/* Final cleanup - ensure all elements respect theme variables */
.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-bg-primary {
    background-color: var(--primary-color) !important;
    color: #000 !important;
}

.border-primary {
    border-color: var(--primary-color) !important;
}

/* End of theme.css */
