/* ==========================================================================
   Elites9 Grav CMS Theme - Dynamic Theme & Dark Mode Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Theme Variables & Base Transitions
   -------------------------------------------------------------------------- */
:root {
    --primary-color: #0194da;
    --secondary-color: #074da2;
    --dark-color: #202a30;
    
    /* Default Light Mode Colors */
    --theme-bg-body: #ffffff;
    --theme-bg-alt: #f7f9fa;
    --theme-bg-card: #ffffff;
    --theme-text: #747474;
    --theme-text-muted: #9c9c9c;
    --theme-heading: #202a30;
    --theme-border: #E6E6E6;
    --theme-border-light: #f0f0f0;
    --theme-header-top-bg: #ffffff;
    --theme-nav-bg: #202a30;
    --theme-nav-link: #ffffff;
    --theme-footer-bg: #202a30;
    --theme-footer-bottom: #192126;
    --theme-card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* --------------------------------------------------------------------------
   2. Dark Mode Overrides
   -------------------------------------------------------------------------- */
[data-theme="dark"],
body.dark-theme {
    --theme-bg-body: #12161a;
    --theme-bg-alt: #181d22;
    --theme-bg-card: #1e242b;
    --theme-text: #b5c0cc;
    --theme-text-muted: #85919e;
    --theme-heading: #f2f5f8;
    --theme-border: #2c353f;
    --theme-border-light: #232b33;
    --theme-header-top-bg: #181d22;
    --theme-nav-bg: #12161a;
    --theme-nav-link: #f2f5f8;
    --theme-footer-bg: #0f1316;
    --theme-footer-bottom: #090c0e;
    --theme-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);

    background-color: var(--theme-bg-body) !important;
    color: var(--theme-text) !important;
}

[data-theme="dark"] .page-wrapper,
body.dark-theme.page-wrapper {
    background-color: var(--theme-bg-body);
    color: var(--theme-text);
}

/* Headings in 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,
body.dark-theme h1, body.dark-theme h2, body.dark-theme h3,
body.dark-theme h4, body.dark-theme h5, body.dark-theme h6 {
    color: var(--theme-heading);
}

[data-theme="dark"] p,
body.dark-theme p {
    color: var(--theme-text);
}

/* Header & Top Bar */
[data-theme="dark"] .header-top,
body.dark-theme .header-top {
    background-color: var(--theme-header-top-bg);
    border-bottom: 1px solid var(--theme-border);
}

[data-theme="dark"] .header-top .info-box strong,
body.dark-theme .header-top .info-box strong {
    color: var(--theme-heading);
}

[data-theme="dark"] .header-top .info-box a,
body.dark-theme .header-top .info-box a {
    color: var(--theme-text);
}

[data-theme="dark"] .header-top .info-box .icon,
body.dark-theme .header-top .info-box .icon {
    color: var(--primary-color);
}

[data-theme="dark"] .lower-part,
body.dark-theme .lower-part {
    background-color: var(--theme-nav-bg);
    border-top: 1px solid var(--theme-border);
    border-bottom: 1px solid var(--theme-border);
}

[data-theme="dark"] .main-menu .navigation > li > a,
body.dark-theme .main-menu .navigation > li > a {
    color: var(--theme-nav-link);
}

[data-theme="dark"] .main-menu .navigation > li > ul,
body.dark-theme .main-menu .navigation > li > ul {
    background-color: var(--theme-bg-card);
    border: 1px solid var(--theme-border);
    box-shadow: var(--theme-card-shadow);
}

[data-theme="dark"] .main-menu .navigation > li > ul > li > a,
body.dark-theme .main-menu .navigation > li > ul > li > a {
    color: var(--theme-text);
    border-bottom: 1px solid var(--theme-border-light);
}

[data-theme="dark"] .main-menu .navigation > li > ul > li > a:hover,
body.dark-theme .main-menu .navigation > li > ul > li > a:hover {
    background-color: var(--primary-color);
    color: #ffffff;
}

