/* ========================================
   RESET & VARIABLES
======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --dark-bg: #0a0e27;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.2);
    --shadow-glow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

/* ========================================
   GLOBAL STYLES
======================================== */
body {
    font-family: 'Inter', sans-serif;
    background: var(--dark-bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(102, 126, 234, 0.3) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(118, 75, 162, 0.3) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Main Header - Centered */
.main-header {
    text-align: center;
    padding: 2rem 0;
    position: relative;
}

/* ========================================
   HEADER
======================================== */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.brand-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 8px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow:
        0 0 30px rgba(102, 126, 234, 0.5),
        0 0 60px rgba(118, 75, 162, 0.3);
    margin-bottom: 0.5rem;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 2px;
}

/* Language Toggle */
.lang-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 20px;
    border: 1px solid var(--card-border);
}

.lang-option {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-option:hover {
    color: var(--text-primary);
}

.lang-option.active {
    background: var(--primary-gradient);
    color: white;
}

/* Category Filters */
.category-filters {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 20px;
}

.category-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.category-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.category-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.category-icon {
    font-size: 18px;
    line-height: 1;
}

.category-label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    font-weight: 300;
}

/* ========================================
   FORM SECTION
======================================== */
.form-section {
    animation: fadeInUp 1s ease-out;
}

.form-container {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: var(--shadow-glow);
    max-width: 700px;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.form-container:hover {
    transform: translateY(-5px);
}

.form-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--secondary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Support both form-group and input-group for 2-column layout */
.form-row:has(.form-group:nth-child(2)),
.form-row:has(.input-group:nth-child(2)) {
    grid-template-columns: 1fr 1fr;
}

.form-group,
.input-group {
    display: flex;
    flex-direction: column;
}

.form-group label,
.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.form-group select,
.input-group input,
.input-group select {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    width: 100%;
    /* Ensure full width */
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    background: var(--input-bg);
}

.form-group select option {
    background: #1a1e3a;
    color: var(--text-primary);
}

.input-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 500;
}

.input-hint.success {
    color: #32CD32;
}

.input-hint.error {
    color: #f5576c;
}

/* Location Autocomplete */
.location-input-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 14, 39, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid var(--input-border);
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(102, 126, 234, 0.2);
}

.autocomplete-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.autocomplete-item-address {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.autocomplete-loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

.autocomplete-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Form Back Button - Icon only */
.btn-form-back {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.btn-form-back:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    transform: translateX(-3px);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 1.2rem;
    margin-top: 1rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.3rem;
}

/* Loading State */
.loading-container {
    text-align: center;
    padding: 2rem;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 1rem;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Error State */
.error-container {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.3);
    border-radius: 12px;
}

.error-text {
    color: #f5576c;
    text-align: center;
}

/* ========================================
   COLLAPSIBLE PROFILE SIDEBAR
======================================== */
.profile-sidebar {
    position: fixed;
    top: 140px;
    left: 0;
    width: 300px;
    height: auto;
    /* Auto height to fit content */
    max-height: calc(100vh - 180px);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: none;
    border-radius: 0 24px 24px 0;
    z-index: 1000;
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.4);
    color: white;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

/* Collapsed State */
.profile-sidebar.collapsed {
    transform: translateX(-300px);
}

/* Toggle Tab - Always Visible on Edge */
.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -48px;
    transform: translateY(-50%);
    width: 48px;
    height: 100px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    border: none;
    border-radius: 0 16px 16px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.3);
}

.sidebar-toggle:hover {
    width: 54px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 1) 0%, rgba(118, 75, 162, 1) 100%);
}

.toggle-icon {
    color: white;
    font-size: 20px;
    transition: transform 0.4s ease;
    font-weight: bold;
}

.profile-sidebar.collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    transition: opacity 0.3s ease;
}

.profile-sidebar.collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

/* When Assistant is Open - Sidebar Shrinks */
body.assistant-active .profile-sidebar {
    transform: translateX(-300px);
    opacity: 0.3;
}

body.assistant-active .profile-sidebar .sidebar-toggle {
    opacity: 0;
    pointer-events: none;
}

