/**
 * Diving Mirissa - Custom Styles
 * Ocean-themed CSS for diving tourism website
 * FIXED: Mobile menu z-index, instant icon loading, SVG fallbacks
 */

/* =====================================================
   Base Styles
   ===================================================== */

:root {
    --ocean-deep: #003366;
    --ocean-medium: #0066CC;
    --ocean-light: #00BFFF;
    --ocean-turquoise: #40E0D0;
    --coral: #f97316;
    --seafoam: #5eead4;
    --sand: #fef3c7;
    --dark-navy: #0D1B2A;
    --whatsapp-green: #25D366;
}

* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Selection styling */
::selection {
    background-color: var(--ocean-turquoise);
    color: white;
}

/* =====================================================
   Header & Navigation
   ===================================================== */

#mainHeader {
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.95) 0%, rgba(13, 27, 42, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* Transparent header for pages with hero sections */
#mainHeader.header-transparent {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#mainHeader.header-scrolled,
#mainHeader.header-transparent.header-scrolled {
    background: linear-gradient(135deg, rgba(0, 51, 102, 0.98) 0%, rgba(13, 27, 42, 0.98) 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mainHeader.header-scrolled #mainNav {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Navigation links */
.nav-link {
    color: white;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--ocean-turquoise);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.text-ocean-turquoise::after {
    width: 60%;
}

/* Desktop dropdown menu animation */
.group:hover .group-hover\:opacity-100 {
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translate(-50%, -10px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* =====================================================
   Mobile Menu Button - INSTANT VISIBILITY
   ===================================================== */

.mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Hide mobile menu button on desktop (1024px and above) */
@media (min-width: 1024px) {
    .mobile-menu-btn,
    .mobile-menu-btn.mobile-menu-btn {
        display: none !important;
        visibility: hidden !important;
    }
}

/* =====================================================
   Hamburger Icon - INSTANT VISIBILITY
   ===================================================== */

.hamburger-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    position: relative;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2.5px;
    background-color: white;
    border-radius: 2px;
    position: absolute;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.hamburger-line-1 {
    top: 5px;
}

.hamburger-line-2 {
    top: 50%;
    transform: translateY(-50%);
}

.hamburger-line-3 {
    bottom: 5px;
}

/* Hamburger to X animation */
.menu-open .hamburger-line-1 {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.menu-open .hamburger-line-2 {
    opacity: 0 !important;
    transform: translateX(10px);
}

.menu-open .hamburger-line-3 {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

/* =====================================================
   MOBILE MENU OVERLAY - CRITICAL FIX
   ===================================================== */

.mobile-menu-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998 !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-menu-overlay.visible,
.mobile-menu-overlay.opacity-100 {
    opacity: 1 !important;
    visibility: visible !important;
}

/* =====================================================
   MOBILE MENU PANEL - CRITICAL FIX
   ===================================================== */

.mobile-menu {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 85vw !important;
    height: 100% !important;
    height: 100vh !important;
    height: 100dvh;
    background: linear-gradient(to bottom, var(--ocean-deep), var(--dark-navy)) !important;
    z-index: 9999 !important;
    transform: translateX(100%);
    transition: transform 0.3s ease-out !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    overscroll-behavior: contain;
}

.mobile-menu.translate-x-0 {
    transform: translateX(0) !important;
}

.mobile-menu.translate-x-full {
    transform: translateX(100%) !important;
}

/* Mobile Menu Content Wrapper */
.mobile-menu > div {
    padding-top: 80px !important;
    padding-bottom: 100px !important;
    min-height: 100%;
}

/* Mobile menu scrollbar */
.mobile-menu::-webkit-scrollbar {
    width: 4px;
}

.mobile-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.mobile-menu::-webkit-scrollbar-thumb {
    background: rgba(64, 224, 208, 0.5);
    border-radius: 2px;
}

/* =====================================================
   Mobile Navigation Links
   ===================================================== */

.mobile-nav-link {
    display: flex !important;
    align-items: center;
    padding: 12px 16px;
    color: white;
    font-weight: 500;
    border-radius: 12px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--ocean-turquoise);
}

.mobile-nav-link.text-ocean-turquoise {
    color: var(--ocean-turquoise);
}

/* =====================================================
   Mobile Dropdown Menu
   ===================================================== */

.mobile-dropdown {
    margin-bottom: 4px;
}

.mobile-dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    color: white;
    font-weight: 500;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-dropdown-toggle:hover,
.mobile-dropdown-toggle:active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--ocean-turquoise);
}

.mobile-dropdown-content {
    padding-left: 24px;
    margin-top: 4px;
    animation: slideDown 0.3s ease;
}

.mobile-dropdown-content a {
    display: block;
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.mobile-dropdown-content a:hover,
.mobile-dropdown-content a:active {
    color: var(--ocean-turquoise);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Mobile dropdown animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   Body Scroll Lock - When Menu is Open
   ===================================================== */

body.menu-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* =====================================================
   iOS Safari & Notched Device Fixes
   ===================================================== */

@supports (-webkit-touch-callout: none) {
    .mobile-menu {
        height: -webkit-fill-available !important;
    }
    
    .mobile-menu-overlay {
        height: -webkit-fill-available !important;
    }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-menu > div {
        padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important;
    }
}

/* =====================================================
   Mobile Menu Responsive Rules
   ===================================================== */

@media (max-width: 1023px) {
    .mobile-menu,
    .mobile-menu-overlay {
        display: block !important;
    }
}

@media (min-width: 1024px) {
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
        visibility: hidden !important;
    }

    /* Desktop Navigation - Force show on desktop */
    .hidden.lg\:flex {
        display: flex !important;
    }
}

/* =====================================================
   WhatsApp Floating Button - INSTANT VISIBILITY
   ===================================================== */

.whatsapp-float {
    position: fixed !important;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    visibility: visible !important;
    opacity: 1 !important;
}

.whatsapp-float-inner {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
    visibility: visible !important;
    opacity: 1 !important;
}

.whatsapp-float:hover .whatsapp-float-inner {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.5);
}

.whatsapp-float-pulse {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(37, 211, 102, 0.4);
    border-radius: 50%;
    animation: whatsappPulse 2s ease-out infinite;
    z-index: 1;
}

@keyframes whatsappPulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* WhatsApp SVG Fallback Icon */
.whatsapp-svg-fallback {
    width: 32px;
    height: 32px;
    fill: currentColor;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Hide SVG when Font Awesome loads */
.fab.fa-whatsapp:not(:empty) ~ .whatsapp-svg-fallback,
.whatsapp-float-inner .fa-whatsapp + .whatsapp-svg-fallback {
    display: none !important;
}

/* WhatsApp button responsive */
@media (max-width: 768px) {
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }

    .whatsapp-float-inner,
    .whatsapp-float-pulse {
        width: 56px;
        height: 56px;
    }

    .whatsapp-float-inner {
        font-size: 28px;
    }
    
    .whatsapp-svg-fallback {
        width: 28px;
        height: 28px;
    }
}

/* =====================================================
   Bubble Animation
   ===================================================== */

.bubble-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    bottom: -20px;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(0,191,255,0.4));
    border-radius: 50%;
    animation: rise linear infinite;
    opacity: 0;
}

@keyframes rise {
    0% {
        transform: translateY(0) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        opacity: 0.4;
    }
    90% {
        opacity: 0.2;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* =====================================================
   Wave Animation
   ===================================================== */

.wave-animation {
    position: relative;
    overflow: hidden;
}

.wave-animation::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath fill='%23ffffff' d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V120H0V95.8C57.11,118.43,107.06,72.76,153.13,67.37,195.65,62.65,238,75.87,321.39,56.44Z'%3E%3C/path%3E%3C/svg%3E");
    background-size: cover;
}

/* =====================================================
   Cards & Hover Effects
   ===================================================== */

.service-card {
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.service-card img {
    transition: transform 0.5s ease;
}

.service-card:hover img {
    transform: scale(1.1);
}

/* Image Overlay Effect */
.image-overlay {
    position: relative;
    overflow: hidden;
}

.image-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 51, 102, 0.8), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-overlay:hover::after {
    opacity: 1;
}

/* =====================================================
   Buttons
   ===================================================== */

.btn-primary {
    background: var(--ocean-turquoise);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--ocean-light);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(64, 224, 208, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-whatsapp:hover {
    background: #128C7E;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 211, 102, 0.3);
}

/* =====================================================
   Form Styles
   ===================================================== */

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--ocean-light);
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2);
}

