/* ===== API.GEO.Carbone — Main Stylesheet ===== */

/* --- Global --- */
*,*::before,*::after { box-sizing:border-box; }
html { scroll-behavior:smooth; }
body { font-family:'DM Sans',system-ui,sans-serif; }

/* --- Navbar glass effect --- */
.nav-glass {
    background: rgba(5,46,22,0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* --- Time Slider Buttons --- */
.time-btn {
    background: #f9fafb;
    color: #6b7280;
    cursor: pointer;
    border: none;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.time-btn:hover:not(.disabled) { background: #e5e7eb; color: #374151; }
.time-btn.active {
    background: #15803d !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 2px 8px rgba(21,128,61,0.3);
}
.time-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
    filter: grayscale(0.3);
    transition: all 0.3s ease;
}

/* --- Carbon Stock Button --- */
.carbone-btn {
    background: #f0fdf4;
    color: #166534;
    cursor: pointer;
    border: 1px solid #bbf7d0;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.carbone-btn:hover {
    background: #dcfce7;
    color: #14532d;
    border-color: #86efac;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(20,83,45,0.15);
}
.carbone-btn.active {
    background: linear-gradient(135deg, #14532d, #166534) !important;
    color: #ffffff !important;
    border-color: #14532d !important;
    box-shadow: 0 2px 12px rgba(20,83,45,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
    transform: translateY(0);
}
.carbone-btn.active::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    border: 2px solid rgba(34,197,94,0.4);
    animation: carbone-pulse 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes carbone-pulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50%      { opacity: 0.8; transform: scale(1.02); }
}

/* --- Time Slider Container Glow in Carbon Mode --- */
.carbone-active-glow {
    border-color: rgba(34,197,94,0.3) !important;
    box-shadow: 0 4px 24px rgba(20,83,45,0.15), 0 0 0 1px rgba(34,197,94,0.2) !important;
}

/* --- Sidebar Tabs --- */
.sidebar-tab {
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}
.sidebar-tab.active {
    color: #15803d !important;
    border-bottom-color: #15803d;
    font-weight: 600;
}
.sidebar-tab:hover:not(.active) {
    color: #374151;
}

/* --- Layer loading spinner --- */
.layer-loading::after {
    content: '';
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid #d1d5db;
    border-top-color: #22c55e;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Popups --- */
.popup-header {
    background: linear-gradient(135deg, #166534, #15803d);
    color: white;
    padding: 10px 14px;
    font-family: 'DM Serif Display', serif;
    font-size: 14px;
    border-radius: 12px 12px 0 0;
    margin: -14px -14px 10px -14px;
}
.popup-body { padding: 0 2px; }
.popup-body .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 12px;
}
.popup-body .row:last-child { border-bottom: none; }
.popup-body .label { color: #6b7280; }
.popup-body .value { font-weight: 600; color: #1f2937; }

/* --- Chat Panel --- */
.chat-msg-user {
    background: #dcfce7;
    border-radius: 16px 16px 4px 16px;
    padding: 8px 12px;
    max-width: 85%;
    margin-left: auto;
    font-size: 13px;
}
.chat-msg-ai {
    background: #f3f4f6;
    border-radius: 16px 16px 16px 4px;
    padding: 8px 12px;
    max-width: 85%;
    font-size: 13px;
}

/* --- Report Preview --- */
.report-preview h1 { font-family:'DM Serif Display',serif; font-size:24px; color:#14532d; margin-bottom:8px; }
.report-preview h2 { font-family:'DM Serif Display',serif; font-size:18px; color:#166534; margin-top:20px; margin-bottom:6px; border-bottom:2px solid #dcfce7; padding-bottom:4px; }
.report-preview h3 { font-size:14px; font-weight:700; color:#374151; margin-top:14px; }
.report-preview table { width:100%; border-collapse:collapse; font-size:12px; margin:10px 0; }
.report-preview table th { background:#f0fdf4; padding:8px; text-align:left; font-weight:600; border:1px solid #e5e7eb; }
.report-preview table td { padding:6px 8px; border:1px solid #e5e7eb; }
.report-preview .alert-box { background:#fef2f2; border-left:4px solid #ef4444; padding:10px 14px; margin:12px 0; border-radius:6px; font-size:12px; }
.report-preview .success-box { background:#f0fdf4; border-left:4px solid #22c55e; padding:10px 14px; margin:12px 0; border-radius:6px; font-size:12px; }

/* --- Loading overlay --- */
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid #bbf7d0;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Scrollbar --- */
.overflow-y-auto::-webkit-scrollbar { width: 5px; }
.overflow-y-auto::-webkit-scrollbar-track { background: transparent; }
.overflow-y-auto::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }
.overflow-y-auto::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* --- Mobile menu animation --- */
#nav-mobile-menu {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

/* --- Mobile responsiveness --- */
@media (max-width: 639px) {
    /* Time slider compact on small screens */
    #time-slider {
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 2rem);
        padding: 8px 12px;
        gap: 8px;
    }
    #time-slider .time-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    #time-slider #time-play {
        width: 32px;
        height: 32px;
    }
    #time-slider .carbone-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Chat messages wider on mobile */
    .chat-msg-user, .chat-msg-ai {
        max-width: 90%;
    }

    /* Report modal full-screen on mobile */
    #report-modal > div {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* --- Typing indicator animation --- */
@keyframes bounce-dot {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}
.typing-dot {
    width: 6px; height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: bounce-dot 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
