/* ISA Mobile Fixes - Comprehensive Mobile Enhancement */

/* Root Variables for Mobile */
:root {
    --mobile-safe-area-top: env(safe-area-inset-top);
    --mobile-safe-area-bottom: env(safe-area-inset-bottom);
    --mobile-safe-area-left: env(safe-area-inset-left);
    --mobile-safe-area-right: env(safe-area-inset-right);
}

/* Base Typography and Vertical Rhythm */
body {
    font-size: 15px;
    line-height: 1.75;
}

@media (min-width: 768px) {
    body {
        font-size: 16px;
        line-height: 1.6;
    }
}

/* Hero Typography Responsive Sizing */
.hero-h1,
.hero-headline,
h1.hero-headline {
    font-size: clamp(1.6rem, 5.5vw, 2.4rem) !important;
    line-height: 1.15 !important;
    text-wrap: balance;
}

.hero-sub,
.hero-subtitle,
p.hero-subtitle {
    font-size: clamp(1rem, 3.2vw, 1.125rem) !important;
    line-height: 1.6 !important;
    text-wrap: balance;
}

/* General Typography Scaling */
h2 {
    font-size: clamp(1.25rem, 4.5vw, 1.75rem) !important;
    text-wrap: balance;
}

h3 {
    font-size: clamp(1.125rem, 3.8vw, 1.5rem) !important;
    text-wrap: balance;
}

/* Page Container Padding */
.page-pad {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .page-pad {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 768px) {
    .page-pad {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Section Spacing */
section {
    padding-top: 3rem;
    padding-bottom: 3rem;
}

@media (min-width: 768px) {
    section {
        padding-top: 4rem;
        padding-bottom: 4rem;
    }
}

/* Scroll Margin for Anchored Content */
.scroll-offset,
section[id],
.section-anchor {
    scroll-margin-top: 6rem;
}

@media (min-width: 768px) {
    .scroll-offset,
    section[id],
    .section-anchor {
        scroll-margin-top: 9rem;
    }
}

/* Notification Bar Mobile Responsive Design */
.notification-bar {
    position: relative !important;
    height: auto !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    text-align: center;
    box-shadow: none !important;
    animation: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 9999;
}

@media (min-width: 768px) {
    .notification-bar {
        position: fixed !important;
        top: var(--mobile-safe-area-top, 0) !important;
        left: 0;
        right: 0;
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
        box-shadow: 0 2px 20px rgba(0, 212, 255, 0.3) !important;
        animation: subtlePulse 3s ease-in-out infinite !important;
    }
}

.notification-bar.dismissed {
    display: none !important;
}

.notification-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 480px) {
    .notification-content {
        flex-direction: column;
        gap: 0.75rem;
    }
}

.notification-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #FAFAFA;
    font-weight: 500;
}

.notification-close {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #FAFAFA;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
}

@media (min-width: 768px) {
    .notification-close {
        display: none;
    }
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notification-cta {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #FAFAFA !important;
    padding: 0.5rem 1rem !important;
    border-radius: 0.375rem !important;
    font-size: 0.875rem !important;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.2s ease;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .notification-cta {
        padding: 0.625rem 1.25rem !important;
        font-size: 1rem !important;
    }
}

.notification-cta:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

/* Hero Section Enhancements */
.hero {
    padding-top: 1.5rem !important;
    padding-bottom: 2rem;
}

@media (min-width: 768px) {
    .hero {
        padding-top: 2.5rem !important;
    }
}

/* Sticky CTA Mobile Improvements */
.sticky-cta {
    padding: 0.75rem 1rem calc(1rem + var(--mobile-safe-area-bottom, 0px)) !important;
    z-index: 40 !important;
}

.sticky-cta.chat-open {
    margin-bottom: 5rem;
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
    /* Logo size constraint for mobile */
    header img[src*="Logo"],
    #header img[src*="Logo"],
    nav img[src*="Logo"] {
        max-height: 36px !important;
        height: 36px !important;
        width: auto !important;
    }

    /* Mobile menu button styling */
    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 44px;
        height: 44px;
        padding: 10px;
        background: transparent;
        border: none;
        cursor: pointer;
        position: relative;
        z-index: 1001;
    }

    .mobile-menu-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background-color: #FAFAFA;
        margin: 3px 0;
        transition: all 0.3s ease;
        border-radius: 2px;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* Mobile menu container - Fixed animation */
    .mobile-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 998;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-20px);
        transition: visibility 0.3s, opacity 0.3s ease, transform 0.3s ease;
    }

    .mobile-menu.active {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    .mobile-menu a {
        display: block;
        padding: 16px 24px;
        color: #FAFAFA;
        text-decoration: none;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: all 0.3s ease;
    }

    .mobile-menu a:hover {
        background: rgba(255, 255, 255, 0.05);
        padding-left: 30px;
        color: var(--isa-cyan);
    }

    .mobile-menu .mobile-cta {
        background: linear-gradient(135deg, #00D4FF 0%, #8B5CF6 100%);
        color: #FAFAFA;
        margin: 16px 24px;
        padding: 12px 24px;
        border-radius: 8px;
        text-align: center;
        font-weight: 600;
    }

    /* Ensure header is fixed properly on mobile */
    #header, header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        height: 60px;
    }

    /* Adjust content spacing for fixed header */
    .hero, main {
        padding-top: 60px;
    }

    /* Notification bar adjustments */
    .notification-bar + #header {
        top: 48px;
    }

    .notification-bar ~ .hero,
    .notification-bar ~ main {
        padding-top: 108px;
    }
}