/* Sections & Containers */
[data-theme="dark"] .welcome-section,
[data-theme="dark"] .welcome-inner,
body.dark-theme .welcome-section,
body.dark-theme .welcome-inner {
    background-color: var(--theme-bg-body);
}

[data-theme="dark"] .bg-color-f7,
[data-theme="dark"] .service-section,
body.dark-theme .bg-color-f7,
body.dark-theme .service-section {
    background-color: var(--theme-bg-alt) !important;
}

[data-theme="dark"] .service-box,
[data-theme="dark"] .inner-box,
[data-theme="dark"] .item-box,
[data-theme="dark"] .product-card,
[data-theme="dark"] .sidebar-widget,
[data-theme="dark"] .blog-post,
body.dark-theme .service-box,
body.dark-theme .inner-box,
body.dark-theme .item-box,
body.dark-theme .product-card,
body.dark-theme .sidebar-widget,
body.dark-theme .blog-post {
    background-color: var(--theme-bg-card);
    border-color: var(--theme-border);
    box-shadow: var(--theme-card-shadow);
    color: var(--theme-text);
}

[data-theme="dark"] .service-box h3 a,
[data-theme="dark"] .inner-box h3,
body.dark-theme .service-box h3 a,
body.dark-theme .inner-box h3 {
    color: var(--theme-heading);
}

[data-theme="dark"] .sec-title .title,
[data-theme="dark"] .sec-title .sub-title,
[data-theme="dark"] .sec-title h2,
body.dark-theme .sec-title .title,
body.dark-theme .sec-title .sub-title,
body.dark-theme .sec-title h2 {
    color: var(--theme-heading);
}

/* Breadcrumbs & Inner Header */
[data-theme="dark"] .inner-header,
[data-theme="dark"] .bread-crumb,
body.dark-theme .inner-header,
body.dark-theme .bread-crumb {
    background-color: var(--theme-bg-alt);
    border-bottom: 1px solid var(--theme-border);
}

[data-theme="dark"] .bread-crumb li,
[data-theme="dark"] .bread-crumb li a,
body.dark-theme .bread-crumb li,
body.dark-theme .bread-crumb li a {
    color: var(--theme-text-muted);
}

[data-theme="dark"] .bread-crumb li.active,
body.dark-theme .bread-crumb li.active {
    color: var(--primary-color);
}

/* Forms & Inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
body.dark-theme input[type="text"],
body.dark-theme input[type="email"],
body.dark-theme input[type="tel"],
body.dark-theme input[type="url"],
body.dark-theme textarea,
body.dark-theme select {
    background-color: var(--theme-bg-alt);
    border: 1px solid var(--theme-border);
    color: var(--theme-heading);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
body.dark-theme input:focus,
body.dark-theme textarea:focus,
body.dark-theme select:focus {
    border-color: var(--primary-color);
    background-color: var(--theme-bg-card);
}

/* Tables */
[data-theme="dark"] table.table,
body.dark-theme table.table {
    border-color: var(--theme-border);
}

[data-theme="dark"] table.table th,
[data-theme="dark"] table.table td,
body.dark-theme table.table th,
body.dark-theme table.table td {
    background-color: var(--theme-bg-card);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

[data-theme="dark"] table.table th,
body.dark-theme table.table th {
    color: var(--theme-heading);
}

[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd),
body.dark-theme .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--theme-bg-alt);
}

/* Footer in Dark Mode */
[data-theme="dark"] .footer.sec-padding.style2,
body.dark-theme .footer.sec-padding.style2 {
    background-color: var(--theme-footer-bg);
    border-top: 1px solid var(--theme-border);
}

[data-theme="dark"] .footer-bottom,
body.dark-theme .footer-bottom {
    background-color: var(--theme-footer-bottom);
    border-top: 1px solid var(--theme-border-light);
}

