/* ============================================================
   DARK THEME + PREMIUM ANIMATIONS
   Pagadian Tourism Portal — Phenomenal Edition
   ============================================================ */

/* ── Dark Theme Variables ── */
[data-theme="dark"] {
    --color-gray-50:  #0f1419;
    --color-gray-100: #161b22;
    --color-gray-200: #21262d;

    /* Tip card backgrounds for detail pages */
    --tip-bg: #1c2128;
    --tip-bg-danger: #2d1418;
    --tip-bg-purple: #1e1631;
    --color-gray-300: #30363d;
    --color-gray-400: #484f58;
    --color-gray-500: #6e7681;
    --color-gray-600: #8b949e;
    --color-gray-700: #c9d1d9;
    --color-gray-800: #e6edf3;
    --color-gray-900: #f0f6fc;
    --color-white: #0d1117;
    --color-black: #f0f6fc;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.5);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 30px rgba(213,66,21,0.25);
}

[data-theme="dark"] body {
    background: #0d1117;
    color: #c9d1d9;
}

[data-theme="dark"] .card,
[data-theme="dark"] .trail-card {
    background: #161b22;
    border: 1px solid #21262d;
    color: #c9d1d9;
}

[data-theme="dark"] .card:hover,
[data-theme="dark"] .trail-card:hover {
    border-color: #30363d;
    box-shadow: 0 8px 24px rgba(213,66,21,0.12);
}

[data-theme="dark"] h1, [data-theme="dark"] h2,
[data-theme="dark"] h3, [data-theme="dark"] h4 {
    color: #f0f6fc;
}

