/* Immersive "City Scanner" Theme */
:root {
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --accent: #FFAB00;
    --text-main: #FFFFFF;
    --card-bg: rgba(0, 0, 0, 0.8);
    --card-border: 1px solid rgba(255, 255, 255, 0.2);
    --text-primary: #fff;
    --text-secondary: #ccc;
    --pill-bg: rgba(255, 255, 255, 0.1);
    --pill-border: 1px solid rgba(255, 255, 255, 0.2);
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    /* Full app feel */
    background: #000;
    transition: background 0.3s;
    color: var(--text-main);
}

body.light-mode {
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-main: #111;
    --card-bg: rgba(255, 255, 255, 0.95);
    background: #e0e0e0;
}

/* Override components for Light Mode */
body.light-mode .scanner-header .logo-small,
body.light-mode .autocad-bar {
    color: #111;
}

body.light-mode .logo-small span {
    color: var(--accent) !important;
}

body.light-mode .card-title,
body.light-mode .carousel-title {
    color: #000;
}

body.light-mode .card-location,
body.light-mode .sector-label {
    color: #000 !important;
}

body.light-mode .category-pill,
body.light-mode .xray-btn {
    background: #ffffff;
    color: #000000 !important;
    font-weight: 600;
    border: 1px solid #999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

body.light-mode .xray-btn.active {
    background: #FFAB00;
    border-color: #FFAB00;
    color: #000;
}

body.light-mode .project-card-cinematic {
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Light Mode Card Overlay needs to be readable */
body.light-mode .card-overlay {
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0) 100%);
    color: #000;
}

body.light-mode .autocad-bar {
    background: rgba(255, 255, 255, 0.95);
    border-color: #ccc;
    color: #333;
}

body.light-mode .autocad-input {
    color: #333;
}

body.light-mode .autocad-input::placeholder {
    color: #666;
}

body.light-mode .autocad-prompt {
    color: #555;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111;
    /* Fallback */
    z-index: 0;
}

body.light-mode #map .leaflet-tile-pane {
    filter: brightness(0.85);
}

/* Floating Top Bar (Logo + Search) */
.scanner-header {
    position: absolute;
    top: 20px;
    left: 40px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-small {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    letter-spacing: -1px;
}

.logo-small span {
    color: var(--accent);
}

.scanner-search-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    width: 300px;
    transition: width 0.3s ease;
    box-shadow: var(--glass-shadow);
}

.scanner-search-container:focus-within {
    width: 450px;
    background: rgba(0, 0, 0, 0.6);
}

.scanner-search-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 1rem;
    margin-left: 10px;
    width: 100%;
    outline: none;
}

.scanner-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

/* X-Ray Toggles (Top Right) */
.xray-controls {
    position: absolute;
    top: 20px;
    right: 40px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.xray-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    box-shadow: var(--glass-shadow);
}

.xray-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.xray-btn.active {
    background: var(--accent);
    color: black;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255, 171, 0, 0.4);
}

/* Netflix-Style Bottom Carousel */
.bottom-carousel-container {
    position: absolute;
    bottom: 0;
    /* Background bar stays at the very bottom */
    left: 0;
    width: 100%;
    height: 300px;
    /* Increased height to accommodate the lift */
    z-index: 100;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 60px;
    /* This lifts ONLY the pictures up away from the crop zone */
    pointer-events: none;
    /* Let clicks pass through empty space to map */
}

.bottom-carousel-container>* {
    pointer-events: auto;
    /* Re-enable clicks for items */
}

.carousel-title {
    padding-left: 40px;
    font-size: 0.9rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.carousel-scroll-area {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 40px 20px 40px;
}

/* Category Label */
.sector-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.carousel-scroll-area::-webkit-scrollbar {
    height: 8px;
    /* give it a visible height */
}

.carousel-scroll-area::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.carousel-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(255, 171, 0, 0.8);
    /* Accent color scrollbar */
    border-radius: 10px;
}

/* Hide scrollbar Chrome */

.project-card-cinematic {
    flex: 0 0 210px;
    height: auto;
    min-height: 180px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.project-card-cinematic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.project-card-cinematic:hover {
    transform: translateY(-8px);
    z-index: 10;
    border-color: var(--accent);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.project-card-cinematic:hover img {
    transform: scale(1.1);
}

/* Light Mode Overrides for cards */
body.light-mode .project-card-cinematic {
    background: #fff;
    border-color: #ddd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

body.light-mode .card-title {
    color: #000;
}

.card-overlay {
    position: relative;
    bottom: auto;
    left: auto;
    width: 100%;
    padding: 12px;
    background: transparent;
    flex-grow: 1;
}

.card-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0;
}

.card-location {
    font-size: 0.8rem;
    color: #ccc;
}

/* Micro-Trailer Tooltip */
.leaflet-popup-content-wrapper {
    background: rgba(10, 10, 10, 0.9) !important;
    backdrop-filter: blur(10px);
    color: white !important;
    border: 1px solid #333;
    border-radius: 12px !important;
    padding: 0 !important;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 200px !important;
}

.leaflet-popup-tip {
    background: rgba(10, 10, 10, 0.9) !important;
}

.micro-trailer-popup {
    position: relative;
    width: 200px;
    height: 120px;
}

.micro-trailer-popup img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.micro-trailer-info {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 8px;
    background: linear-gradient(to top, black, transparent);
    font-size: 0.8rem;
    font-weight: 700;
}