:root {
    --bg-color: #0f172a;
    --sidebar-bg: #1e293b;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.3);
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --border-color: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
    --nav-height: 50px;
    /* Reduced from 60px */
    --input-bg: rgba(255, 255, 255, 0.05);
}

html {
    font-size: 80%;
    /* Shrink all rem-based elements by 20% */
    width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    position: relative;
}

/* Top Navigation Bar */
.top-navbar {
    width: 100%;
    height: var(--nav-height);
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--accent-color);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 3rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-logo h2 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -1px;
}

.navbar-logo .highlight {
    color: var(--accent-color);
}

.navbar-nav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.navbar-nav-links li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 0.95rem;
}

.navbar-nav-links li:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--text-primary);
}

.navbar-nav-links li.active {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.navbar-nav-links .icon {
    font-size: 1.1rem;
}

/* Mobile Navbar Styling */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .top-navbar {
        height: auto;
        min-height: var(--nav-height);
        flex-wrap: wrap;
        padding: 0.5rem 1rem;
        justify-content: center;
        position: relative;
    }

    .navbar-logo {
        order: 2;
        flex: 1;
        text-align: center;
    }

    /* Hide logo when menu is open */
    .top-navbar:has(.navbar-nav-links.active) .navbar-logo {
        display: none;
    }

    .nav-toggle {
        display: block;
        order: 1;
        position: absolute;
        left: 1rem;
    }

    /* Hide hamburger when menu is open */
    .top-navbar:has(.navbar-nav-links.active) .nav-toggle {
        display: none;
    }

    .navbar-nav-links {
        display: none;
        width: 100%;
        padding: 1rem 0.5rem;
        gap: 0.5rem;
        border-top: 1px solid var(--border-color);
        margin-top: 0.5rem;
        order: 3;

        /* Grid layout for 2 columns */
        grid-template-columns: 1fr 1fr;
    }

    .navbar-nav-links.active {
        display: grid;
    }

    /* Close button as first grid item */
    .navbar-nav-links::before {
        content: '✕ Close Menu';
        font-size: 1rem;
        font-weight: 600;
        padding: 0.8rem 1rem;
        border-radius: 6px;
        background: rgba(239, 68, 68, 0.1);
        border: 1px solid rgba(239, 68, 68, 0.3);
        color: #ef4444;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .navbar-nav-links::before:hover {
        background: rgba(239, 68, 68, 0.2);
    }

    .navbar-nav-links li {
        width: 100%;
        padding: 0.8rem 1rem;
        border-radius: 6px;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.9rem;
    }

    .navbar-nav-links li:hover {
        background: rgba(255, 255, 255, 0.05);
    }

    .navbar-nav-links li.active {
        background: rgba(56, 189, 248, 0.1);
        border-bottom: none;
        border-left: 3px solid var(--accent-color);
    }
}

.app-container {
    display: flex;
    height: calc(100vh - var(--nav-height));
    overflow: hidden;
    position: relative;
    /* Ensure absolute children are positioned relative to this */
}

