/* ========================================
   ADVANCED FEATURES CSS
   Dark Mode, Font Sizes, PWA, Search, Voice
   ======================================== */

/* ========================================
   DARK MODE
   ======================================== */

body.dark-mode {
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 50%, #2a2a2a 100%);
    color: #e0e0e0;
}

body.dark-mode .minimal-nav,
body.dark-mode .mobile-bottom-nav,
body.dark-mode .mobile-drawer {
    background: rgba(0, 0, 0, 0.98);
}

body.dark-mode .hub-card,
body.dark-mode .product-card,
body.dark-mode .ministry-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(212, 175, 55, 0.2);
}

body.dark-mode .hero-section {
    background-image: linear-gradient(rgba(0,0,0,0.7), rgba(0,0,0,0.7)), var(--hero-bg);
}

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    border-color: rgba(212, 175, 55, 0.3);
}

/* ========================================
   FONT SIZE VARIANTS
   ======================================== */

:root.font-small {
    font-size: 14px;
}

:root.font-medium {
    font-size: 16px;
}

:root.font-large {
    font-size: 18px;
}

/* Adjust key elements */
:root.font-small .hero-content h1 { font-size: 2.5rem; }
:root.font-medium .hero-content h1 { font-size: 3rem; }
:root.font-large .hero-content h1 { font-size: 3.5rem; }

:root.font-small body { font-size: 0.875rem; }
:root.font-medium body { font-size: 1rem; }
:root.font-large body { font-size: 1.125rem; }

/* ========================================
   PWA INSTALL BANNER
   ======================================== */

.pwa-install-banner {
    position: fixed;
    bottom: 100px;
    left: 10px;
    right: 10px;
    background: rgba(26, 42, 58, 0.98);
    border: 2px solid #D4AF37;
    border-radius: 15px;
    padding: 15px;
    z-index: 1000;
    transform: translateY(200px);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.pwa-install-banner.show {
    transform: translateY(0);
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.install-banner-icon {
    font-size: 2rem;
}

.install-banner-text {
    flex: 1;
}

.install-banner-text strong {
    display: block;
    color: #D4AF37;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.install-banner-text p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.install-banner-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #D4AF37, #B8860B);
    color: #1a1410;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.install-banner-btn:active {
    transform: scale(0.95);
}

.install-banner-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
}

/* ========================================
   SETTINGS CONTROLS IN DRAWER
   ======================================== */

.settings-toggle,
.settings-control {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-label,
.control-label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

.toggle-label i,
.control-label i {
    color: #D4AF37;
    width: 24px;
    font-size: 1.1rem;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    display: inline-block;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.4s;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #D4AF37;
}

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

/* Font Size Buttons */
.font-size-buttons {
    display: flex;
    gap: 10px;
}

.font-size-btn {
    width: 40px;
    height: 40px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.font-size-btn:first-child {
    font-size: 0.8rem;
}

.font-size-btn:last-child {
    font-size: 1.3rem;
}

.font-size-btn.active {
    background: #D4AF37;
    color: #1a1410;
    border-color: #D4AF37;
}

.font-size-btn:active {
    transform: scale(0.9);
}

/* ========================================
   VOICE FAB BUTTON
   ======================================== */

.voice-fab {
    position: fixed;
    bottom: 180px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 20px rgba(76, 175, 80, 0.4);
    cursor: pointer;
    z-index: 998;
    transition: all 0.3s ease;
    display: none;
}

.voice-fab.listening {
    animation: voice-pulse 1s ease-in-out infinite;
    background: linear-gradient(135deg, #f44336, #d32f2f);
    box-shadow: 0 4px 20px rgba(244, 67, 54, 0.6);
}

@keyframes voice-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (max-width: 768px) {
    .voice-fab {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ========================================
   SEARCH OVERLAY
   ======================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 42, 58, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1003;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.show {
    display: block;
    opacity: 1;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.search-header {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    padding-top: 20px;
}

#mobile-search-input {
    flex: 1;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    outline: none;
    transition: all 0.3s ease;
}

#mobile-search-input:focus {
    border-color: #D4AF37;
    background: rgba(255, 255, 255, 0.15);
}

.search-close {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    color: #D4AF37;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-close:active {
    transform: scale(0.9);
}

.search-results {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.search-suggestions h4,
.search-results-list h4 {
    color: #D4AF37;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.search-suggestion,
.search-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: all 0.3s ease;
}

.search-suggestion:active,
.search-result-item:active {
    transform: translateX(5px);
    background: rgba(212, 175, 55, 0.2);
}

.search-suggestion i,
.search-result-item i {
    color: #D4AF37;
    font-size: 1.2rem;
    width: 24px;
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.search-no-results i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

.search-no-results p {
    font-size: 1.1rem;
}

/* ========================================
   NOTIFICATION BADGE
   ======================================== */

.mobile-nav-item .badge {
    position: absolute;
    top: 4px;
    right: 8px;
    background: #ff3b30;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.6);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ========================================
   SWIPE NAVIGATION INDICATORS
   ======================================== */

.swipe-nav-hint {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 42, 58, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    color: #D4AF37;
    font-size: 12px;
    z-index: 100;
    display: none;
    align-items: center;
    gap: 8px;
    animation: swipe-hint-fade 3s ease-in-out;
}

@keyframes swipe-hint-fade {
    0%, 80% { opacity: 1; }
    100% { opacity: 0; }
}

@media (max-width: 768px) {
    .swipe-nav-hint.show {
        display: flex;
    }
}

/* ========================================
   LOADING STATES
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(212, 175, 55, 0.3);
    border-top-color: #D4AF37;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #D4AF37;
    outline-offset: 2px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .settings-toggle,
    .settings-control {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .font-size-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .pwa-install-banner {
        bottom: 90px;
    }
}

@media (max-width: 480px) {
    .install-banner-content {
        flex-direction: column;
        text-align: center;
    }
    
    .install-banner-btn {
        width: 100%;
    }
}