/* Buttons in Dark Mode */
[data-theme="dark"] .thm-btn.inverse,
body.dark-theme .thm-btn.inverse {
    background-color: transparent;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

[data-theme="dark"] .thm-btn.inverse:hover,
body.dark-theme .thm-btn.inverse:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

[data-theme="dark"] .thm-btn.btn-black,
body.dark-theme .thm-btn.btn-black {
    background-color: var(--theme-bg-alt);
    border-color: var(--theme-border);
    color: var(--theme-heading);
}

/* --------------------------------------------------------------------------
   3. Frontend Live Theme Switcher Widget
   -------------------------------------------------------------------------- */
.theme-switcher-wrapper {
    position: fixed;
    top: 220px;
    right: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Floating Trigger Button */
.theme-switcher-toggle {
    position: absolute;
    right: 0;
    top: 0;
    width: 44px;
    height: 44px;
    background: var(--primary-color, #0194da);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px 0 0 8px;
    box-shadow: -3px 3px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.theme-switcher-toggle:hover {
    background: var(--secondary-color, #074da2);
    transform: translateX(-4px);
}

.theme-switcher-toggle i {
    animation: spinSlow 8s linear infinite;
}

@keyframes spinSlow {
    100% {
        transform: rotate(360deg);
    }
}

/* Flyout Panel */
.theme-switcher-panel {
    position: absolute;
    right: -320px;
    top: 0;
    width: 300px;
    background: #ffffff;
    border-radius: 12px 0 0 12px;
    box-shadow: -5px 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 20px;
    color: #333333;
    transition: right 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
    max-height: 80vh;
    overflow-y: auto;
}

.theme-switcher-wrapper.active .theme-switcher-panel {
    right: 0;
}

.theme-switcher-wrapper.active .theme-switcher-toggle {
    right: 300px;
}

[data-theme="dark"] .theme-switcher-panel,
body.dark-theme .theme-switcher-panel {
    background: #1c2228;
    color: #e2e8f0;
    border-color: #2e3842;
    box-shadow: -5px 10px 35px rgba(0, 0, 0, 0.6);
}

/* Header */
.theme-switcher-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

[data-theme="dark"] .theme-switcher-header,
body.dark-theme .theme-switcher-header {
    border-bottom-color: #2e3842;
}

.theme-switcher-title {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
}

.theme-switcher-close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #888888;
    cursor: pointer;
    padding: 4px;
}

.theme-switcher-close:hover {
    color: var(--primary-color);
}

/* Sections */
.theme-switcher-section {
    margin-bottom: 18px;
}

.theme-switcher-section h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: #718096;
    margin: 0 0 10px 0;
}

[data-theme="dark"] .theme-switcher-section h4,
body.dark-theme .theme-switcher-section h4 {
    color: #a0aec0;
}

/* Color Presets Grid */
.theme-presets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.theme-preset-btn {
    width: 100%;
    height: 48px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    padding: 0;
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s;
    background: #f0f0f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-preset-btn:hover {
    transform: scale(1.08);
}

.theme-preset-btn.active {
    border-color: #202a30;
    box-shadow: 0 0 0 2px var(--primary-color);
}

[data-theme="dark"] .theme-preset-btn.active,
body.dark-theme .theme-preset-btn.active {
    border-color: #ffffff;
}

/* Split-color preview badge inside preset buttons */
.preset-swatch-split {
    width: 100%;
    height: 100%;
    display: flex;
}

.preset-swatch-primary {
    width: 60%;
    height: 100%;
}

.preset-swatch-secondary {
    width: 40%;
    height: 100%;
}

/* Custom Color Inputs */
.theme-colors-custom {
    display: flex;
    gap: 12px;
}

.theme-color-field {
    flex: 1;
}

.theme-color-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #4a5568;
}

[data-theme="dark"] .theme-color-field label,
body.dark-theme .theme-color-field label {
    color: #cbd5e0;
}

.theme-color-picker-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 8px;
}

[data-theme="dark"] .theme-color-picker-wrap,
body.dark-theme .theme-color-picker-wrap {
    background: #14181d;
    border-color: #2e3842;
}

.theme-color-picker-wrap input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.theme-color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.theme-color-picker-wrap input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.theme-color-picker-wrap span.color-code {
    font-size: 11px;
    font-family: monospace;
    color: #718096;
}

[data-theme="dark"] .theme-color-picker-wrap span.color-code,
body.dark-theme .theme-color-picker-wrap span.color-code {
    color: #a0aec0;
}

/* Dark Mode Switcher Row */
.theme-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f7fafc;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

[data-theme="dark"] .theme-mode-row,
body.dark-theme .theme-mode-row {
    background: #14181d;
    border-color: #2e3842;
}

.theme-mode-label {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Modern Toggle Switch */
.theme-toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    margin: 0;
}

.theme-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e0;
    transition: 0.3s;
    border-radius: 24px;
}

