/* Custom Styles that extend Tailwind */

/* CRITICAL: Prevent horizontal scrolling on mobile (for Wix embed) */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
}

/* Ensure all sections don't overflow */
section, header, footer, main, nav, div {
    max-width: 100%;
}

/* Fix any elements that might cause overflow */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
    .max-w-7xl, .max-w-6xl, .max-w-5xl, .max-w-4xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Prevent text from causing overflow */
    h1, h2, h3, h4, h5, h6, p, span, a {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Fix grid layouts on mobile */
    .grid {
        width: 100%;
    }
}

/* Triangle for chat bubble */
.triangle-bottom-right::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    border-width: 10px 10px 0;
    border-style: solid;
    border-color: #FFFFFF transparent;
    display: block;
    width: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px; /* For horizontal scroll */
}

::-webkit-scrollbar-track {
    background: #fbfbf4;
}

::-webkit-scrollbar-thumb {
    background: #ab9478;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #567b84;
}

/* Chatbot Specific Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #f9f9f9;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #d4d4d4;
    border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #ab9478;
}

/* Hide Scrollbar for Horizontal Chips */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Animation Utilities - REFINED */

/* 1. Reveal on Scroll (Base Class) */
body.animations-enabled .reveal-on-scroll,
body.animations-enabled .fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.5, 0, 0, 1), transform 0.8s cubic-bezier(0.5, 0, 0, 1);
}

body.animations-enabled .reveal-on-scroll.is-visible,
body.animations-enabled .fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

