/* custom.css - Specialized Integration & Navigation Styles */

/* Note: Base styles (typography, layout, components) moved to base.css
   This file focuses on dynamic.css integration and specialized functionality */

/* ============================================================================ */
/* NAVIGATION STYLES - Using Dynamic CSS Variables from Header Controller      */
/* ============================================================================ */

#mainNavigation {
    background: var(--header-bg, transparent);
    border-bottom: 1px solid var(--header-border, #e9ecef);
    box-shadow: var(--header-shadow, none);
    padding: 0;
    padding-top: 10px;
    padding-bottom: 10px;
}

/* ======================================
   NAVBAR RESPONSIVE BREAKPOINT OVERRIDES
   Custom 1024px Breakpoint Implementation
   ====================================== */

/* Base navbar behavior */
.navbar {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
}

.navbar .container-fluid {
    display: flex !important;
    flex-wrap: inherit !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
}

/* Mobile/Tablet view - 1024px and below */
@media (max-width: 1024px) {
    .navbar-collapse {
        display: none !important;
    }
    
    .navbar-collapse.show {
        display: block !important;
    }
    
    .navbar-toggler {
        display: block !important;
    }
    
    .navbar-nav {
        flex-direction: column !important;
    }
    
    .navbar-nav .dropdown-menu {
        position: static !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
    }
    
    .navbar-nav .dropdown-item {
        padding-left: 2rem !important;
    }
}

/* Desktop view - 1025px and above */
@media (min-width: 1025px) {
    .navbar-collapse {
        display: flex !important;
        flex-basis: auto !important;
        flex-grow: 1 !important;
        align-items: center !important;
    }
    
    .navbar-toggler {
        display: none !important;
    }
    
    .navbar-nav {
        display: flex !important;
        flex-direction: row !important;
        margin-left: auto !important;
        align-items: center !important;
    }
    
    .navbar-brand {
        margin-right: auto !important;
    }
}

/* ======================================
   LOGO INTEGRATION - Override dynamic.css
   ====================================== */

/* Override dynamic.css logo hiding */
#mainNavigation .navbar-brand {
    display: flex !important;
    justify-content: var(--logo-position, center);
    align-items: center;
}

#mainNavigation .navbar-brand img {
    display: block !important;
    max-width: 100%;
    width: var(--logo-width, auto);
    height: var(--logo-height, auto);
    object-fit: contain;
}

/* Tablet logo responsive sizing */
@media (min-width: 769px) and (max-width: 834px) {
    #mainNavigation .navbar-brand img {
        max-width: 240px;
        width: 100% !important;
        height: auto !important;
    }
}

@media (max-width: 768px) {
    #mainNavigation .navbar-brand img {
        max-width: 200px;
        width: 100% !important;
        height: auto !important;
    }
}

#mainNavigation .navbar-nav {
    padding: 0.5rem 0;
}

#mainNavigation .nav-link {
    color: var(--nav-link-color, #495057);
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 0.375rem;
}

/* Remove underlines from navbar navigation links */
#mainNavigation .nav-link,
#mainNavigation .dropdown-item {
    text-decoration: none;
}

#mainNavigation .nav-link:hover {
    color: var(--nav-link-hover, #007bff);
    background-color: var(--nav-link-hover-bg, transparent);
}

#mainNavigation .nav-link.active,
#mainNavigation .nav-link.active:hover,
#mainNavigation .nav-link.active:focus {
    color: var(--nav-link-active, #007bff);
    background-color: var(--nav-link-active-bg, transparent);
    font-weight: 500;
    text-decoration: none !important;
}

#mainNavigation .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background-color: var(--nav-link-active, #007bff);
}

#mainNavigation .nav-link:focus {
    color: var(--nav-link-focus, #007bff);
    background-color: var(--nav-link-focus-bg, transparent);
    outline: none;
}