/* Footer Mobile Fixes */
@media (max-width: 768px) {
    /* Footer container */
    footer {
        padding: 40px 20px 20px;
    }

    /* Footer grid - stack vertically on mobile */
    .footer-content,
    footer .container > div:first-child {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }

    /* Footer columns */
    footer .grid,
    footer [class*="grid-cols"] {
        grid-template-columns: 1fr !important;
        gap: 30px;
    }

    /* Footer logo section */
    footer .logo-section,
    footer > .container > div:first-child > div:first-child {
        text-align: center;
        margin-bottom: 20px;
    }

    /* Footer logo image - proper sizing */
    footer img[src*="Logo"],
    footer .logo-section img {
        height: 36px !important;
        width: auto !important;
        margin: 0 auto 15px;
        display: block;
    }

    /* Footer text alignment */
    footer h3,
    footer h4 {
        font-size: 18px;
        margin-bottom: 15px;
        text-align: center;
    }

    footer p,
    footer a {
        text-align: center;
        font-size: 14px;
        line-height: 1.6;
    }

    /* Footer links */
    footer ul {
        padding: 0;
        list-style: none;
    }

    footer ul li {
        margin-bottom: 10px;
        text-align: center;
    }

    /* Footer bottom section */
    .footer-bottom,
    footer > div:last-child {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        text-align: center;
    }

    .footer-bottom > div,
    footer > div:last-child > div {
        flex-direction: column;
        gap: 15px;
    }

    /* Social links */
    .footer-social,
    footer .flex.gap-4 {
        justify-content: center;
        margin-top: 15px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Even smaller padding on very small screens */
    footer {
        padding: 30px 15px 15px;
    }

    /* Smaller logo on tiny screens */
    footer img[src*="Logo"] {
        height: 30px !important;
    }

    /* Smaller text */
    footer h3,
    footer h4 {
        font-size: 16px;
    }

    footer p,
    footer a {
        font-size: 13px;
    }

    /* Mobile menu adjustments */
    .mobile-menu a {
        padding: 14px 20px;
        font-size: 15px;
    }
}

/* General Mobile Improvements */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    /* Container padding */
    .container {
        padding-left: 20px;
        padding-right: 20px;
    }

    /* Section spacing */
    section {
        padding: 60px 0;
    }

    /* Typography adjustments */
    h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }

    h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    h3 {
        font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    }

    /* Button sizing for mobile */
    button, .btn, a.btn {
        min-height: 44px;
        padding: 12px 24px;
    }

    /* Card and component spacing */
    .card, [class*="bg-"] {
        padding: 20px;
    }

    /* Form inputs */
    input, textarea, select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }

    /* Blog Card Image Fixes */
    .blog-card img,
    .blog-image,
    .card img {
        aspect-ratio: 16/9;
        object-fit: cover;
        width: 100%;
        height: auto;
        background-color: rgba(0, 0, 0, 0.1);
    }

    .blog-card {
        min-height: 160px;
        display: grid;
        gap: 0.75rem;
    }

    /* Phone Links with Proper Tap Targets */
    a[href^="tel:"] {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        gap: 0.5rem;
        padding: 0.5rem;
        margin: -0.5rem;
        border-radius: 0.375rem;
        transition: all 0.2s ease;
    }

    a[href^="tel:"]:hover,
    a[href^="tel:"]:focus {
        background-color: rgba(0, 212, 255, 0.1);
        outline: 2px solid rgba(0, 212, 255, 0.3);
        outline-offset: 2px;
    }

    /* Focus Visible Improvements */
    button:focus-visible,
    a:focus-visible,
    input:focus-visible,
    textarea:focus-visible,
    select:focus-visible {
        outline: 2px solid var(--isa-cyan, #00D4FF);
        outline-offset: 2px;
        border-radius: 4px;
    }

    /* CTA Consolidation - Hide Secondary CTAs on Mobile */
    .hero .secondary-cta {
        display: none !important;
    }

    .hero .cta-group .cta:nth-child(n+2) {
        display: none !important;
    }
}

/* Ensure mobile menu works with inline styles */
@media (max-width: 768px) {
    /* Hide any duplicate hamburger elements */
    .hamburger,
    #hamburger,
    button.hamburger {
        display: none !important;
    }

    /* Only show our styled mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
    }

    /* Hide desktop navigation on mobile */
    .hidden.md\\:flex,
    nav .hidden.md\\:flex,
    .desktop-nav {
        display: none !important;
    }

    /* Mobile menu initial state - use visibility */
    #mobileMenu:not(.active) {
        display: block !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    #mobileMenu.active {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure header has proper height */
    #header,
    header {
        height: 60px !important;
        max-height: 60px !important;
    }

    /* Ensure proper spacing for header content */
    nav {
        height: 100%;
        display: flex;
        align-items: center;
    }

    /* Show mobile menu button even with md:hidden class */
    .mobile-menu-btn.md\\:hidden {
        display: flex !important;
    }
}