.theme-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

input:checked + .theme-toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .theme-toggle-slider:before {
    transform: translateX(22px);
}

/* Footer / Reset Button */
.theme-switcher-footer {
    border-top: 1px solid #eeeeee;
    padding-top: 14px;
    display: flex;
    justify-content: flex-end;
}

[data-theme="dark"] .theme-switcher-footer,
body.dark-theme .theme-switcher-footer {
    border-top-color: #2e3842;
}

.theme-reset-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.theme-reset-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

[data-theme="dark"] .theme-reset-btn,
body.dark-theme .theme-reset-btn {
    background: #232a32;
    color: #cbd5e0;
    border-color: #2e3842;
}

[data-theme="dark"] .theme-reset-btn:hover,
body.dark-theme .theme-reset-btn:hover {
    background: #2c353f;
    color: #ffffff;
}


/* --------------------------------------------------------------------------
   4. Accessibility & Quality Enhancements (WCAG 2.1 AA)
   -------------------------------------------------------------------------- */
.skip-link {
    position: absolute;
    top: -50px;
    left: 10px;
    background: var(--primary-color, #0194da);
    color: #ffffff !important;
    padding: 8px 16px;
    z-index: 10000000;
    border-radius: 4px;
    transition: top 0.2s ease;
    font-weight: 600;
    text-decoration: none;
}
.skip-link:focus {
    top: 10px;
}

/* Accessible focus indicators for keyboard users */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-color, #0194da) !important;
    outline-offset: 2px !important;
}

/* Screen reader only utility class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .theme-switcher-toggle i {
        animation: none !important;
    }
}


/* --------------------------------------------------------------------------
   5. Bootstrap 5 Modern UI & Responsive Adaptations
   -------------------------------------------------------------------------- */
.navbar-toggler {
    padding: 0.5rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: #ffffff;
    transition: box-shadow 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(1, 148, 218, 0.35);
    outline: none;
}

.navbar-toggler-icon {
    display: inline-block;
    width: 1.5em;
    height: 1.5em;
    vertical-align: middle;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.85%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100%;
}

.main-menu.navbar {
    padding: 0;
}

.main-menu .navigation > li > ul.dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 200px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.main-menu .navigation > li > ul.dropdown-menu > li > a.dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #444444;
    transition: all 0.2s ease;
    display: block;
}

.main-menu .navigation > li > ul.dropdown-menu > li > a.dropdown-item:hover {
    background-color: var(--primary-color, #0194da);
    color: #ffffff;
    padding-left: 24px;
}

/* Form Controls with Bootstrap 5 */
.form-control:focus {
    border-color: var(--primary-color, #0194da);
    box-shadow: 0 0 0 0.25rem rgba(1, 148, 218, 0.25);
}

/* Site Logo Sizing */
.site-logo {
    max-height: 60px;
    width: auto;
    object-fit: contain;
}

.footer-logo {
    max-height: 50px;
    width: auto;
    object-fit: contain;
}

/* WOW.js Micro-interactions */
.wow {
    visibility: hidden;
}
