/**
 * UI Polish Fixes - December 4, 2025
 * Fixes overlay issues, z-index conflicts, and general polish
 */

/* ============================================
   Z-INDEX HIERARCHY FIX
   ============================================ */

/* Layer 1: Background elements */
body::before {
    z-index: -1 !important;
}

/* Layer 2: Main content */
.hero, section, main {
    z-index: 1;
}

/* Layer 3: Fixed navigation */
.navbar {
    z-index: 1000 !important;
}

/* Layer 4: Mobile menu */
.navbar-nav {
    z-index: 1001 !important;
}

/* Layer 5: Scroll to top button */
.scroll-to-top {
    z-index: 1002 !important;
    bottom: 100px !important; /* Move above chatbot */
}

/* Layer 6: Dark mode toggle */
.dark-mode-toggle {
    z-index: 1003 !important;
    bottom: 170px !important; /* Move above chatbot and scroll button */
}

/* Layer 7: Admin login button */
.admin-login {
    z-index: 1004 !important;
}

/* Layer 8: Chatbot widget (highest for easy access) */
.ai-chat-widget {
    z-index: 9998 !important;
}

/* Layer 9: Modals and overlays */
.modal {
    z-index: 9999 !important;
}

/* Layer 10: Admin panel (always on top when active) */
.admin-panel {
    z-index: 10000 !important;
}

/* ============================================
   HERO SECTION SPACING FIX
   ============================================ */

/* Ensure hero content doesn't get hidden behind fixed elements */
.hero {
    padding-top: 100px !important; /* Account for fixed navbar */
    padding-bottom: 80px !important;
    min-height: calc(100vh - 80px) !important;
}

/* Fix hero overlay so it doesn't block interactions */
.hero .overlay {
    pointer-events: none !important;
    z-index: 1 !important;
}

/* Ensure hero content is clickable */
.hero .container {
    position: relative;
    z-index: 10 !important;
    pointer-events: auto !important;
}

/* ============================================
   CHATBOT POSITIONING MOBILE FIX
   ============================================ */

@media (max-width: 768px) {
    /* Adjust chatbot for mobile */
    .ai-chat-widget {
        bottom: 15px !important;
        right: 15px !important;
    }

    /* Make chatbot window responsive */
    .ai-chat-window {
        width: calc(100vw - 30px) !important;
        max-width: 380px !important;
        height: 500px !important;
        right: 0 !important;
    }

    /* Move other fixed buttons higher on mobile */
    .scroll-to-top {
        bottom: 85px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
    }

    .dark-mode-toggle {
        bottom: 145px !important;
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
    }
}

/* ============================================
   BUTTON INTERACTION FIXES
   ============================================ */

/* Ensure all interactive elements are above static content */
button, a, input, textarea, select {
    position: relative;
    z-index: 2;
}

/* Hero CTA buttons should be prominent */
.hero button,
.hero a.btn,
.hero .cta-button {
    position: relative;
    z-index: 20 !important;
}

/* ============================================
   SMOOTH SCROLL OFFSET FOR FIXED NAVBAR
   ============================================ */

/* Account for fixed navbar when scrolling to sections */
section {
    scroll-margin-top: 80px;
}

/* ============================================
   CLIENT LOGO SECTION ENHANCEMENTS
   ============================================ */

/* Real company logos styling */
#clients .logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    padding: 1rem;
    transition: all 0.3s ease;
}

#clients .logo-container img {
    max-height: 50px;
    max-width: 100%;
    object-fit: contain;
    filter: grayscale(100%) opacity(0.6);
    transition: all 0.3s ease;
}

#clients .logo-container:hover img {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.05);
}

/* Make placeholder icons look better until real logos added */
#clients .text-4xl {
    transition: all 0.3s ease;
}

#clients .glass:hover .text-4xl {
    transform: scale(1.1);
    color: var(--color-accent) !important;
}

/* ============================================
   MODAL OVERLAY FIXES
   ============================================ */

/* Ensure modals overlay everything except admin panel */
.modal.active {
    display: flex !important;
    z-index: 9999 !important;
}

/* Prevent body scroll when modal is open */
body.modal-open {
    overflow: hidden;
}

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

/* Better focus states for keyboard navigation */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    z-index: 100;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Use transform for animations instead of position changes */
.scroll-to-top.show {
    transform: translateY(0) !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Hardware acceleration for smooth animations */
.ai-chat-widget,
.scroll-to-top,
.dark-mode-toggle,
.modal {
    will-change: transform;
    transform: translateZ(0);
}

/* ============================================
   MOBILE-SPECIFIC POLISH
   ============================================ */

@media (max-width: 768px) {
    /* Hero text sizing for mobile */
    .hero h1 {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
    }

    .hero p {
        font-size: 1.1rem !important;
    }

    /* Service pills in hero - make more compact */
    .hero-service-pill {
        padding: 0.5rem !important;
    }

    .hero-service-pill .text-sm {
        font-size: 0.75rem !important;
    }

    /* Ensure touch targets are large enough (44px minimum) */
    button,
    .btn,
    a.button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .ai-chat-widget,
    .scroll-to-top,
    .dark-mode-toggle,
    .admin-login,
    .navbar {
        display: none !important;
    }
}

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

/* Add loading skeleton for logos */
.logo-loading {
    background: linear-gradient(90deg,
        rgba(255,255,255,0.05) 0%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0.05) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ============================================
   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;
    }
}