[data-theme="dark"] .section { background: #0d1117; }
[data-theme="dark"] .safety-section,
[data-theme="dark"] .trails-section { background: #161b22; }
[data-theme="dark"] .map-cta-section { background: #161b22; }

[data-theme="dark"] .safety-link-card {
    background: #21262d;
    color: #c9d1d9;
}
[data-theme="dark"] .safety-link-card:hover {
    background: #161b22;
    color: #c9d1d9;
}

[data-theme="dark"] .advisories-banner { background: #161b22; }

[data-theme="dark"] .card-body h3 a { color: #f0f6fc; }
[data-theme="dark"] .text-muted { color: #8b949e !important; }

[data-theme="dark"] .hero-wave svg path {
    fill: #0d1117;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(13,17,23,0.85);
    backdrop-filter: blur(12px);
    color: #fbbf24;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.theme-toggle:hover {
    transform: scale(1.12) rotate(15deg);
    box-shadow: 0 8px 30px rgba(251,191,36,0.3);
    border-color: rgba(251,191,36,0.4);
}
[data-theme="dark"] .theme-toggle {
    background: rgba(255,255,255,0.1);
    color: #fbbf24;
}

/* ============================================================
   PREMIUM ANIMATIONS
   ============================================================ */

/* ── Reveal on Scroll ── */
/* Reveal — only apply to elements NOT inside the hero (hero has its own animations) */
.reveal:not(.hero .reveal):not(.hero-content .reveal) {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
    opacity: 1;
    transform: translateY(0);
}
/* Hero children should be visible via their own CSS animations */
.hero .reveal {
    opacity: 1;
    transform: none;
}

/* Staggered reveal */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 100ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 200ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 300ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 400ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 500ms; }

/* ── Hero Entrance Animations ── */
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroTitleReveal {
    0%   { opacity: 0; transform: translateY(50px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes heroBadgeDrop {
    0%   { opacity: 0; transform: translateY(-20px) scale(0.8); }
    60%  { transform: translateY(4px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-8px); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(213,66,21,0.4); }
    50%      { box-shadow: 0 0 20px 8px rgba(213,66,21,0.15); }
}

@keyframes gradient-shift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes kenburns {
    0%   { transform: scale(1.03); }
    50%  { transform: scale(1.08) translate(-1%, -0.5%); }
    100% { transform: scale(1.03); }
}

/* Apply Ken Burns to hero background */
.hero-bg::before {
    animation: kenburns 25s ease-in-out infinite;
}

/* Hero content entrance */
.hero .hero-badge {
    animation: heroBadgeDrop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}
.hero .hero-title {
    animation: heroTitleReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}
.hero .hero-kicker {
    animation: heroTitleReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.55s both;
}
.hero .hero-subtitle {
    animation: heroFadeIn 0.8s ease-out 0.7s both;
}
.hero .hero-actions {
    animation: heroFadeIn 0.8s ease-out 0.85s both;
}
.hero .hero-stats {
    animation: heroFadeIn 0.8s ease-out 1s both;
}

/* ── Card Hover Effects ── */
.card {
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.card-image img {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.card:hover .card-image img {
    transform: scale(1.08);
}

/* ── Button Animations ── */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}
.btn:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover,
.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(213,66,21,0.3);
}

/* ── Stat Counter Animation ── */
.hero-stat-value {
    font-variant-numeric: tabular-nums;
}

/* ── Floating particles ── */
.hero-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}
.hero-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0%   { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ── Smooth scroll indicator ── */
.scroll-indicator {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: float 2s ease-in-out infinite;
}
.scroll-indicator-dot {
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: 12px;
    position: relative;
}
.scroll-indicator-dot::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: rgba(255,255,255,0.6);
    border-radius: 2px;
    animation: scrollDot 1.5s ease-in-out infinite;
}
@keyframes scrollDot {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
    50%      { transform: translateX(-50%) translateY(12px); opacity: 0.3; }
}

/* ── Section transition overlaps ── */
.section {
    position: relative;
}

/* ── Card badge animation ── */
.card .badge {
    transition: transform 0.3s ease;
}
.card:hover .badge {
    transform: scale(1.05);
}

/* ── Link arrow animation ── */
.btn-sm .fa-arrow-right,
.btn-ghost .fa-arrow-right {
    transition: transform 0.3s ease;
}
.btn-sm:hover .fa-arrow-right,
.btn-ghost:hover .fa-arrow-right,
a:hover > .fa-arrow-right {
    transform: translateX(4px);
}

/* ── Advisory chip animation ── */
.advisory-chip {
    animation: slideInRight 0.5s ease-out both;
}
.advisory-chip:nth-child(1) { animation-delay: 0.1s; }
.advisory-chip:nth-child(2) { animation-delay: 0.2s; }
.advisory-chip:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Map CTA glow ── */
.map-cta-card {
    position: relative;
}
.map-cta-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, #D54215, #7C3AED, #D54215);
    background-size: 200% 200%;
    border-radius: calc(var(--radius-2xl) + 2px);
    z-index: -1;
    animation: gradient-shift 4s ease infinite;
    opacity: 0.6;
    filter: blur(8px);
}

/* ── Trail card icon animation ── */
.trail-icon {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.trail-card:hover .trail-icon {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ── Navbar blur on scroll ── */
.site-header.scrolled {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px) saturate(1.8);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
[data-theme="dark"] .site-header.scrolled {
    background: rgba(13,17,23,0.92);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ── Dark theme nav ── */
[data-theme="dark"] .site-header {
    background: #0d1117;
    border-bottom-color: #21262d;
}
[data-theme="dark"] .site-header .nav-link {
    color: #c9d1d9;
}
[data-theme="dark"] .site-header .site-logo-text h1 {
    color: #f0f6fc;
}
[data-theme="dark"] .site-header .site-logo-text small {
    color: #8b949e;
}

/* ── Dark theme footer ── */
[data-theme="dark"] .site-footer {
    background: #010409;
    border-top-color: #21262d;
}

/* ── Loading skeleton shimmer ── */
.skeleton {
    background: linear-gradient(90deg,
        var(--color-gray-200) 25%,
        var(--color-gray-100) 50%,
        var(--color-gray-200) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Page transitions ── */
.page-transition-enter {
    opacity: 0;
    transform: translateY(10px);
}
.page-transition-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s ease;
}

/* ── Responsive animation adjustments ── */
@media (max-width: 768px) {
    .scroll-indicator { display: none; }
    .hero-particle { display: none; }

    .card:hover {
        transform: translateY(-4px);
    }
}

/* ============================================================
   DARK MODE — DETAIL PAGE CONTRAST FIXES
   ============================================================ */

/* ============================================================
   TIP CARDS — Light + Dark mode
   Used on site detail pages (Best Time, How to Get There, etc.)
   ============================================================ */
.tip-card {
    border-left: 4px solid var(--color-ocean);
    line-height: 1.8;
}
.tip-card--info {
    background: #f9f9f9;
    border-left-color: var(--color-ocean);
}
.tip-card--danger {
    background: #fff3f3;
    border-left-color: #F44336;
}
.tip-card--purple {
    background: #f5f3ff;
    border-left-color: #9B5DE5;
}
.tip-card p { color: #333; }

/* Dark mode tip cards */
[data-theme="dark"] .tip-card--info {
    background: #1a1e24 !important;
    border-left-color: #fb923c !important;
}
[data-theme="dark"] .tip-card--danger {
    background: #2a1215 !important;
    border-left-color: #ef4444 !important;
}
[data-theme="dark"] .tip-card--purple {
    background: #1e1631 !important;
    border-left-color: #a78bfa !important;
}
[data-theme="dark"] .tip-card p,
[data-theme="dark"] .tip-card .card-body p {
    color: #e6edf3 !important;
}

/* ── Force all text readable in dark mode ── */
[data-theme="dark"] [style*="color: #444"],
[data-theme="dark"] [style*="color: #555"],
[data-theme="dark"] [style*="color: #666"] {
    color: #c9d1d9 !important;
}
[data-theme="dark"] [style*="color: #999"] {
    color: #8b949e !important;
}

/* Activity cards, gallery, borders */
[data-theme="dark"] [style*="border: 1px solid #e0e0e0"] {
    border-color: #30363d !important;
}
[data-theme="dark"] [style*="background: #f0f0f0"] {
    background: #21262d !important;
}

/* Detail page text */
[data-theme="dark"] .card-body p {
    color: #c9d1d9;
}
[data-theme="dark"] section.mb-5 > p,
[data-theme="dark"] section.mb-5 .card-body p {
    color: #c9d1d9 !important;
}

/* Quick Facts sidebar */
[data-theme="dark"] .card-body strong,
[data-theme="dark"] .card-body h3,
[data-theme="dark"] .card-body h4 {
    color: #f0f6fc;
}

/* Card subtitle in detail */
[data-theme="dark"] .card-subtitle {
    color: #8b949e !important;
}

/* About section description text */
[data-theme="dark"] .mb-5 p {
    color: #c9d1d9;
}

/* Map embed area */
[data-theme="dark"] [style*="border-top: 4px solid"] {
    border-color: var(--color-ocean) !important;
}

/* Nearby sites cards */
[data-theme="dark"] .card-text {
    color: #c9d1d9;
}

/* Sites listing card body fix */
[data-theme="dark"] .card-body {
    color: #c9d1d9;
}

/* Accommodations page */
[data-theme="dark"] .card-footer {
    border-top-color: #21262d;
}

/* Events page cards */
[data-theme="dark"] .event-date-badge {
    background: #2d1a0e;
    color: #fb923c;
}

/* Contact/forms */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: #161b22;
    border-color: #30363d;
    color: #c9d1d9;
}

/* Breadcrumb */
[data-theme="dark"] .breadcrumb a {
    color: #8b949e;
}

/* Filter buttons */
[data-theme="dark"] .btn-outline {
    border-color: #30363d;
    color: #c9d1d9;
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .hero-bg::before { animation: none; }
    .hero .hero-badge,
    .hero .hero-title,
    .hero .hero-kicker,
    .hero .hero-subtitle,
    .hero .hero-actions,
    .hero .hero-stats { animation: none; opacity: 1; }
    .hero-particle { display: none; }
    .advisory-chip { animation: none; opacity: 1; }
}