.profile-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-badge {
    background-color: #fbbf24;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    width: fit-content;
    margin-bottom: 5px;
}

.profile-header h2,
.profile-name-display {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #fff;
}

.profile-details {
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.5;
}

/* Natal Chart Area */
.chart-preview {
    margin: 10px 0;
    width: 100%;
    height: 280px;
    /* Increased height */
    background: rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    padding: 5px;
    position: relative;
    /* For zoom button positioning */
}

/* Zoom Button */
.chart-zoom-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-zoom-btn svg {
    stroke: black !important;
    fill: none !important;
    color: black !important;
}

.chart-zoom-btn svg circle,
.chart-zoom-btn svg line,
.chart-zoom-btn svg path {
    stroke: black !important;
    stroke-width: 2px !important;
    color: black !important;
}

.chart-zoom-btn:hover {
    background: rgba(100, 100, 255, 0.8);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Chart Modal */
.chart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

.chart-modal.active {
    display: flex;
}

.chart-modal-content {
    background: rgba(15, 23, 42, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px;
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.chart-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    color: white;
}

.chart-modal-close:hover {
    background: rgba(255, 0, 0, 0.7);
    transform: rotate(90deg);
}

.chart-modal-body {
    width: 80vw;
    max-width: 800px;
    height: 80vh;
    max-height: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-modal-body svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

/* Invert SVG colors for Dark Mode */
.chart-preview svg,
.natal-chart-svg {
    width: 100%;
    height: 100%;
    /* Invert colors (White to Black, Black to White) and rotate hue */
    filter: invert(1) hue-rotate(180deg) brightness(1.1);
    background-color: transparent !important;
    /* Optimize SVG rendering */
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    /* Prevent blurriness on scale */
    transform: translateZ(0);
    -webkit-font-smoothing: antialiased;
}

.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-settings {
    display: block;
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-settings:hover {
    border-color: #fff;
}

/* Hide old map header elements */
.map-header,
.btn-back {
    display: none;
}

/* Show back button in sidebar */
.sidebar-actions .btn-back {
    display: block;
    width: 100%;
    text-align: center;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
    color: white;
    font-weight: 600;
    border: none;
    padding: 10px;
    border-radius: 8px;
    margin-top: 5px;
}

/* New Calculation Button - Independent at top left */
.btn-new-calculation {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1100;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%);
    color: white;
    font-weight: 600;
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
}

.btn-new-calculation:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

/* Zoom Controls - Top Right */
.zoom-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(99, 102, 241, 0.8);
    transform: scale(1.1);
}

.zoom-btn:active {
    transform: scale(0.95);
}

/* Hide zoom controls by default - only show on map page */
.zoom-controls {
    display: none;
}

#mapSection .zoom-controls,
#mapSection~.zoom-controls {
    display: flex;
}

/* Move zoom controls left when assistant is active */
body.assistant-active .zoom-controls {
    right: calc(50vw + 20px);
}

/* Input Group Styles Update */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
}

#map {
    height: 100vh;
    width: 100%;
    position: relative;
}

#map canvas {
    display: block;
}