/* Dropdown Styles */
#mainNavigation .dropdown-menu {
    background: var(--header-bg, #ffffff);
    border: 1px solid var(--header-border, #e9ecef);
    box-shadow: var(--header-shadow, 0 0.5rem 1rem rgba(0, 0, 0, 0.15));
    padding: 0.5rem 0;
    margin-top: 0;
    animation: slideDown 0.2s ease-out;
}

#mainNavigation .dropdown-item {
    color: var(--nav-link-color, #495057);
    padding: 0.5rem 1.5rem;
    transition: all 0.2s ease;
}

#mainNavigation .dropdown-item:hover {
    color: var(--nav-link-hover, #007bff);
    background-color: var(--nav-link-hover-bg, #f8f9fa);
}

#mainNavigation .dropdown-item.active,
#mainNavigation .dropdown-item.active:hover,
#mainNavigation .dropdown-item.active:focus {
    color: var(--nav-link-active, #007bff);
    background-color: var(--nav-link-active-bg, #e9ecef);
    font-weight: 500;
    text-decoration: none !important;
}

/* Mobile Toggle Button */
#mainNavigation .navbar-toggler {
    color: var(--navbar-toggler-color, #666666);
    border-color: var(--navbar-toggler-border, #e9ecef);
    background-color: var(--navbar-toggler-bg, #ffffff);
    padding: 0.25rem 0.75rem;
}

#mainNavigation .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem var(--nav-link-focus-bg, rgba(0, 123, 255, 0.25));
}

#mainNavigation .navbar-toggler-icon {
    /* Default fallback icon - will be dynamically updated by navbar-toggler-dynamic.js */
    /* This uses the default Bootstrap gray color as fallback */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23666666' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Sticky Navigation */
#mainNavigation.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--header-bg, rgba(255, 255, 255, 0.95));
    /* Note: Apply .frostedGlass class for glass effect */
}

/* Animation for dropdowns */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Icon spacing in navigation */
#mainNavigation .nav-link i,
#mainNavigation .dropdown-item i {
    font-size: 0.9em;
    vertical-align: middle;
}

/* Mobile Navigation Styles */
@media (max-width: 991px) {
    #mainNavigation .navbar-collapse {
        background: var(--header-bg, #ffffff);
        border-top: 1px solid var(--header-border, #e9ecef);
        margin-top: 0.5rem;
        padding: 1rem 0;
        /* Fade-in-down animation like dropdowns */
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
    }
    
    #mainNavigation .navbar-collapse.show {
        opacity: 1;
        transform: translateY(0);
    }
    
    #mainNavigation .nav-link {
        padding: 0.75rem 1rem;
    }
    
    #mainNavigation .dropdown-menu {
        position: static;
        border: none;
        box-shadow: none;
        padding-left: 1rem;
        background: transparent;
    }
    
    #mainNavigation .dropdown-item {
        padding: 0.5rem 1rem;
    }
}

/* ============================================================================ */
/* NAVBAR DROPDOWN FIX - Ensure dropdowns work in stacked layout               */
/* ============================================================================ */

/* Restore normal Bootstrap dropdown behavior for desktop (1025px+) */
@media (min-width: 1025px) {
    /* Override the mobile static positioning for all desktop dropdowns */
    .navbar-nav .dropdown-menu {
        position: absolute !important;
        float: none !important;
        width: auto !important;
        margin-top: 0.125rem !important;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
        background: var(--header-bg, #ffffff) !important;
        border: 1px solid var(--header-border, #e9ecef) !important;
        z-index: 1000 !important;
    }
    
    /* Ensure dropdown parent has relative positioning */
    .navbar-nav .dropdown {
        position: relative;
    }
}

/* ============================================================================ */
/* LAYER 2 - BACKGROUND IMAGES SYSTEM (JavaScript Controlled)                 */
/* ============================================================================ */

/* Layer 2 CSS Variables - Controlled by JavaScript */
:root {
    --body-layer2-image: none;             /* Set by JavaScript from ui-config.json */
    --body-layer2-size: cover;             /* Background sizing */
    --body-layer2-position: center center; /* Background positioning */
    --body-layer2-repeat: no-repeat;       /* Background repeat */
    --body-layer2-attachment: scroll;      /* Scroll behavior */
}

/* Layer 2 Implementation - Background Images */
body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    
    /* Layer enable/disable control from dynamic.css */
    opacity: calc(var(--layer2-enabled, 0) * var(--body-layer2-opacity, 1));
    
    /* Background image properties controlled by JavaScript */
    background-image: var(--body-layer2-image);
    background-position: var(--body-layer2-position);
    background-size: var(--body-layer2-size);
    background-repeat: var(--body-layer2-repeat);
    background-attachment: var(--body-layer2-attachment);
}

/* Mobile optimizations for Layer 2 */
@media (max-width: 768px) {
    body::after {
        min-height: 100vh;
        /* Force scroll attachment on mobile for better performance */
        background-attachment: scroll !important;
    }
}

/* High contrast support for Layer 2 */
@media (prefers-contrast: high) {
    body::after {
        filter: contrast(1.2);
    }
}

/* ============================================================================ */
/* SVG BACKGROUND SUPPORT - Preserves animations and interactivity             */
/* ============================================================================ */

/* SVG background container - dynamically created by JavaScript */
#layer2-svg-background {
    /* Base positioning and layering */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -2;
    pointer-events: none;
    
    /* Smooth transitions */
    transition: opacity 0.8s ease-in-out;
    
    /* Ensure proper rendering */
    overflow: hidden;
}

