/* Note: Most styling is handled by Tailwind CSS classes in the HTML file.
    This file is for custom styles and animations that are not part of Tailwind. */

html, body {
    margin: 0; /* Remove default margin */
    font-family: 'Poppins', sans-serif;
    background-color: #f1f5f9; /* Replicates bg-slate-100 from body tag */
}

#chat-messages::-webkit-scrollbar,
#photo-gallery::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track,
#photo-gallery::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

#chat-messages::-webkit-scrollbar-thumb,
#photo-gallery::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover,
#photo-gallery::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

.message-bubble {
    max-width: 80%;
    word-wrap: break-word;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

#home-bg {
    /* Background set dynamically by home-dynamic-bg.js */
    /* Fallback gradient if JS fails */
    background: linear-gradient(180deg, #0ea5e9 0%, #38bdf8 40%, #7dd3fc 70%, #e0f2fe 100%);
}

/* --- Home Screen Responsive Buttons --- */
#home-button-container {
    /* Remove all positioning - let flexbox handle it */
    filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0 4px 3px rgba(0, 0, 0, 0.1));
}

/* Remove triangle background styles - no longer needed */
#home-triangle-bg {
    display: none !important; /* Hide the triangle background */
}

/* Home Button Base Styles */
.home-button-base {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 4px solid #f8fafc;
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.2),
        0 4px 8px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(255, 255, 255, 0.3),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
}

.home-button-base:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.25),
        0 6px 12px rgba(0, 0, 0, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.home-button-base:active {
    transform: translateY(1px);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 -1px 2px rgba(255, 255, 255, 0.2);
}

/* SOS Button - Rounded Rectangle (15% bigger than others) */
.sos-button {
    width: 80px;
    height: 64px;
    border-radius: 12px;
    background: linear-gradient(145deg, #f87171, #dc2626);
    border-width: 3px;
}

.sos-button:hover {
    background: linear-gradient(145deg, #ef4444, #b91c1c);
}

/* Live Journey Button - Rounded Rectangle */
.share-button {
    width: 70px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(45deg, #3b82f6, #1d4ed8, #3b82f6);
    background-size: 200% 200%;
}

.share-button:hover {
    background: linear-gradient(45deg, #2563eb, #1e40af, #2563eb);
    background-size: 200% 200%;
}

/* Sound Scape Button - Rounded Rectangle */
.soundscape-button {
    width: 70px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(45deg, #4ade80, #16a34a, #4ade80);
    background-size: 200% 200%;
}

.soundscape-button:hover {
    background: linear-gradient(45deg, #22c55e, #15803d, #22c55e);
    background-size: 200% 200%;
}

/* Button container positioning */
#home-button-container {
    margin-top: auto;
    padding-bottom: env(safe-area-inset-bottom, 8px);
}

/* Responsive Button Sizes */
@media (min-width: 375px) {
    /* Slightly larger phones */
    .sos-button {
        width: 90px;
        height: 72px;
    }
    .share-button, .soundscape-button {
        width: 78px;
        height: 62px;
    }
}

@media (min-width: 640px) {
    /* Small screens and up */
    .sos-button {
        width: 110px;
        height: 88px;
        border-radius: 14px;
    }

    .share-button, .soundscape-button {
        width: 95px;
        height: 76px;
        border-radius: 12px;
    }
}

@media (min-width: 768px) {
    /* Medium screens and up */
    .sos-button {
        width: 130px;
        height: 104px;
        border-radius: 16px;
        border-width: 4px;
    }

    .share-button, .soundscape-button {
        width: 112px;
        height: 90px;
        border-radius: 14px;
    }
}

@media (min-width: 1024px) {
    /* Large screens and up */
    .sos-button {
        width: 150px;
        height: 120px;
        border-radius: 18px;
        border-width: 4px;
    }

    .share-button, .soundscape-button {
        width: 130px;
        height: 105px;
        border-radius: 16px;
    }
}

/* Wave Animation for Share and Sound buttons - Color gradient wave */
.wave-animation {
    animation: colorWave 3s ease-in-out infinite;
}

@keyframes colorWave {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Responsive adjustments for button icons */
@media (min-width: 640px) {
    .home-button-base svg {
        width: 1.75rem;
        height: 1.75rem;
    }
}

@media (min-width: 768px) {
    .home-button-base svg {
        width: 2rem;
        height: 2rem;
    }
}

.gradient-button {
    background-image: linear-gradient(to right, #0ea5e9, #6366f1, #2563eb);
    animation: gradient-animation 3s ease infinite;
    background-size: 200% 200%;
}

@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* AdSense container should span the available width so Google can size the slot */
#adsense-container {
    width: 100%;
}


.main-nav {
    /* Provide a base padding and add the safe-area inset, which is 0 on desktop */
    padding-bottom: env(safe-area-inset-bottom);
}

/* Native iOS shell (WKWebView) already accounts for bottom safe area.
   Remove extra CSS padding to avoid double-spacing below the nav. */
.ios-native .main-nav { padding-bottom: 0 !important; }


/* Native iOS: extend full-bleed backgrounds into the top safe area */
.ios-native #home-bg { top: calc(env(safe-area-inset-top) * -1) !important; }
.ios-native #home-logo-underlay {
  top: calc(env(safe-area-inset-top) * -1) !important;
  height: calc(12rem + env(safe-area-inset-top)) !important; /* h-48 plus notch */
}

/* iOS native: push home logo down to clear Dynamic Island */
.ios-native #home-logo {
  margin-top: calc(env(safe-area-inset-top, 0px) + 0.5rem) !important;
}

/* Adjust header/title and How to Use spacing on Trip / Activities / Journeys to avoid camera hole overlap */
.trip-planner-header h1,
.activities-header h1,
.journey-header h1 {
    padding-top: calc(env(safe-area-inset-top) + 0.75rem); /* push title down a bit below notch */
}
.trip-planner-header h5,
.activities-header h5,
.journey-header h5 {
    margin-top: 0.1rem;           /* pull How to Use closer to title */
    margin-bottom: 0.4rem;        /* slightly reduce bottom space */
}



/* Codex specific safe area handling */
#codex-screen {
    /* Default: respect safe-area inset like other screens */
    padding-top: 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    background-color: white;
}


/* iPhone (iOS) only: remove extra top gap on Journeys */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 480px) {
    #codex-screen { padding-top: 0; }
  }
}

/* Header background styles for different screens */
.header-with-bg {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.header-with-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(14, 165, 233, 0.4));
    z-index: 1;
}

.header-with-bg > * {
    position: relative;
    z-index: 2;
}

/* Consistent background image for all screen headers */
.trip-planner-header,
.activities-header,
.journey-header,
.info-header {
    background-image: url('./assets/heading-background.jpg');
    min-height: 120px;
}

/* Text styling for headers with backgrounds */
.header-with-bg h1 {
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    font-weight: 600;
    font-family: 'Fredoka', 'Poppins', sans-serif;
    letter-spacing: 0.5px;
}

.header-with-bg h5 a {
    color: #7dd3fc !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.header-with-bg h5 a:hover {
    color: #38bdf8 !important;
}

#codex-root {
    /* Full height within the scrollable content area */
    height: 100%;
}

/* Mobile-specific improvements for codex */
@media (max-width: 768px) {
    #codex-root {
        /* Reduce bottom padding to eliminate white space above nav */
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
}