/* Legend */
.legend {
    position: fixed;
    bottom: 30px;
    left: 10px;
    z-index: 500;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem 1.5rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.legend-item {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.color-box {
    width: 14px;
    height: 14px;
    margin-right: 0.6rem;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 768px) {
    .brand-title {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }

    .subtitle {
        font-size: 1rem;
    }

    .form-container {
        padding: 2rem 1.5rem;
    }

    .form-row:has(.form-group:nth-child(2)) {
        grid-template-columns: 1fr;
    }

    .map-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .map-title {
        font-size: 1.5rem;
    }

    #map {
        height: 400px;
    }

    .legend {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem;
    }

    .brand-title {
        font-size: 2rem;
    }

    .form-title {
        font-size: 1.5rem;
    }
}

/* ========================================
   CHATBOT STYLES
======================================== */
.chatbot-container {
    position: fixed;
    right: 30px;
    bottom: 30px;
    z-index: 1000;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chatbot-toggle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: rgba(10, 14, 39, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chat-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-title img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.chat-close:hover {
    color: white;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.message.bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 5px;
    color: var(--text-primary);
}

.message.user {
    align-self: flex-end;
    background: var(--primary-gradient);
    border-bottom-right-radius: 5px;
    color: white;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 10px 15px;
    color: white;
    outline: none;
}

.chat-input-area input:focus {
    border-color: rgba(102, 126, 234, 0.5);
}

.chat-send {
    background: none;
    border: none;
    color: #667eea;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
    transition: transform 0.2s;
}

.chat-send:hover {
    transform: scale(1.1);
    color: #764ba2;
}

/* ========================================
   ASTRO ASSISTANT (Main Feature)
======================================== */
.astro-assistant {
    display: none;
    /* Hidden by default, shown only on map page */
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 2000;
}

.astro-assistant.visible {
    display: block;
}

/* Floating Action Button */
.assistant-fab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px 14px 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 8px 30px rgba(102, 126, 234, 0.4),
        0 4px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.assistant-fab:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 12px 40px rgba(102, 126, 234, 0.5),
        0 6px 15px rgba(0, 0, 0, 0.3);
}

.astro-assistant.active .assistant-fab {
    display: none;
}

/* Pulse Animation */
.fab-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50px;
    background: inherit;
    animation: fabPulse 2s infinite;
    z-index: -1;
}

@keyframes fabPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.fab-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.fab-label {
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Expanded Chat Panel - RIGHT SIDE */
.assistant-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(30px);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    display: none;
    flex-direction: column;
    box-shadow: -20px 0 80px rgba(0, 0, 0, 0.7);
    z-index: 2000;
}

.astro-assistant.active .assistant-panel {
    display: flex;
}

/* ========================================
   SPLIT SCREEN MODE
   When assistant is active:
   - Globe is resized to left 50% via JavaScript
   - UI elements are repositioned to stay in left half
   - Chat panel overlays right 50%
======================================== */

/* #map container: positioned at left 0 */
#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: none;
    /* Globe handles its own transitions */
}

/* When assistant active: center UI elements in left half (25vw = center of 50vw) */
body.assistant-active #brandTitleContainer {
    left: 25vw !important;
}

body.assistant-active #categoryFilters {
    left: 25vw !important;
}

/* Legend stays at bottom left - no change needed */

/* Profile sidebar stays at left - no change needed */

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.panel-title img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.1);
}

.title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.main-title {
    color: white;
    font-size: 17px;
    font-weight: 700;
}

.sub-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-weight: 400;
}

.panel-controls {
    display: flex;
    gap: 8px;
}