input[type="checkbox"] {
    accent-color: var(--ocean-turquoise);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.5em;
    padding-right: 3rem;
}

/* =====================================================
   Testimonial Slider
   ===================================================== */

.testimonials-swiper .swiper-pagination-bullet {
    background: var(--ocean-medium);
    opacity: 0.5;
}

.testimonials-swiper .swiper-pagination-bullet-active {
    background: var(--ocean-turquoise);
    opacity: 1;
}

/* =====================================================
   Gallery
   ===================================================== */

.gallery-item {
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.goverlay {
    background: rgba(13, 27, 42, 0.95) !important;
}

.gclose {
    background: var(--ocean-turquoise) !important;
}

/* =====================================================
   FAQ Accordion
   ===================================================== */

.faq-toggle i {
    transition: transform 0.3s ease;
}

.faq-toggle.active i {
    transform: rotate(180deg);
}

.faq-content {
    transition: all 0.3s ease;
}

/* =====================================================
   Scroll Effects
   ===================================================== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(to right, var(--ocean-turquoise), var(--ocean-light));
    z-index: 9999;
}

/* =====================================================
   Loading States
   ===================================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

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

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =====================================================
   Notification Toast
   ===================================================== */

.notification-toast {
    z-index: 10000 !important;
}

/* =====================================================
   Responsive Adjustments
   ===================================================== */

@media (max-width: 768px) {
    .bubble {
        animation-duration: 6s !important;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }
}

/* =====================================================
   Print Styles
   ===================================================== */

@media print {
    #mainHeader,
    footer,
    .whatsapp-float,
    .mobile-menu,
    .mobile-menu-overlay {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    a[href]::after {
        content: " (" attr(href) ")";
    }
}

/* =====================================================
   Accessibility
   ===================================================== */

:focus-visible {
    outline: 2px solid var(--ocean-turquoise);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--ocean-deep);
    color: white;
    padding: 8px;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

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

    .whatsapp-float-pulse {
        display: none;
    }
    
    .mobile-menu {
        transition: none !important;
    }
    
    .mobile-menu-overlay {
        transition: none !important;
    }
}