/* SVG element styling within the container */
#layer2-svg-background svg {
    /* Force absolute positioning for cover behavior */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Force minimum size to cover viewport */
    min-width: 100vw;
    min-height: 100vh;
    width: auto;
    height: auto;
    
    /* SVG-specific cover behavior */
    preserveAspectRatio: xMidYMid slice;  /* SVG equivalent of cover */
    
    /* Preserve SVG crisp rendering */
    shape-rendering: geometricPrecision;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Alternative scaling modes - can be controlled via JavaScript */
#layer2-svg-background.contain svg {
    object-fit: contain;  /* Fits entire SVG, may show empty space */
}

#layer2-svg-background.fill svg {
    object-fit: fill;     /* Stretches to fill, may distort */
}

/* Mobile optimizations for SVG backgrounds */
@media (max-width: 768px) {
    #layer2-svg-background {
        /* Force hardware acceleration for better performance */
        transform: translateZ(0);
        will-change: opacity;
    }
    
    #layer2-svg-background svg {
        /* Optimize SVG rendering on mobile */
        shape-rendering: optimizeSpeed;
    }
}

/* High contrast support for SVG backgrounds */
@media (prefers-contrast: high) {
    #layer2-svg-background {
        filter: contrast(1.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #layer2-svg-background {
        transition: none;
    }
    
    /* Note: SVG animations within the file will still play */
    /* Individual SVGs should respect prefers-reduced-motion if needed */
}

/* ============================================================================ */
/* FOOTER STYLES - Dynamic CSS Integration & Flexbox Positioning              */
/* ============================================================================ */

