/* CSS Variables for Theming */
:root {
    /* Light Mode Defaults */
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-text-main: #0F172A;
    --color-text-muted: #64748B;
    --color-border: rgba(0, 0, 0, 0.08);

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

    --nav-bg: rgba(255, 255, 255, 0.8);
}

.dark {
    /* Dark Mode Overrides */
    --color-bg: #050505;
    --color-surface: #0F0F0F;
    --color-text-main: #F8FAFC;
    --color-text-muted: #94a3b8;
    --color-border: rgba(255, 255, 255, 0.08);

    --glass-bg: rgba(5, 5, 5, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: none;

    --nav-bg: rgba(5, 5, 5, 0.7);
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glass Utilities */
.glass-nav {
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
}

.glass-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
}

/* Only apply hover effects on devices that support hover */
@media (hover: hover) {
    .glass-card:hover {
        border-color: rgba(16, 185, 129, 0.5);
        transform: translateY(-5px);
    }
}

.glass-card:active {
    border-color: rgba(16, 185, 129, 0.8);
    transform: scale(0.98);
}

/* 360 Viewer Overrides */
#panorama {
    width: 100%;
    height: 100%;
    background: #000;
}

.pnlm-load-box {
    display: none !important;
}

/* Custom Hotspots */
.hotspot-scene {
    width: 44px;
    height: 44px;
    background: rgba(16, 185, 129, 0.2);
    backdrop-filter: blur(4px);
    border: 2px solid #10B981;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

.hotspot-scene:hover {
    transform: scale(1.15);
    background: #10B981;
}

.hotspot-scene i {
    color: white;
    font-size: 18px;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Map Styles */
.leaflet-container {
    background: var(--color-surface);
    font-family: 'Plus Jakarta Sans';
}

.leaflet-popup-content-wrapper {
    background: var(--color-surface);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-radius: 12px;
}

.leaflet-popup-tip {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.custom-pin {
    transition: transform 0.3s;
}

.custom-pin:hover {
    transform: scale(1.2);
}

.dark .leaflet-layer {
    filter: brightness(0.7) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}

.dark .leaflet-container {
    background: #111;
}

.map-frame {
    border: 1px solid var(--color-border);
}

/* Chat Widget Styles */
.chat-widget-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 900;
    display: flex;
    flex-direction: column;
    align-items: end;
    gap: 16px;
    pointer-events: none;
}

.chat-window {
    width: 350px;
    height: 500px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

.chat-window.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.chat-header {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--color-bg);
}

.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 16px;
    position: relative;
    word-wrap: break-word;
}

.message-bubble.bot {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    color: var(--color-text-main);
}

.message-bubble.user {
    background: #10B981;
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Markdown Styling inside bubbles */
.message-bubble.bot p {
    margin-bottom: 8px;
}

.message-bubble.bot p:last-child {
    margin-bottom: 0;
}

.message-bubble.bot strong {
    font-weight: 700;
    color: #10B981;
}

.message-bubble.bot ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-bottom: 8px;
}

.chat-input-area {
    padding: 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 8px;
}

.chat-btn {
    width: 60px;
    height: 60px;
    background: #10B981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.chat-btn:hover {
    transform: scale(1.1);
    background: #059669;
}

.chat-btn::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid white;
    opacity: 0;
    animation: ripple 1.5s infinite;
}

@keyframes ripple {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }

    100% {
        opacity: 0;
        transform: scale(1.5);
    }
}

.typing-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: typing 1.4s infinite both;
    margin: 0 2px;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        opacity: 0.2;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-fade-up {
    animation: fadeUp 0.9s ease forwards;
    opacity: 0;
}

.animate-fade-scale {
    animation: fadeScale 0.9s ease forwards;
    opacity: 0;
}

.delay-100 {
    animation-delay: .1s
}

.delay-200 {
    animation-delay: .2s
}

.delay-300 {
    animation-delay: .3s
}

.delay-400 {
    animation-delay: .4s
}

/* 3D Logo */
#hero-logo {
    transform-style: preserve-3d;
    perspective: 800px;
}

/* Welcome Overlay */
#welcome-overlay {
    background-image: url('../img/hero.jpg');
    background-size: cover;
    background-position: center;
}

#welcome-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: -1;
}

.btn-enter {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 16px 40px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.2);
}

.btn-enter:hover {
    background: #10B981;
    border-color: #10B981;
    transform: scale(1.05);
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.6);
}