* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #0f1419;
    color: #e1e8ed;
    overflow-x: hidden;
}
h1, h2, h3, h4, h5, h6 { font-weight: 600; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }
a { color: #3b82f6; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea {
    font-family: inherit;
    background: #0d1117;
    border: 1px solid #1e2a35;
    color: #e1e8ed;
    padding: 8px;
    border-radius: 4px;
    width: 100%;
}
input:focus, select:focus, textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}
.hidden { display: none !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0f1419; }
::-webkit-scrollbar-thumb { background: #1e2a35; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3b82f6; }

/* Utilities */
.btn-primary { background: #3b82f6; color: white; padding: 8px 16px; border-radius: 16px; font-weight: 500; transition: background 0.2s; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { background: #ef4444; color: white; padding: 8px 16px; border-radius: 16px; font-weight: 500; transition: background 0.2s; }
.btn-danger:hover { background: #dc2626; }
.btn-cancel { background: transparent; color: #8899aa; padding: 8px 16px; transition: color 0.2s; }
.btn-cancel:hover { color: #e1e8ed; }
.btn-add { background: transparent; color: #8899aa; border-radius: 50%; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 16px; line-height: 1; transition: all 0.2s; }
.btn-add:hover { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.btn-icon { background: transparent; color: #8899aa; padding: 4px; border-radius: 4px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-icon:hover { color: #e1e8ed; background: rgba(255, 255, 255, 0.1); }

/* Landing Page */
.landing-page .landing-container { max-width: 900px; margin: 0 auto; padding: 40px 20px; }
.landing-header { text-align: center; margin-bottom: 40px; }
.trip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.trip-card {
    background: #1a2332; border: 1px solid #1e2a35; border-radius: 8px; padding: 20px;
    cursor: pointer; transition: all 0.2s ease; position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 140px;
}
.trip-card:hover { transform: translateY(-2px); border-color: #3b82f6; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.create-trip-card { border: 1px dashed #3b82f6; background: rgba(59, 130, 246, 0.05); align-items: center; justify-content: center; text-align: center; }
.create-trip-icon { font-size: 36px; color: #3b82f6; margin-bottom: 10px; }
.trip-card-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.trip-card-meta { font-size: 13px; color: #8899aa; }
.trip-delete { position: absolute; top: 10px; right: 10px; background: rgba(239, 68, 68, 0.1); color: #ef4444; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; opacity: 0; transition: opacity 0.2s; }
.trip-card:hover .trip-delete { opacity: 1; }
.trip-delete:hover { background: #ef4444; color: white; }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(2px); }
.modal { background: #1a2332; border: 1px solid #1e2a35; border-radius: 8px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: #8899aa; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Planner Page */
.planner-page { overflow: hidden; }
.map-container { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; }

/* Sidebar */
.sidebar {
    position: fixed; left: 0; top: 0; width: 300px; height: 100vh;
    background: rgba(15, 20, 25, 0.95); backdrop-filter: blur(10px);
    z-index: 10; border-right: 1px solid #1e2a35;
    transition: transform 0.3s ease;
    display: flex; flex-direction: column;
}
.sidebar.collapsed { transform: translateX(-300px); }
.sidebar-header { padding: 12px 16px; border-bottom: 1px solid #1e2a35; display: flex; align-items: center; gap: 8px; }
.trip-name { font-size: 15px; flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: text; }
.sidebar-close-btn { display: none; }
.sidebar-toggle {
    position: fixed; left: 16px; top: 16px; z-index: 9;
    background: rgba(15, 20, 25, 0.9); border: 1px solid #1e2a35; color: #e1e8ed;
    padding: 8px 12px; border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: opacity 0.3s; opacity: 0; pointer-events: none;
    backdrop-filter: blur(10px);
}
.sidebar.collapsed ~ .sidebar-toggle { opacity: 1; pointer-events: auto; }

/* Sidebar Tabs */
.sidebar-tabs {
    display: flex; border-bottom: 1px solid #1e2a35; flex-shrink: 0;
}
.sidebar-tab {
    flex: 1; padding: 10px 8px; font-size: 13px; font-weight: 600;
    color: #8899aa; background: transparent;
    border-bottom: 2px solid transparent;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.2s; position: relative;
}
.sidebar-tab:hover { color: #e1e8ed; background: rgba(255,255,255,0.03); }
.sidebar-tab.active { color: #3b82f6; border-bottom-color: #3b82f6; }
.tab-add {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; font-size: 14px;
}
.sidebar-tab:not(.active) .tab-add { display: none; }

/* Tab Panels */
.tab-panel { display: none; flex-grow: 1; overflow-y: auto; flex-direction: column; }
.tab-panel.active { display: flex; }
.sidebar-content { flex-grow: 1; overflow: hidden; display: flex; flex-direction: column; padding: 0; }
.tab-panel-footer { padding: 12px 16px; border-top: 1px solid #1e2a35; flex-shrink: 0; margin-top: auto; }
.btn-add-bottom {
    width: 100%; padding: 8px; background: rgba(59,130,246,0.1); color: #3b82f6;
    border-radius: 6px; font-size: 13px; font-weight: 500; transition: all 0.2s;
}
.btn-add-bottom:hover { background: rgba(59,130,246,0.2); }

/* Tree View */
.tree-section { margin-bottom: 4px; }
.tree-header { display: flex; align-items: center; padding: 8px 16px; font-size: 14px; font-weight: 600; color: #8899aa; cursor: pointer; user-select: none; }
.tree-header:hover { color: #e1e8ed; }
.tree-toggle { width: 16px; margin-right: 4px; display: inline-block; transition: transform 0.2s; }
.tree-section.collapsed .tree-toggle { transform: rotate(-90deg); }
.tree-body { display: block; }
.tree-section.collapsed .tree-body { display: none; }
.tree-item { padding: 6px 16px 6px 36px; display: flex; align-items: center; font-size: 13px; cursor: pointer; transition: background 0.2s; position: relative; }
.tree-item:hover { background: rgba(255, 255, 255, 0.05); }
.tree-item.active { background: rgba(59, 130, 246, 0.1); border-left: 3px solid #3b82f6; padding-left: 33px; }
.tree-item-name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-item-count { background: #1e2a35; color: #8899aa; font-size: 11px; padding: 2px 6px; border-radius: 10px; margin-left: 8px; }
.tree-item-actions { opacity: 0; display: flex; gap: 4px; }
.tree-item:hover .tree-item-actions { opacity: 1; }
.tree-item-remove { font-size: 14px; color: #8899aa; cursor: pointer; }
.tree-item-remove:hover { color: #ef4444; }
.cat-color-dot { display: block; width: 8px; min-width: 8px; height: 8px; min-height: 8px; border-radius: 50%; flex-shrink: 0; margin-right: 2px; }
.cat-icon { font-size: 13px; margin-right: 3px; flex-shrink: 0; line-height: 1; }
.cat-visibility { font-size: 13px; margin-left: auto; cursor: pointer; opacity: 0.5; transition: opacity 0.15s; flex-shrink: 0; padding: 0 4px; }
.cat-visibility:hover { opacity: 1; }
.cat-visibility.hidden-cat { opacity: 0.3; }

/* Drag and Drop */
.drag-handle { color: #8899aa; margin-right: 8px; cursor: grab; visibility: hidden; }
.tree-item:hover .drag-handle { visibility: visible; }
.tree-item.dragging { opacity: 0.5; background: #1e2a35; }
.tree-item.drag-over-top { border-top: 2px solid #3b82f6; }
.tree-item.drag-over-bottom { border-bottom: 2px solid #3b82f6; }

/* New Category Input */
#new-category-form { padding: 8px 16px; }

/* Right Panel */
.right-panel { position: fixed; right: 0; top: 0; width: 420px; height: 100vh; background: rgba(15, 20, 25, 0.97); backdrop-filter: blur(10px); z-index: 10; border-left: 1px solid #1e2a35; transform: translateX(420px); transition: transform 0.3s ease; display: flex; flex-direction: column; }
.right-panel.open { transform: translateX(0); }
.panel-close { position: absolute; top: 12px; right: 12px; background: rgba(0,0,0,0.5); color: white; width: 28px; height: 28px; border-radius: 50%; font-size: 18px; display: flex; align-items: center; justify-content: center; z-index: 11; transition: background 0.2s; }
.panel-close:hover { background: rgba(0,0,0,0.8); }
.panel-content { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; }

/* Location Details */
.panel-photos { height: 200px; width: 100%; position: relative; background: #1a2332; flex-shrink: 0; }
.panel-photo-main { width: 100%; height: 100%; object-fit: cover; }
.panel-photo-strip { display: flex; overflow-x: auto; gap: 4px; padding: 4px; background: #0f1419; }
.panel-photo-thumb { width: 60px; height: 40px; object-fit: cover; cursor: pointer; opacity: 0.6; transition: opacity 0.2s; border-radius: 2px; }
.panel-photo-thumb:hover, .panel-photo-thumb.active { opacity: 1; }
.panel-body { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; gap: 16px; }
.location-source-badge { display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 600; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.source-db { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.source-google { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.location-title { font-size: 24px; margin-bottom: 4px; line-height: 1.2; }
.location-address { font-size: 13px; color: #8899aa; display: flex; align-items: flex-start; gap: 6px; }
.location-rating { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: #fbbf24; font-size: 14px; }
.location-types { font-size: 12px; color: #8899aa; display: flex; flex-wrap: wrap; gap: 4px; }
.location-type-tag { background: #1e2a35; padding: 2px 6px; border-radius: 4px; }
.info-grid { display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.info-row { display: flex; gap: 8px; align-items: flex-start; }
.info-icon { color: #8899aa; width: 16px; text-align: center; }
.info-content { flex-grow: 1; word-break: break-word; }
.description-area { width: 100%; min-height: 100px; resize: vertical; }
.panel-actions { display: flex; flex-direction: column; gap: 12px; margin-top: auto; padding-top: 16px; border-top: 1px solid #1e2a35; }
.action-row { display: flex; gap: 8px; }
.action-row select { flex-grow: 1; }
.assigned-days { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.assigned-day-tag { background: rgba(59, 130, 246, 0.1); color: #60a5fa; padding: 4px 8px; border-radius: 4px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.assigned-day-tag .remove-day { cursor: pointer; color: #8899aa; }
.assigned-day-tag .remove-day:hover { color: #ef4444; }

/* Toasts */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { background: #1a2332; color: #e1e8ed; padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); border-left: 4px solid #3b82f6; font-size: 14px; animation: slideUp 0.3s ease forwards; pointer-events: auto; }
.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.fade-out { animation: fadeOut 0.3s ease forwards; }

@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(10px); opacity: 0; } }

/* Day Directions Button */
.day-directions-btn {
    font-size: 14px; cursor: pointer; margin-left: auto; opacity: 0.5;
    transition: opacity 0.15s; flex-shrink: 0;
}
.day-directions-btn:hover { opacity: 1; }

/* Directions Panel */
.directions-summary {
    display: flex; gap: 12px; flex-wrap: wrap;
    padding: 12px; background: rgba(59,130,246,0.06);
    border: 1px solid rgba(59,130,246,0.15); border-radius: 8px;
}
.directions-stat {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 90px;
}
.directions-stat-icon { font-size: 20px; }
.directions-stat-value { font-size: 16px; font-weight: 700; color: #e1e8ed; }
.directions-stat-label { font-size: 11px; color: #8899aa; }
.directions-legs { display: flex; flex-direction: column; gap: 4px; }
.direction-leg { border-left: 2px solid #1e2a35; margin-left: 12px; padding-left: 12px; padding-bottom: 8px; }
.direction-leg-header { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.direction-leg-marker {
    background: #3b82f6; color: white; width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.direction-leg-from { font-size: 13px; font-weight: 600; color: #e1e8ed; }
.direction-leg-arrow { font-size: 12px; color: #3b82f6; padding: 2px 0; }
.direction-leg-to { font-size: 13px; font-weight: 600; color: #e1e8ed; }
.direction-steps { padding-left: 34px; }
.direction-step {
    font-size: 12px; color: #8899aa; padding: 3px 0;
    border-bottom: 1px solid rgba(30,42,53,0.5); line-height: 1.5;
}
.direction-step:last-child { border-bottom: none; }
.direction-step b { color: #e1e8ed; }
.step-dist { color: #556677; font-size: 11px; margin-left: 4px; }

/* Lightbox */
.lightbox {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.92); z-index: 200;
    display: flex; align-items: center; justify-content: center;
}
.lightbox-img {
    max-width: 90vw; max-height: 90vh; object-fit: contain;
    cursor: pointer; user-select: none;
}
.lightbox-nav {
    position: absolute; top: 0; width: 80px; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; color: rgba(255,255,255,0.5); cursor: pointer;
    transition: color 0.2s; user-select: none;
}
.lightbox-nav:hover { color: #fff; }
.lightbox-prev { left: 0; }
.lightbox-next { right: 0; }
.lightbox-counter {
    position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,0.6); font-size: 14px;
}

/* Tags List */
.tag-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 16px; font-size: 13px; cursor: default;
    transition: background 0.15s;
}
.tag-item:hover { background: rgba(255,255,255,0.03); }
.tag-name { flex-grow: 1; text-transform: capitalize; }
.tag-count { color: #8899aa; font-size: 11px; background: #1e2a35; padding: 1px 6px; border-radius: 8px; }
.tag-visibility {
    font-size: 14px; cursor: pointer; opacity: 0.6; transition: opacity 0.15s;
    flex-shrink: 0; padding: 0 2px;
}
.tag-visibility:hover { opacity: 1; }
.tag-visibility.tag-hidden { opacity: 0.25; }

/* InfoWindow overrides */
.gm-style .gm-style-iw-c { background-color: #1a2332 !important; color: #e1e8ed !important; border-radius: 8px; padding: 12px !important; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }
.gm-style .gm-style-iw-t::after { display: none; }
.gm-style-iw-d { overflow: hidden !important; max-height: 300px !important; }
.gm-ui-hover-effect { filter: invert(1); }
.info-window-content { min-width: 200px; }
.info-window-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.info-window-type { font-size: 12px; color: #8899aa; margin-bottom: 8px; }
.info-window-btn { display: inline-block; background: #3b82f6; color: white; padding: 4px 12px; border-radius: 4px; font-size: 12px; cursor: pointer; text-align: center; width: 100%; transition: background 0.2s; }
.info-window-btn:hover { background: #2563eb; }
.info-window-list { max-height: 200px; overflow-y: auto; margin-top: 8px; padding-right: 4px; }
.info-window-list-item { padding: 8px 0; border-bottom: 1px solid #1e2a35; }
.info-window-list-item:last-child { border-bottom: none; }

/* Search Bar — top center */
.search-bar {
    position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
    z-index: 10; width: 400px; max-width: calc(100vw - 340px);
}
.search-input-wrap {
    display: flex; align-items: center; background: rgba(15, 20, 25, 0.92); backdrop-filter: blur(10px);
    border: 1px solid #1e2a35; border-radius: 8px; padding: 0 12px; transition: border-color 0.2s;
}
.search-input-wrap:focus-within { border-color: #3b82f6; box-shadow: 0 0 0 1px #3b82f6; }
.search-icon { color: #8899aa; font-size: 14px; margin-right: 8px; flex-shrink: 0; }
.search-input {
    flex-grow: 1; background: transparent !important; border: none !important; box-shadow: none !important;
    padding: 10px 0 !important; font-size: 14px; color: #e1e8ed; width: 100%;
}
.search-input::placeholder { color: #556677; }
.search-clear {
    background: transparent; color: #8899aa; font-size: 18px; padding: 4px; border-radius: 4px;
    flex-shrink: 0; cursor: pointer; transition: color 0.2s;
}
.search-clear:hover { color: #e1e8ed; }
.search-results {
    margin-top: 4px; background: rgba(15, 20, 25, 0.95); backdrop-filter: blur(10px);
    border: 1px solid #1e2a35; border-radius: 8px; max-height: 400px; overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.search-result-item {
    padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
    border-bottom: 1px solid rgba(30, 42, 53, 0.6); transition: background 0.15s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: rgba(59, 130, 246, 0.08); }
.search-result-icon { color: #3b82f6; font-size: 16px; margin-top: 2px; flex-shrink: 0; }
.search-result-info { flex-grow: 1; min-width: 0; }
.search-result-name { font-size: 13px; font-weight: 600; color: #e1e8ed; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-address { font-size: 11px; color: #8899aa; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { display: flex; gap: 8px; font-size: 11px; color: #667788; margin-top: 3px; }
.search-loading { padding: 16px; text-align: center; color: #8899aa; font-size: 13px; }
.search-no-results { padding: 16px; text-align: center; color: #8899aa; font-size: 13px; font-style: italic; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .sidebar { width: 100%; transform: translateX(-100%); }
    .sidebar.collapsed { transform: translateX(-100%); }
    .sidebar:not(.collapsed) { transform: translateX(0); }
    .sidebar-close-btn { display: inline-flex; }
    .sidebar-toggle { opacity: 1; pointer-events: auto; }
    .sidebar.collapsed ~ .sidebar-toggle { opacity: 1; pointer-events: auto; }
    .right-panel { width: 100%; transform: translateX(100%); }
    .right-panel.open { transform: translateX(0); }
    .search-bar { width: calc(100% - 80px); max-width: none; left: 50%; }
    .toast-container { right: 12px; bottom: 12px; }
}