/* Main footer element - sticky at bottom */
footer {
    /* Flexbox positioning */
    flex-shrink: 0;
    margin-top: auto;
    
    /* Dynamic CSS variables from footer controller */
    background: var(--footer-bg, #f8f9fa);
    color: var(--footer-text, #333333);
    border-top: 1px solid var(--footer-border, #e9ecef);
    box-shadow: var(--footer-shadow, none);
    
    /* Ensure footer stays at bottom */
    width: 100%;
    position: relative;
    z-index: 10;
    
    /* Footer padding */
    padding: 20px;
    
    
}

/* Footer links styling using dynamic variables */
footer a {
    color: var(--footer-link, #007bff);
    transition: all 0.3s ease;
}

footer a:hover {
    color: var(--footer-link-hover, #0056b3);
    text-decoration: none;
    transform: translateX(5px);
}

/* Footer section titles */
footer .footer-section-title {
    color: var(--footer-text, #333333);
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Footer logo section */
footer .footer-logo-section .footer-company-info p {
    color: var(--footer-text, #6c757d);
    margin-bottom: 0.5rem;
}

footer .footer-logo-section .footer-company-info .fw-bold {
    color: var(--footer-text, #333333);
}

/* Footer navigation styling */
footer .footer-nav-list {
    margin: 0;
    padding: 0;
}

footer .footer-nav-link {
    color: var(--footer-link, #666666);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

footer .footer-nav-link:hover {
    color: var(--footer-link-hover, #007bff);
    text-decoration: none;
    transform: translateX(5px);
}

/* Non-clickable parent items */
footer .footer-nav-parent {
    color: var(--footer-text, #333333);
    font-size: 0.95rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    cursor: default;
    /* No hover effects for parent items */
}

footer .footer-subnav-link {
    color: var(--footer-link, #888888);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    opacity: 0.8;
}

footer .footer-subnav-link:hover {
    color: var(--footer-link-hover, #007bff);
    text-decoration: none;
    opacity: 1;
    transform: translateX(5px);
}

/* Footer social media section */
footer .footer-social-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

footer .footer-social-link {
    color: var(--footer-link, #666666);
    text-decoration: none;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

footer .footer-social-link:hover {
    color: var(--footer-link-hover, #007bff);
    text-decoration: none;
    transform: translateX(5px);
}

/* Copyright section */
footer .copyright {
    background: var(--footer-bg, transparent);
    padding: 1rem 0;
}

footer .copyright small {
    color: var(--footer-text, #6c757d);
    opacity: 0.8;
}

/* Legal links styling */
footer .footer-legal-link {
    color: var(--footer-link, #666666);
    text-decoration: none;
    font-size: inherit;
    transition: all 0.3s ease;
}

footer .footer-legal-link:hover {
    color: var(--footer-link-hover, #007bff);
    text-decoration: none;
    transform: translateX(5px);
}

/* Mobile responsive copyright layout */
@media (max-width: 576px) {
    footer .copyright {
        flex-direction: column !important;
        text-align: center !important;
        gap: 0.5rem;
    }
    
    footer .copyright .copyright-text {
        margin-bottom: 0.5rem;
    }
}

/* Mobile Footer Visibility Fix - 1024px and below */
@media (max-width: 1024px) {
    footer {
        /* Force footer to stay visible on mobile devices */
        position: relative !important;
        z-index: 100 !important;
        margin-top: auto !important;
        
        /* Ensure footer doesn't get pushed off-screen by background containers */
        min-height: auto !important;
        display: block !important;
        visibility: visible !important;
        
        /* Add bottom spacing to account for mobile viewport issues */
        margin-bottom: 0 !important;
        padding-bottom: 1rem;
    }
    
    /* Ensure body maintains proper flexbox behavior on mobile */
    body {
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* Ensure main content expands to fill available space */
    main {
        flex: 1 0 auto !important;
        /* Removed fixed min-height that was causing large gaps on mobile */
    }
}

/* Responsive footer adjustments */
@media (max-width: 768px) {
    footer .social-links a {
        font-size: 1.25rem;
        margin: 0 0.5rem;
    }
    
    footer .copyright {
        padding: 0.75rem 0;
    }
    
    /* Additional mobile spacing for footer visibility */
    footer {
        padding-bottom: 1.5rem !important;
    }
}

/* Footer logo styling */
footer .footer-logo-img {
    max-width: 220px;
    height: auto;
    display: block;
    object-fit: contain;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    footer {
        border-top-width: 2px;
    }
    
    footer a {
        text-decoration: underline;
    }
}

/* ============================================================================ */
/* COOKIE CONSENT BANNER STYLES - Using Dynamic CSS Variables                  */
/* ============================================================================ */

.cookie-consent-banner {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Cookie button container - stacked layout */
.cookie-button-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cookie-form {
    width: 100%;
}

/* Cookie accept button - using dynamic.css variables */
.cookie-btn-accept {
    width: 100%;
    background-color: var(--footer-link, #000000);
    color: var(--footer-bg, rgba(179, 255, 204, 1));
    border: 2px solid var(--footer-link, #000000);
    font-weight: bold;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.cookie-btn-accept:hover {
    background-color: var(--footer-link-hover, #333333);
    border-color: var(--footer-link-hover, #333333);
    color: var(--footer-bg, rgba(179, 255, 204, 1));
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Cookie decline button - using dynamic.css variables */
.cookie-btn-decline {
    width: 100%;
    border: 2px solid var(--footer-link, #000000);
    color: var(--footer-link, #000000);
    background: transparent;
    font-weight: bold;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.cookie-btn-decline:hover {
    background-color: var(--footer-link, #000000);
    color: var(--footer-bg, rgba(179, 255, 204, 1));
    border-color: var(--footer-link, #000000);
    transform: translateY(-2px);
    opacity: 0.9;
}

/* ============================================================================ */
/* LAZY LOADING STYLES - Performance Optimization                              */
/* ============================================================================ */

/* Global lazy loading for all images */
img {
    loading: lazy;
}