body.animations-enabled .fade-in-up.is-visible {
    animation: fadeInUp 0.8s ease-out forwards;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 2. Chat Bubble Pulse */
@keyframes blob-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(171, 148, 120, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(171, 148, 120, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(171, 148, 120, 0);
    }
}

.animate-blob-pulse {
    animation: blob-pulse 2s infinite;
}

/* 3. Gold Shimmer Effect (for Buttons/Cards) */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.shimmer-gold {
    background: linear-gradient(
        90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.2) 50%, 
        rgba(255,255,255,0) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 3s infinite linear;
}

/* 4. Hover Lift (Cards) */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Legacy Fade In (Base State to ensure visibility without JS) */
.fade-in-up,
.reveal-on-scroll {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }

/* Range Slider Customization */
input[type=range] {
    -webkit-appearance: none; 
    width: 100%; 
    background: transparent; 
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ab9478;
    cursor: pointer;
    margin-top: -8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #e4e0d8;
    border-radius: 2px;
}

input[type=range]:focus {
    outline: none;
}

/* ============================================
   COMPREHENSIVE RESPONSIVE DESIGN SYSTEM
   Optimized for: Mobile, Tablet, Desktop, Large Screens
   ============================================ */

/* ---------- EXTRA SMALL DEVICES (320px - 479px) ---------- */
@media (max-width: 479px) {
    /* Typography scaling */
    h1 { font-size: 1.75rem !important; line-height: 1.2 !important; }
    h2 { font-size: 1.5rem !important; line-height: 1.3 !important; }
    h3 { font-size: 1.25rem !important; }
    h4 { font-size: 1.1rem !important; }
    
    /* Container padding */
    .container, .max-w-7xl, .max-w-6xl, .max-w-5xl, .max-w-4xl, .max-w-3xl {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Section spacing */
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Button sizing */
    .btn, button, a[class*="bg-brand"], a[class*="px-"] {
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
    }
    
    /* Grid to single column */
    .grid-cols-2, .grid-cols-3, .grid-cols-4, 
    .md\:grid-cols-2, .md\:grid-cols-3, .md\:grid-cols-4,
    .lg\:grid-cols-2, .lg\:grid-cols-3, .lg\:grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Flex wrap on mobile */
    .flex {
        flex-wrap: wrap;
    }
    
    /* Card padding reduction */
    [class*="p-6"], [class*="p-8"], [class*="p-10"], [class*="p-12"] {
        padding: 1rem !important;
    }
    
    /* Image galleries */
    .gallery-thumbnails, .thumbnail-row {
        gap: 0.25rem !important;
    }
    
    .gallery-thumbnails img, .thumbnail-row img {
        width: 40px !important;
        height: 40px !important;
    }
    
    /* Pricing cards */
    .pricing-card {
        padding: 1rem !important;
    }
    
    /* Hide decorative elements on very small screens */
    .absolute.-top-4, .absolute.-bottom-6, .absolute.-right-6 {
        display: none !important;
    }
}

/* ---------- SMALL DEVICES / MOBILE (480px - 639px) ---------- */
@media (min-width: 480px) and (max-width: 639px) {
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.625rem !important; }
    h3 { font-size: 1.375rem !important; }
    
    .container, .max-w-7xl, .max-w-6xl, .max-w-5xl {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    section {
        padding-top: 2.5rem !important;
        padding-bottom: 2.5rem !important;
    }
    
    .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr !important;
    }
    
    .gallery-thumbnails img, .thumbnail-row img {
        width: 50px !important;
        height: 50px !important;
    }
}

/* ---------- TABLET PORTRAIT (640px - 767px) ---------- */
@media (min-width: 640px) and (max-width: 767px) {
    h1 { font-size: 2.25rem !important; }
    h2 { font-size: 1.75rem !important; }
    
    .container, .max-w-7xl, .max-w-6xl {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    section {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    /* Two column grids become single on tablet portrait */
    .grid-cols-3, .grid-cols-4, .lg\:grid-cols-3, .lg\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .gallery-thumbnails img, .thumbnail-row img {
        width: 60px !important;
        height: 60px !important;
    }
}

/* ---------- TABLET LANDSCAPE (768px - 1023px) ---------- */
@media (min-width: 768px) and (max-width: 1023px) {
    h1 { font-size: 2.5rem !important; }
    h2 { font-size: 2rem !important; }
    
    .container, .max-w-7xl, .max-w-6xl {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
    
    section {
        padding-top: 4rem !important;
        padding-bottom: 4rem !important;
    }
    
    /* Three column grids */
    .grid-cols-4, .lg\:grid-cols-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    /* Plan page layout - stack on tablet */
    .lg\:grid-cols-5 {
        grid-template-columns: 1fr !important;
    }
    
    .lg\:col-span-3, .lg\:col-span-2 {
        grid-column: span 1 !important;
    }
    
    .gallery-thumbnails img, .thumbnail-row img {
        width: 70px !important;
        height: 70px !important;
    }
}

/* ---------- SMALL DESKTOP (1024px - 1279px) ---------- */
@media (min-width: 1024px) and (max-width: 1279px) {
    .container, .max-w-7xl {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
    
    .gallery-thumbnails img, .thumbnail-row img {
        width: 80px !important;
        height: 80px !important;
    }
}

/* ---------- LARGE DESKTOP (1280px - 1535px) ---------- */
@media (min-width: 1280px) and (max-width: 1535px) {
    .max-w-7xl {
        max-width: 1200px !important;
    }
}

/* ---------- EXTRA LARGE / 4K (1536px+) ---------- */
@media (min-width: 1536px) {
    html {
        font-size: 18px;
    }
    
    .max-w-7xl {
        max-width: 1400px !important;
    }
    
    h1 { font-size: 3.5rem !important; }
    h2 { font-size: 2.75rem !important; }
}

/* ============================================
   COMPONENT-SPECIFIC RESPONSIVE FIXES
   ============================================ */

/* Navigation Header Responsive */
@media (max-width: 1023px) {
    .mm-nav-inner {
        padding: 0 1rem !important;
    }
    
    .mm-logo-text {
        font-size: 1rem !important;
    }
    
    .mm-logo-tagline {
        font-size: 0.5rem !important;
    }
}

/* Hero Section Responsive */
@media (max-width: 767px) {
    .hero-section, [class*="hero"] {
        min-height: auto !important;
        padding: 3rem 1rem !important;
    }
    
    .hero-section h1 {
        font-size: 1.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-section p {
        font-size: 1rem !important;
    }
}

/* Pricing Cards Responsive */
@media (max-width: 767px) {
    .pricing-grid, [class*="pricing"] .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    .pricing-card, [class*="pricing"] > div {
        padding: 1.5rem !important;
    }
    
    .pricing-card h3 {
        font-size: 1.25rem !important;
    }
    
    .pricing-card .price, [class*="text-4xl"] {
        font-size: 2rem !important;
    }
}

/* Feature Cards Responsive */
@media (max-width: 767px) {
    .feature-card, [class*="feature"] {
        padding: 1.25rem !important;
    }
    
    .feature-icon, [class*="feature"] i {
        font-size: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Plan Detail Pages Responsive */
@media (max-width: 1023px) {
    /* Stack gallery and info vertically */
    .plan-layout, .lg\:grid-cols-5 {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }
    
    /* Main image */
    .plan-main-image, .main-image-container {
        width: 100% !important;
        max-height: 400px !important;
    }
    
    .plan-main-image img {
        object-fit: contain !important;
        max-height: 350px !important;
    }
    
    /* Thumbnails in row */
    .thumbnail-gallery, .gallery-thumbnails {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.5rem !important;
    }
}

/* Testimonials Responsive */
@media (max-width: 767px) {
    .testimonial-card {
        padding: 1.5rem !important;
    }
    
    .testimonial-card blockquote {
        font-size: 0.9375rem !important;
        line-height: 1.6 !important;
    }
    
    .testimonial-avatar {
        width: 48px !important;
        height: 48px !important;
    }
}

/* Footer Responsive */
@media (max-width: 767px) {
    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
        text-align: center !important;
    }
    
    footer .social-links {
        justify-content: center !important;
    }
}

/* Hub Page Responsive */
@media (max-width: 767px) {
    .hub-sidebar {
        display: none !important;
    }
    
    .hub-main {
        width: 100% !important;
    }
    
    .hub-cards .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Quiz Page Responsive */
@media (max-width: 639px) {
    .quiz-container {
        padding: 1rem !important;
    }
    
    .quiz-option {
        padding: 0.875rem !important;
        font-size: 0.9375rem !important;
    }
    
    .quiz-progress {
        height: 6px !important;
    }
}

/* ============================================
   SAFE AREA & NOTCH SUPPORT (iOS)
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    nav, footer, .chat-widget, .mobile-menu, button {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1 { font-size: 24pt; }
    h2 { font-size: 18pt; }
    h3 { font-size: 14pt; }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible styles */
:focus-visible {
    outline: 2px solid #3E5C65;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-brand-accent {
        background-color: #f0f0f0 !important;
    }
    
    .text-brand-charcoal\/70 {
        color: #333 !important;
    }
}