/* Filters Sidebar */
.filters-sidebar {
    width: 200px;
    /* Reduced from 260px */
    background-color: var(--sidebar-bg);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.highlight {
    color: var(--accent-color);
}

/* Global Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.filters-sidebar::-webkit-scrollbar-track,
.filters-panel::-webkit-scrollbar-track,
select[multiple]::-webkit-scrollbar-track {
    background: var(--sidebar-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-glow);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) transparent;
}

.filters-panel,
.filters-sidebar,
select[multiple] {
    scrollbar-color: var(--accent-color) var(--sidebar-bg);
}

.filters-panel {
    width: 100%;
}


.filters-panel h3 {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.filter-category {
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.filter-category-header {
    padding: 0.75rem;
    background: rgba(100, 116, 139, 0.1);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: background 0.2s;
}

.filter-category-header:hover {
    background: rgba(100, 116, 139, 0.15);
}

.filter-category-header .toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.filter-category-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.filter-category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding: 0 0.75rem;
}

.filter-category-content.active {
    max-height: 1000px;
    padding: 0.75rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

select,
input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 6px;
    outline: none;
    font-family: var(--font-main);
}

select option {
    background-color: var(--sidebar-bg);
    color: var(--text-primary);
}

select[multiple] {
    padding: 0.3rem;
}

select[multiple] option {
    padding: 0.4rem;
    margin: 0.1rem 0;
    border-radius: 4px;
}

select[multiple] option:checked {
    background: var(--accent-color);
    color: var(--bg-color);
}

.filter-hint {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    font-style: italic;
}

input[type="number"]:focus,
select:focus {
    border-color: var(--accent-color);
}

/* Remove number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}

.fav-filter-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.5;
}

.fav-filter-btn:hover {
    opacity: 1;
    background: rgba(244, 63, 94, 0.1);
    transform: scale(1.1);
}

/* Main Content */
.content-area {
    flex: 1;
    padding: 2rem 3rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Background gradient blob */
.content-area::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    z-index: 1;
}

#page-title {
    font-size: 2.5rem;
    font-weight: 700;
}

#page-subtitle {
    color: var(--text-secondary);
}

.search-bar input {
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    width: 100%;
    max-width: 1200px;
    outline: none;
    backdrop-filter: blur(5px);
}

.view-section {
    display: none;
    flex: 1;
    z-index: 1;
    flex-direction: column;
    overflow: hidden;
}

.view-section.active {
    display: flex;
}

/* Fixed controls that stay visible while scrolling */
.fixed-controls {
    flex-shrink: 0;
}

/* Controls row - contains month picker and sort on same line */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Scrollable content area */
.scrollable-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sort-controls label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 70px;
}

.sort-controls select {
    min-width: 200px;
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* Reduced from 280px */
    gap: 1.5rem;
    padding-bottom: 2rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    /* overflow: hidden; Removed to allow dropdowns to show */
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 600;
}

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

.card-cost {
    font-size: 1rem;
    font-weight: 600;
    color: var(--success-color);
    white-space: nowrap;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.card-info.visits {
    color: var(--accent-color);
    font-weight: 500;
}

.tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    display: inline-block;
}

.tag.sport {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-color);
}

