/* 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: 'Inter', 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-image: url('../assets/mountain.webp');
}

/* --- 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: 100px; /* Mobile size */
    height: 80px;
    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: 85px; /* Mobile size */
    height: 68px;
    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: 85px; /* Mobile size */
    height: 68px;
    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%;
}

/* Responsive Button Sizes */
@media (min-width: 640px) {
    /* Small screens and up */
    .sos-button {
        width: 120px;
        height: 95px;
        border-radius: 14px;
        border-width: 3px;
    }

    .share-button, .soundscape-button {
        width: 100px;
        height: 80px;
        border-radius: 10px;
    }
}

@media (min-width: 768px) {
    /* Medium screens and up */
    .sos-button {
        width: 138px;
        height: 109px;
        border-radius: 16px;
        border-width: 4px;
    }

    .share-button, .soundscape-button {
        width: 120px;
        height: 95px;
        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 */
@media (min-width: 640px) {
    .sos-button {
        width: 110px;
        height: 110px;
    }

    .share-button,
    .soundscape-button {
        width: 120px;
        height: 95px;
    }

    .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: Add extra padding to logo to move it down slightly */
.ios-native #home-logo {
  margin-top: 3rem !important; /* ~3mm extra padding */
}

/* Add gradient overlay to logo */
#home-logo {
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3)) drop-shadow(0 0 40px rgba(236, 72, 153, 0.2));
}

/* Animated gradient for Dream Journal button */
@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.animate-gradient {
  animation: gradient-shift 3s ease infinite;
}

/* 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.3), rgba(14, 165, 233, 0.2));
    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,
.wellness-header,
.community-header,
.habit-tracker-header,
.habit-settings-header {
    background-image: url('./assets/heading-background.jpg');
    min-height: 120px;
}

/* Move journey back button down out of the notch area, closer to journey info tags */
.journey-header > button.absolute {
    top: auto !important;
    bottom: -2.5rem;
    left: 1rem;
}

@media (max-width: 768px) {
    .journey-header > button.absolute {
        bottom: -2.75rem;
    }
}

/* 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: 700;
}

/* Extra bottom padding so lowered back button doesn't overlap content */
.journey-header {
    padding-bottom: 2.5rem;
}

.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));
    }
}

/* Video container constraints for lesson media */
.aspect-video {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.aspect-video iframe,
.aspect-video video,
.aspect-video embed,
.aspect-video object {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* WordPress content styling for detail modals */
.wp-content {
    line-height: 1.6;
}

.wp-content p {
    margin-bottom: 1em;
}

.wp-content ul, .wp-content ol {
    margin-left: 1.5em;
    margin-bottom: 1em;
}

.wp-content li {
    margin-bottom: 0.25em;
}

.wp-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1em;
    font-size: 0.875rem;
}

.wp-content th, .wp-content td {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.wp-content th {
    background-color: #f1f5f9;
    font-weight: 600;
}

.wp-content tr:nth-child(even) {
    background-color: #f8fafc;
}

.wp-content a {
    color: #0ea5e9;
    text-decoration: underline;
}

.wp-content a:hover {
    color: #0284c7;
}

.wp-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5em 0;
}

.wp-content h1, .wp-content h2, .wp-content h3, .wp-content h4 {
    font-weight: 600;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.wp-content h1 { font-size: 1.5rem; }
.wp-content h2 { font-size: 1.25rem; }
.wp-content h3 { font-size: 1.125rem; }
.wp-content h4 { font-size: 1rem; }

.wp-content blockquote {
    border-left: 4px solid #e2e8f0;
    padding-left: 1em;
    margin: 1em 0;
    color: #64748b;
    font-style: italic;
}

.wp-content audio {
    width: 100%;
    max-width: 100%;
    margin: 1em 0;
    border-radius: 0.5rem;
    outline: none;
}

.wp-content audio:focus {
    outline: 2px solid #0ea5e9;
    outline-offset: 2px;
}

/* Make tables horizontally scrollable on mobile */
@media (max-width: 640px) {
    .wp-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}