.panel-minimize,
.panel-new-chat {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.panel-minimize:hover,
.panel-new-chat:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.panel-new-chat {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.panel-new-chat:hover {
    opacity: 0.9;
    transform: scale(1.05);
}

/* Chat Sessions Container */
.chat-sessions-container {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sessions-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    gap: 10px;
}

.sessions-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    transition: all 0.2s;
    padding: 6px 10px;
    border-radius: 8px;
}

.sessions-header-left:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.btn-new-chat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-new-chat:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sessions-toggle {
    font-size: 10px;
    transition: transform 0.2s;
}

.sessions-header-left.open .sessions-toggle {
    transform: rotate(180deg);
}

.chat-sessions-list {
    padding: 8px 12px;
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.session-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.session-item.active {
    background: rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(102, 126, 234, 0.5);
}

.session-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.session-name {
    font-size: 13px;
    color: white;
    font-weight: 500;
}

.session-date {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.session-delete {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s;
}

.session-item:hover .session-delete {
    opacity: 1;
}

.session-delete:hover {
    background: rgba(255, 100, 100, 0.2);
}

.no-sessions {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

/* Panel Messages */
.panel-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel-messages .message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.panel-messages .message .message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
}

.panel-messages .message .message-avatar {
    font-size: 16px;
}

.panel-messages .message .message-sender {
    font-weight: 600;
    opacity: 0.8;
}

.panel-messages .message .message-text {
    line-height: 1.6;
}

/* Chat Markdown Styles */
.message-text .chat-paragraph {
    margin: 0 0 12px 0;
}

.message-text .chat-paragraph:last-child {
    margin-bottom: 0;
}

.message-text .chat-h1 {
    font-size: 1.4em;
    font-weight: 700;
    margin: 16px 0 10px 0;
    color: #a78bfa;
    border-bottom: 1px solid rgba(167, 139, 250, 0.3);
    padding-bottom: 6px;
}

.message-text .chat-h2 {
    font-size: 1.25em;
    font-weight: 700;
    margin: 14px 0 8px 0;
    color: #c4b5fd;
}

.message-text .chat-h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 12px 0 6px 0;
    color: #ddd6fe;
}

.message-text .chat-h4 {
    font-size: 1em;
    font-weight: 600;
    margin: 10px 0 6px 0;
    color: #e9d5ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.message-text strong {
    font-weight: 700;
    color: #f0abfc;
}

.message-text em {
    font-style: italic;
    color: rgba(255, 255, 255, 0.95);
}

.message-text .chat-li {
    margin: 6px 0;
    padding-left: 8px;
    color: rgba(255, 255, 255, 0.95);
}

.message-text .chat-li-num {
    margin: 6px 0;
    padding-left: 8px;
    color: rgba(255, 255, 255, 0.95);
}

.message-text .chat-li-nested {
    margin: 4px 0;
    padding-left: 24px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
}

/* Loading Animation */
.chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    color: rgba(255, 255, 255, 0.8);
}

.loading-spinner {
    display: inline-block;
    animation: spin 1.5s linear infinite;
    font-size: 1.2em;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.panel-messages .message.bot-message {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 6px;
    color: rgba(255, 255, 255, 0.9);
}

.panel-messages .message.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-bottom-right-radius: 6px;
    color: white;
}

.panel-messages .message.typing-indicator .message-text {
    opacity: 0.7;
    font-style: italic;
}

/* Panel Input */
.panel-input {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 6px 6px 6px 18px;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.input-wrapper input {
    flex: 1;
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    outline: none;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.panel-input .input-hint {
    margin-top: 10px;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
}

/* Hide old chatbot styles when new is active */
.chatbot-container {
    display: none !important;
}

/* ========================================
   USER MENU
======================================== */
.user-menu {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-logout {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(255, 100, 100, 0.2);
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff6b6b;
}

/* ========================================
   LANDING PAGE
======================================== */
.landing-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.8s ease-out;
    padding: 2rem;
}

.landing-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.landing-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2.5rem;
}

.landing-features {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 30px;
    border: 1px solid var(--card-border);
}

.feature-icon {
    font-size: 1.3rem;
}

.feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.landing-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* ========================================
   AUTH PAGES
======================================== */
.auth-section {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.5s ease-out;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 40px;
    backdrop-filter: blur(10px);
}

.auth-title {
    font-size: 1.8rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 30px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-form .input-group {
    margin-bottom: 20px;
}

.auth-error {
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
    color: #ff6b6b;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

/* Test Phase Notice */
.test-phase-notice {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
}

.test-phase-notice .notice-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.test-phase-notice h3 {
    font-size: 1.3rem;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 600;
}

.test-phase-notice p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 10px;
}

.test-phase-notice .notice-email {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.test-phase-notice .notice-email a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.test-phase-notice .notice-email a:hover {
    text-decoration: underline;
}

.auth-switch {
    text-align: center;
    color: var(--text-secondary);
    margin-top: 20px;
    font-size: 0.9rem;
}

.auth-switch a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-back-landing {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-back-landing:hover {
    color: var(--text-primary);
}

/* ========================================
   DASHBOARD
======================================== */
.dashboard-section {
    animation: fadeInUp 0.5s ease-out;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 700;
}

.btn-new-map {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-glow);
}

.btn-new-map:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.maps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.map-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.map-card:hover {
    transform: translateY(-5px);
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: var(--shadow-glow);
}

.map-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.map-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.map-card-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
}

.map-card:hover .map-card-delete {
    opacity: 1;
}

.map-card-delete:hover {
    color: #ff6b6b;
}

.map-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-card-info span {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.map-card-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 15px;
    opacity: 0.7;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.empty-state .btn-primary {
    margin: 0 auto;
    display: inline-flex;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}