.tag.cheap {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Season Controls */
.season-controls {
    margin-bottom: 2rem;
}

.month-controls {
    flex: 1;
}



/* Timeline specific */
.timeline-item {
    background: var(--card-bg);
    border-left: 3px solid var(--accent-color);
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    max-width: 100%;
    word-wrap: break-word;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.timeline-location {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeline-duration {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.timeline-costs {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.timeline-costs div {
    display: flex;
    gap: 0.5rem;
}

.timeline-costs strong {
    color: var(--text-primary);
}

/* Loading */
.loading-spinner {
    color: var(--text-secondary);
    font-size: 1.2rem;
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
}

/* Status/Season Colors */
/* Summer: Warm Gold/Amber */
.card.status-summer {
    border-color: #f59e0b;
}

.status-summer .status-tag {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* Spring: Fresh Emerald Green */
.card.status-spring {
    border-color: #10b981;
}

.status-spring .status-tag {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Autumn: Burnt Orange */
.card.status-autumn {
    border-color: #ea580c;
}

.status-autumn .status-tag {
    background: rgba(234, 88, 12, 0.2);
    color: #ea580c;
}

/* Winter: Icy Blue */
.card.status-winter {
    border-color: #3b82f6;
}

.status-winter .status-tag {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* Monsoon/Danger: Red */
.card.status-danger {
    border-color: #ef4444;
}

.status-danger .status-tag {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* General "Good": Green */
.card.status-good {
    border-color: #22c55e;
}

.status-good .status-tag {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* Closed: Grey */
.card.status-closed {
    border-color: #475569;
    opacity: 0.7;
}

.status-closed .status-tag {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

/* Default/Info: Purple */
.card.status-info {
    border-color: #c084fc;
    opacity: 1;
    /* Ensure opacity is reset if shared classes */
}

.status-info .status-tag {
    background: rgba(192, 132, 252, 0.2);
    color: #c084fc;
}

/* Dropdown Navigation */
.navbar-nav-links li {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--sidebar-bg);
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    list-style: none;
    flex-direction: column;
    margin-top: 0.5rem;
}

/* Invisible bridge to prevent hover loss in the gap */
.dropdown-content::before {
    content: "";
    position: absolute;
    top: -0.5rem;
    left: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
}

.navbar-nav-links li:hover .dropdown-content {
    display: flex;
}

.dropdown-content li {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    margin: 0;
    border-bottom: none !important;
    /* Override potential global styles */
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.dropdown-content li:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    padding-left: 1.25rem;
    /* Slide effect */
}

/* Mobile Dropdown adjustment */
@media (max-width: 768px) {
    .dropdown-content {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding-left: 1rem;
        margin-top: 0;
        display: none;
        /* Keep hidden by default */
        width: 100%;
    }

    .navbar-nav-links li:hover .dropdown-content {
        display: flex;
        /* Simplest way for now, though tap interaction is better */
    }

    .dropdown-content li {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Ensure arrow indicates dropdown */
    .has-dropdown::after {
        content: '▼';
        font-size: 0.7rem;
        margin-left: auto;
        opacity: 0.7;
    }
}

.status-info .status-tag {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.tag.status-tag {
    font-weight: 600;
    text-transform: uppercase;
}

/* Location Detail Page Styles */
.location-detail-container {
    padding: 1rem 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.detail-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.detail-section.full-width {
    grid-column: 1 / -1;
}

.detail-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.detail-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-info-item {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.9rem;
}

.detail-info-item strong {
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.cost-item {
    padding: 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    text-align: center;
}

.cost-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cost-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--success-color);
}

.season-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.75rem;
}

.season-month {
    padding: 1rem 0.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.season-month:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.season-month-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.season-month-quality {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: capitalize;
}

/* Season month color variations */
.season-month.status-summer {
    background: rgba(245, 158, 11, 0.15);
    border-color: #f59e0b;
}

.season-month.status-summer .season-month-quality {
    color: #f59e0b;
}

.season-month.status-spring {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10b981;
}

.season-month.status-spring .season-month-quality {
    color: #10b981;
}

.season-month.status-autumn {
    background: rgba(234, 88, 12, 0.15);
    border-color: #ea580c;
}

.season-month.status-autumn .season-month-quality {
    color: #ea580c;
}

.season-month.status-winter {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.season-month.status-winter .season-month-quality {
    color: #60a5fa;
}

.season-month.status-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.season-month.status-danger .season-month-quality {
    color: #ef4444;
}

.season-month.status-good {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
}

.season-month.status-good .season-month-quality {
    color: #22c55e;
}

.season-month.status-closed {
    background: rgba(148, 163, 184, 0.1);
    border-color: #475569;
    opacity: 0.6;
}

.season-month.status-closed .season-month-quality {
    color: #94a3b8;
}

.season-month.status-info {
    background: rgba(168, 85, 247, 0.15);
    border-color: #c084fc;
}

.season-month.status-info .season-month-quality {
    color: #c084fc;
}

.visit-history {
    margin-top: 1rem;
}

.visit-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.visit-item {
    padding: 0.5rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--accent-color);
}

.back-button-container {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.back-btn {
    width: 100%;
    padding: 0.8rem 1.2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 500;
}

.back-btn:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Trip Detail Page Styles */
.weeks-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.week-item {
    padding: 0.75rem 1rem;
    background: rgba(56, 189, 248, 0.1);
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--accent-color);
    text-align: center;
}

.season-info {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.location-link-btn {
    padding: 0.8rem 1.5rem;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: var(--bg-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
}

.location-link-btn:hover {
    background: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
}

/* Make timeline items clickable */
.timeline-item {
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
}

.timeline-item:hover {
    transform: translateX(5px);
    border-left-color: var(--text-primary);
}

/* Loading spinner animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* People Section */
.people-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.person-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 250px;
}

.person-item strong {
    display: block;
    font-size: 1.1rem;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.person-trips {
    list-style: none;
    padding: 0;
    margin: 0;
}

.person-trips li {
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 0.3rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Secondary Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0px;
}

.nav-tab {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-family: var(--font-main);
    transition: all 0.2s;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    background: rgba(56, 189, 248, 0.1);
}

.logistics-section,
.shop-section,
.planning-section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.logistics-section.active,
.shop-section.active,
.planning-section.active {
    display: block;
}

.shop-section .location-link-btn {
    margin-top: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Trip List Item Styles */
.trip-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-radius: 8px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.trip-item:hover {
    background: rgba(56, 189, 248, 0.05);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.trip-item.active {
    border: 1px solid var(--accent-color);
    background: rgba(56, 189, 248, 0.1);
}

.trip-item-date {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.trip-item-duration {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.trip-item-cost {
    font-weight: 600;
    color: var(--success-color);
    font-size: 1rem;
    text-align: right;
}

.trip-item-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: right;
}

@media (max-width: 768px) {
    html {
        font-size: 100%;
        /* Reset font size for mobile readability */
    }
}

/* Search Component */
.search-container {
    padding: 0;
    width: 100%;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.search-bar-wrapper {
    position: relative;
    width: 100%;
    /* Take remaining space */
}

.search-input {
    width: 100%;
    border-radius: 50px;
    padding: 0.8rem 1.2rem;
    padding-right: 14rem !important;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    outline: none;
    backdrop-filter: blur(5px);
}

.search-buttons {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-clear-btn {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.search-ai-btn {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid rgba(147, 51, 234, 0.3);
    background: rgba(147, 51, 234, 0.1);
    color: #9333ea;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.search-feedback {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    display: none;
    font-size: 0.9rem;
    width: 100%;
    max-width: 1200px;
}

.sidebar-toggle-btn {
    display: inline-flex;
    /* Visible generally as toggle */
    background: var(--card-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.sidebar-toggle-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}


/* =========================================
   Mobile Responsiveness & Sidebar Tweaks
   ========================================= */

/* Reduce default sidebar width */
.filters-sidebar {
    width: 170px;
    transition: transform 0.3s ease, width 0.3s ease, padding 0.3s ease;
    z-index: 50;
    position: relative;
}

/* Desktop Collapse State */
@media (min-width: 769px) {
    .filters-sidebar.active {
        width: 0;
        padding: 0;
        overflow: hidden;
        border: none;
    }
}

/* Mobile Layout Tweaks */
@media (max-width: 768px) {

    /* Page Layout */
    .content-area {
        padding: 1rem;
    }

    /* Hide page header on mobile to save space */
    .content-area>header {
        display: none;
    }

    #page-title {
        font-size: 1.8rem;
    }

    /* Sidebar */
    .filters-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 90vw;
        max-width: 480px;
        box-shadow: 4px 0 12px rgba(0, 0, 0, 0.5);
        padding-top: 4rem;
    }

    .filters-sidebar.active {
        transform: translateX(0);
    }

    .sidebar-toggle-btn {
        display: inline-flex !important;
    }

    /* Search Bar Responsive */
    .search-input {
        padding-right: 1.5rem !important;
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }

    .search-buttons {
        position: static;
        transform: none;
        justify-content: flex-start;
        width: 100%;
        margin-top: 0.5rem;
        gap: 0.5rem;
    }

    .mobile-filter-toggle {
        display: inline-flex !important;
    }

    /* Controls Layout */
    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    /* Month Buttons - Horizontal Scroll */
    .month-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        gap: 0.5rem;
    }

    .month-buttons::-webkit-scrollbar {
        display: none;
    }

    .month-btn {
        flex: 0 0 auto;
        padding: 0.5rem 0.8rem;
    }

    /* Sort Controls */
    .sort-controls {
        flex-direction: column;
        width: 100%;
    }

    .sort-controls>div {
        width: 100%;
        justify-content: space-between;
    }

    .sort-controls select {
        flex: 1;
        max-width: none;
    }

    /* Card Grid */
    .grid-container {
        grid-template-columns: 1fr;
    }
}

.hide-filters-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.6rem;

    background: var(--card-bg);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.hide-filters-btn:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

/* Autocomplete Dropdown */
.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--sidebar-bg);
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background-color: rgba(56, 189, 248, 0.2);
}

.dropdown-item.active {
    background-color: rgba(56, 189, 248, 0.2);
}

.autocomplete-active {
    background-color: var(--accent-color) !important;
    color: #fff;
}

/* Glassmorphism & Itinerary Styles */
.glass-panel {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

.itinerary-board {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-color);
}

.itinerary-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.itinerary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    border-color: var(--accent-color) !important;
}

.transport-connector {
    opacity: 0.8;
    transition: opacity 0.2s;
}

.transport-connector:hover {
    opacity: 1;
}

.transport-add button:hover {
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 50%;
}

/* Drag and Drop Itinerary Styles */
.itinerary-card[draggable="true"] {
    cursor: grab;
}

.itinerary-card[draggable="true"]:active {
    cursor: grabbing;
}

.itinerary-card.dragging {
    opacity: 0.4;
    border: 1px dashed var(--accent-color);
}

.itinerary-card.drag-over-top {
    border-top: 2px solid var(--accent-color);
    margin-top: 5px;
}

.itinerary-card.drag-over-bottom {
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 5px;
}

.drag-handle {
    cursor: grab;
    padding: 0 0.5rem 0 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    font-size: 1.2rem;
}

.drag-handle:hover {
    color: var(--text-primary);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Hide separators during drag for cleaner UI */
.itinerary-column.dragging-active .transport-connector,
.itinerary-column.dragging-active .transport-add {
    display: none !important;
}

/* Itinerary Selection */
.itinerary-card:focus,
.itinerary-card.selected {
    outline: none;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: rgba(56, 189, 248, 0.05) !important;
}

/* Active Itinerary Column Highlight */
.itinerary-column.active-itinerary {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 2px var(--accent-glow);
    background: rgba(56, 189, 248, 0.03) !important;
}


/* Custom Styled Checkbox */
.styled-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--bg-color);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    margin-right: 0.5rem;
    display: inline-block;
    vertical-align: middle;
}

.styled-checkbox:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.styled-checkbox:hover {
    border-color: var(--text-secondary);
}

.styled-checkbox:checked::after {
    content: '✓';
    position: absolute;
    color: var(--bg-color);
    font-size: 14px;
    font-weight: 800;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.styled-checkbox:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ===== VIEW CONFIGURATION (TABLE/CARD) ===== */

/* Toggle Buttons */
.view-toggle-container {
    display: flex;
    background: var(--bg-color);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin: 0;
    align-self: flex-start;
    width: 100%;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .view-toggle-container {
        align-self: flex-start;
        width: 100%;
        margin-top: 0.5rem;
    }
}

.view-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.view-toggle-btn.active {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-color);
    font-weight: 600;
}

.view-toggle-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Config Modal */
.config-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.config-modal-overlay.active {
    display: flex;
}

.config-modal {
    background: var(--sidebar-bg);
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
}

.config-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.config-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.config-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.config-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Draggable List */
.draggable-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.draggable-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: grab;
    transition: transform 0.2s, background 0.2s;
}

.draggable-item.dragging {
    opacity: 0.5;
    background: var(--accent-glow);
    border-color: var(--accent-color);
}

.draggable-item.dragging-over {
    border: 2px dashed var(--accent-color);
}

.draggable-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
}

.drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    font-size: 1.2rem;
    opacity: 0.5;
}

.draggable-item:hover .drag-handle {
    opacity: 1;
}

.variable-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.variable-label {
    flex: 1;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

/* Table View Styles */
.locations-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
}

.locations-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    /* Force scroll on small screens */
}

.locations-table th,
.locations-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.locations-table th {
    background: rgba(15, 23, 42, 0.95);
    /* Darker header */
    color: var(--text-primary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.locations-table th:hover {
    background: rgba(30, 41, 59, 1);
    color: var(--accent-color);
}

.locations-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.locations-table td.primary-col {
    color: var(--text-primary);
    font-weight: 500;
}

.locations-table .status-tag {
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap;
}

/* Empty State / Config Button in Sidebar */
.config-trigger-btn {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    background: transparent;
    border: 1px dashed var(--text-secondary);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.config-trigger-btn:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
    background: rgba(56, 189, 248, 0.1);
}

/* ========================================
   CHATBOT STYLES - Floating FAB + Slide-out Panel
   ======================================== */

/* Floating Action Button */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
    cursor: pointer;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chatbot-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(56, 189, 248, 0.6);
}

.chatbot-fab.hidden {
    display: none;
}

/* Slide-out Panel */
.chatbot-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: var(--sidebar-bg);
    border-left: 1px solid var(--border-color);
    z-index: 1999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
}

.chatbot-panel.active {
    transform: translateX(0);
}

.chatbot-panel.drag-over {
    background: linear-gradient(to bottom, var(--surface-bg), var(--surface-bg-hover));
    border-left: 3px solid var(--primary-color);
}

.chatbot-panel.drag-over::before {
    content: '📎 Drop images here to upload';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Panel Sections */
.chatbot-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.chatbot-header button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chatbot-header button:hover {
    color: var(--text-primary);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Quick Action Buttons */
.chatbot-quick-actions {
    display: none;
    /* Hidden by default, shown when bot asks for permission */
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0 1rem;
}

.quick-action-btn {
    flex: 1 1 auto;
    min-width: 80px;
    max-width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

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

.quick-action-btn:nth-child(1):hover {
    border-color: rgba(34, 197, 94, 0.8);
    background: rgba(34, 197, 94, 0.1);
}

.quick-action-btn:nth-child(2):hover {
    border-color: rgba(239, 68, 68, 0.8);
    background: rgba(239, 68, 68, 0.1);
}

.quick-action-btn:nth-child(3):hover {
    border-color: rgba(251, 191, 36, 0.8);
    background: rgba(251, 191, 36, 0.1);
}

.chatbot-input-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.chatbot-input-container input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.95rem;
}

.chatbot-input-container input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.chatbot-input-container input::placeholder {
    color: var(--text-secondary);
}

.chatbot-input-container button {
    padding: 0.75rem 1.25rem;
    background: var(--accent-color);
    border: none;
    border-radius: 8px;
    color: var(--bg-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-input-container button:hover {
    background: var(--text-primary);
    transform: translateY(-1px);
}

.chatbot-input-container button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.chatbot-message {
    padding: 0.75rem 1rem;
    border-radius: 12px;
    max-width: 85%;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.chatbot-message.user {
    background: var(--accent-color);
    color: var(--bg-color);
    align-self: flex-end;
    border-radius: 12px 12px 0 12px;
}

.chatbot-message.bot {
    background: var(--card-bg);
    color: var(--text-primary);
    align-self: flex-start;
    border-radius: 12px 12px 12px 0;
}

/* Markdown Styles for Bot Messages */
.chatbot-message h1,
.chatbot-message h2,
.chatbot-message h3 {
    margin: 0.8rem 0 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
}

.chatbot-message h1:first-child,
.chatbot-message h2:first-child,
.chatbot-message h3:first-child {
    margin-top: 0;
}

.chatbot-message ul,
.chatbot-message ol {
    margin: 0.4rem 0 0.4rem 1.2rem;
    padding: 0;
}

.chatbot-message li {
    margin-bottom: 0.2rem;
    line-height: 1.4;
}

.chatbot-message p {
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.chatbot-message p:last-child {
    margin-bottom: 0;
}

.chatbot-message strong {
    font-weight: 700;
}

.chatbot-message a {
    color: var(--accent-color);
    text-decoration: underline;
}

.chatbot-message.user a {
    color: white;
}

.chatbot-message code {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Overlay - lighter on desktop, darker on mobile */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    z-index: 1998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chatbot-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Compress content from right on desktop when chatbot is open */
@media (min-width: 769px) {
    body.chatbot-open .app-container {
        margin-right: 370px;
        transition: margin-right 0.3s ease;
    }

    .chatbot-overlay {
        background: rgba(0, 0, 0, 0.1);
    }

    /* Ensure itinerary containers respect the compression */
    body.chatbot-open .scrollable-content {
        width: 100%;
        max-width: 100%;
    }

    body.chatbot-open #planning-itinerary {
        width: 100%;
        max-width: 100%;
    }

    body.chatbot-open .itinerary-board {
        width: 100%;
        max-width: 100%;
    }
}

/* Mobile: use darker overlay and cover content */
@media (max-width: 768px) {
    .chatbot-overlay {
        background: rgba(0, 0, 0, 0.6);
    }
}

/* Action Notifications (Toast) */
.chatbot-notification {
    position: fixed;
    bottom: 100px;
    right: 24px;
    background: var(--success-color);
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1600;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transform: translateX(50px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.chatbot-notification.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.chatbot-notification.hiding {
    opacity: 0;
    transform: translateX(50px);
}

/* Itinerary Dropdown Menu */
.chatbot-itinerary-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 0.5rem;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.chatbot-itinerary-dropdown.active {
    display: block !important;
}

.chatbot-itinerary-item {
    padding: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

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

.chatbot-itinerary-item:hover {
    background: rgba(56, 189, 248, 0.1);
}

.chatbot-itinerary-item.active {
    background: rgba(56, 189, 248, 0.15);
    border-left: 3px solid var(--accent-color);
}


/* Typing Indicator */
.chatbot-typing {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    padding: 0.75rem 1rem;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

/* New Chat Button */
.chatbot-new-chat {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-new-chat:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-panel {
        width: 100%;
    }

    .chatbot-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }

    .chatbot-notification {
        right: 16px;
        bottom: 88px;
        max-width: calc(100vw - 32px);
    }
}

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

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

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: '';
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Rounded sliders */
.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Chatbot Settings Dropdown */
.chatbot-settings-container button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--text-secondary);
    transition: color 0.2s;
    border-radius: 4px;
}

.chatbot-settings-container button:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.chatbot-settings-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    max-height: 500px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 2000;
    margin-top: 0.5rem;
    overflow-y: auto;
}

.chatbot-settings-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Tool Permission Controls */
.tool-permission-item {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-permission-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.permission-button-group {
    display: flex;
    gap: 0.5rem;
}

.permission-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
}

.permission-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
}

.permission-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.permission-btn[data-permission="never"].active {
    background: rgba(239, 68, 68, 0.8);
    border-color: rgba(239, 68, 68, 0.8);
}

.permission-btn[data-permission="ask"].active {
    background: rgba(251, 191, 36, 0.8);
    border-color: rgba(251, 191, 36, 0.8);
}

.permission-btn[data-permission="always"].active {
    background: rgba(34, 197, 94, 0.8);
    border-color: rgba(34, 197, 94, 0.8);
}

/* Search Bar Add Button */
.search-add-btn {
    padding: 0.5rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.search-add-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    transform: translateY(-1px);
}

/* Chatbot Image Upload Styles */

/* Image Upload Button */
.chatbot-image-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-image-btn:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

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

/* Image Preview Container */
.chatbot-image-preview {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-height: 150px;
    overflow-y: auto;
    background: var(--bg-color);
}

.chatbot-image-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--sidebar-bg);
    flex-shrink: 0;
}

.chatbot-image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chatbot-image-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.chatbot-image-preview-item .remove-btn:hover {
    background: rgba(255, 0, 0, 0.8);
}

.chatbot-image-preview-item .remove-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Uploading state */
.chatbot-image-preview-item.uploading {
    opacity: 0.6;
}

.chatbot-image-preview-item.uploading::after {
    content: "⏳";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Image messages in chat */
.chatbot-message.chatbot-images {
    background: transparent;
    padding: 0.5rem;
}