/* -------------------------------------
   SMART CITY - CSS STYLES
   ------------------------------------- */

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

body {
    font-family: 'Fredoka', sans-serif;
    color: #333;
    background-color: #f3f4f6;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

/* TYPOGRAPHY & COLORS */
:root {
    --primary: #4F46E5;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #1f2937;
    --light: #f9fafb;
    --road: #374151;
    --building: #9ca3af;
    
    /* Day colors */
    --sky-color: #e0f2fe;
    --sun-color: #fde047;
}

.night-mode-vars {
    --sky-color: #0f172a;
    --sun-color: #e2e8f0; /* moon */
}

h1, h2, h3, h4 { color: var(--dark); margin-bottom: 15px; }
h2 { font-size: 2rem; }

/* UTILITIES */
.hidden { display: none !important; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }

/* NAVBAR */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 40px; background-color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky; top: 0; z-index: 100;
}
.logo { font-size: 1.5rem; font-weight: 600; color: var(--primary); }
.nav-links { display: flex; list-style: none; gap: 20px; }
.nav-links a { text-decoration: none; color: var(--dark); font-weight: 500; }
.nav-links a:hover { color: var(--primary); }

/* BUTTONS */
.btn {
    padding: 8px 16px; background-color: var(--primary); color: white;
    border: none; border-radius: 20px; cursor: pointer; font-family: inherit;
    font-weight: 500; transition: 0.2s;
}
.btn:hover { background-color: #4338ca; transform: translateY(-2px); }
.btn-outline { background-color: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline.active, .btn-outline:hover { background-color: var(--primary); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.9rem; }
.btn-large { padding: 15px 30px; font-size: 1.2rem; border-radius: 30px; }
.btn-primary { background-color: var(--primary); }
.btn-danger { background-color: var(--danger); }
.btn-info { background-color: var(--secondary); }
.btn-warning { background-color: var(--accent); color: white; }

/* =========================================
   MAIN CITY SCENE
   ========================================= */
.city-scene-container {
    position: relative;
    height: 65vh;
    min-height: 500px;
    background-color: var(--sky-color);
    transition: background-color 2s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* SKY, SUN/MOON, CLOUDS, STARS */
.sky { position: absolute; inset: 0; }
.sun {
    position: absolute; top: 40px; right: 80px; width: 60px; height: 60px;
    background-color: var(--sun-color); border-radius: 50%;
    box-shadow: 0 0 30px var(--sun-color);
    transition: background-color 2s, box-shadow 2s;
}
.stars {
    position: absolute; inset: 0;
    background-image: radial-gradient(white 1px, transparent 1px);
    background-size: 50px 50px; opacity: 0.4;
}
.clouds { position: absolute; top: 20px; left: 0; width: 100%; height: 100px; }
.cloud {
    position: absolute; background: white; border-radius: 20px;
    opacity: 0.8; animation: moveClouds linear infinite;
}
.c1 { width: 100px; height: 40px; top: 20px; animation-duration: 40s; }
.c2 { width: 140px; height: 50px; top: 50px; animation-duration: 30s; animation-delay: -10s; }
.c3 { width: 80px; height: 30px; top: 10px; animation-duration: 50s; animation-delay: -25s; }
@keyframes moveClouds { 0% { left: -150px; } 100% { left: 100%; } }

/* RAIN */
.rain-container { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.drop {
    position: absolute; background: rgba(255,255,255,0.6);
    width: 2px; height: 15px; animation: rain 0.5s linear infinite;
}
@keyframes rain { 0% { transform: translateY(-10px); } 100% { transform: translateY(100vh); } }

/* CITY LANDSCAPE (Buildings, Trees, Waste, Parking) */
.city-landscape {
    position: relative; height: 250px; width: 100%;
    display: flex; align-items: flex-end; z-index: 10;
}

/* BUILDINGS */
.buildings { display: flex; align-items: flex-end; gap: 10px; margin-left: 5%; }
.building {
    background-color: var(--building); padding: 10px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 5px;
    border-radius: 5px 5px 0 0;
}
.b1 { width: 70px; height: 140px; }
.b2 { width: 90px; height: 200px; background-color: #6b7280; }
.b3 { width: 80px; height: 160px; }
.b4 { width: 100px; height: 220px; background-color: #4b5563; }
.b5 { width: 70px; height: 130px; background-color: #374151; }

.window { background-color: #1f2937; border-radius: 2px; transition: 0.3s; }
.window.on { background-color: #fde047; box-shadow: 0 0 10px rgba(253, 224, 71, 0.4); }

/* TREES */
.trees { display: flex; gap: 20px; margin-left: 20px; }
.tree { width: 15px; height: 30px; background-color: #78350f; position: relative; }
.tree::after {
    content: ''; position: absolute; bottom: 15px; left: -12px;
    width: 40px; height: 40px; background-color: var(--success); border-radius: 50%;
}

/* STREET LIGHTS */
.street-lights { position: absolute; bottom: 0; width: 100%; display: flex; justify-content: space-around; pointer-events: none; }
.street-light { width: 6px; height: 80px; background-color: #4b5563; position: relative; }
.street-light::before {
    content: ''; position: absolute; top: -10px; left: -15px; width: 40px; height: 10px;
    background-color: #4b5563; border-radius: 5px;
}
.light-bulb {
    position: absolute; top: -5px; left: -10px; width: 10px; height: 10px;
    background-color: #d1d5db; border-radius: 50%; transition: 0.3s;
}
.street-light.on .light-bulb {
    background-color: #fef08a; box-shadow: 0 0 30px 15px rgba(253, 224, 71, 0.4);
}

/* WASTE BINS */
.waste-bins-scene {
    position: absolute; bottom: 10px; right: 35%; display: flex; gap: 10px;
}
.waste-bin {
    width: 25px; height: 35px; background-color: #d1d5db; border: 2px solid #9ca3af;
    border-radius: 0 0 3px 3px; position: relative;
}
.bin-fill { position: absolute; bottom: 0; left: 0; width: 100%; background-color: var(--success); transition: height 1s; }

/* PARKING LOT */
.parking-lot {
    position: absolute; bottom: 0; right: 5%; width: 200px; height: 60px;
    background-color: #4b5563; display: flex; gap: 5px; padding: 5px;
    border: 2px solid #9ca3af; border-bottom: none; border-radius: 5px 5px 0 0;
}
.parking-spot { flex: 1; border: 1px dashed white; position: relative; display: flex; align-items: center; justify-content: center; }
.parked-car { width: 20px; height: 40px; border-radius: 5px; }

/* =========================================
   ROAD & TRAFFIC
   ========================================= */
.road-container {
    height: 120px; width: 100%; background-color: var(--road);
    position: relative; z-index: 20; border-top: 4px solid #9ca3af;
}
.road-divider {
    position: absolute; top: 50%; left: 0; width: 100%; height: 4px; transform: translateY(-50%);
    background-image: linear-gradient(to right, white 50%, transparent 50%); background-size: 60px 100%;
}

/* PEDESTRIAN CROSSING */
.pedestrian-crossing {
    position: absolute; top: 0; left: 60%; width: 60px; height: 100%;
    display: flex; flex-direction: column; justify-content: space-around;
}
.stripe { width: 100%; height: 15px; background-color: white; }

/* PEDESTRIAN */
.pedestrian {
    position: absolute; left: 62%; font-size: 24px; transition: top 3s linear;
}
.pedestrian.waiting { top: -30px; }
.pedestrian.crossing { top: 130px; } /* crosses road */

/* TRAFFIC LIGHT */
.traffic-light-post {
    position: absolute; top: -80px; left: 58%; width: 8px; height: 80px;
    background-color: #111827; z-index: 25;
}
.traffic-light-box {
    position: absolute; top: -10px; left: -10px; width: 28px; padding: 5px;
    background-color: #111827; border-radius: 10px; display: flex; flex-direction: column; gap: 5px;
}
.t-light { width: 18px; height: 18px; border-radius: 50%; background-color: #374151; opacity: 0.3; transition: 0.2s; }
.t-light.active { opacity: 1; }
.t-red.active { background-color: var(--danger); box-shadow: 0 0 10px var(--danger); }
.t-yellow.active { background-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.t-green.active { background-color: var(--success); box-shadow: 0 0 10px var(--success); }

/* VEHICLES */
.vehicle {
    position: absolute; height: 35px; border-radius: 8px 8px 0 0;
    z-index: 22; display: flex; align-items: center; justify-content: center;
    font-size: 24px; /* for emoji cars */
}

/* Standard Cars (using animation) */
.std-car { width: 70px; bottom: 65px; /* Top lane */ }
.std-car::after { content: ''; position: absolute; right: 5px; top: 10px; width: 15px; height: 10px; background: white; opacity: 0.5; border-radius: 2px;}

.car-red { background-color: var(--danger); }
.car-blue { background-color: var(--secondary); }
.car-yellow { background-color: var(--accent); }
.car-green { background-color: var(--success); }
.car-purple { background-color: #a855f7; }

/* Car Animations */
@keyframes drive { 0% { left: -100px; } 100% { left: 100vw; } }
.moving { animation-name: drive; animation-timing-function: linear; animation-iteration-count: infinite; }
.speed-slow { animation-duration: 15s; }
.speed-medium { animation-duration: 12s; }
.speed-fast { animation-duration: 9s; }

/* Headlights for night */
.night-mode-vars .std-car::before {
    content: ''; position: absolute; right: -40px; top: 15px; width: 40px; height: 20px;
    background: linear-gradient(to right, rgba(255,255,255,0.8), transparent);
    clip-path: polygon(0 0, 100% -50%, 100% 150%, 0 100%); pointer-events: none;
}

/* Dispatch Vehicles (Truck, Ambulance, etc. - using transition) */
.garbage-truck {
    width: 100px; background-color: #f97316; bottom: 15px; left: -150px;
    transition: left 8s linear;
}
.garbage-truck::before { content: '♻️'; padding-left: 10px; color: white; font-size: 16px; }

.ambulance, .police-car, .fire-truck {
    width: 50px; bottom: 15px; left: -100px; background: transparent;
    transition: left 5s linear;
}

/* =========================================
   DEMO BUTTON SECTION
   ========================================= */
.demo-section {
    text-align: center; padding: 20px; background-color: white;
    border-bottom: 2px solid #e5e7eb;
}
.demo-message { color: var(--success); font-weight: 600; margin-top: 10px; font-size: 1.1rem; }

/* =========================================
   CONTROLS & DASHBOARDS
   ========================================= */
.dashboard-wrapper {
    display: flex; flex-direction: column; gap: 20px; padding: 40px 20px;
    max-width: 1200px; margin: 0 auto;
}
@media (min-width: 992px) {
    .dashboard-wrapper { flex-direction: row; }
    .control-panel { flex: 1; }
    .live-dashboards { flex: 1; }
}

.control-panel, .stats-panel, .activity-panel {
    background: white; border-radius: 15px; padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px;
}

.control-group { margin-bottom: 25px; border-bottom: 1px solid #f3f4f6; padding-bottom: 15px; }
.control-group h3 { font-size: 1.1rem; color: #6b7280; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.control-status { font-weight: 500; color: var(--primary); }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; }
.stat-card { background: #f9fafb; padding: 15px; border-radius: 10px; text-align: center; border: 1px solid #e5e7eb; }
.stat-card h4 { font-size: 0.9rem; color: #6b7280; margin-bottom: 5px; }
.stat-card p { font-size: 1.4rem; font-weight: 600; color: var(--primary); }

/* ACTIVITY */
.activity-list {
    list-style: none; max-height: 250px; overflow-y: auto;
}
.activity-list li {
    padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 0.95rem;
    position: relative; padding-left: 20px;
}
.activity-list li::before {
    content: '•'; position: absolute; left: 0; color: var(--primary); font-weight: bold;
}

/* =========================================
   MAP SECTION
   ========================================= */
.map-section { padding: 40px 20px; max-width: 800px; margin: 0 auto; text-align: center; }
.city-map {
    position: relative; background: #e5e7eb; padding: 20px; border-radius: 15px;
}
.map-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.map-cell {
    background: white; height: 80px; border-radius: 8px; display: flex;
    align-items: center; justify-content: center; font-weight: 500; font-size: 0.9rem;
    cursor: pointer; transition: 0.2s; box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.map-cell:hover { transform: scale(1.05); background: var(--sky-color); }
.road-h, .road-v, .road-cross { background: #9ca3af; box-shadow: none; cursor: default; }
.road-h:hover, .road-v:hover, .road-cross:hover { transform: none; background: #9ca3af; }

.map-popup {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: white; padding: 20px; border-radius: 10px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    z-index: 50; border: 2px solid var(--primary); min-width: 200px;
}
.map-popup h3 { margin-bottom: 5px; }
.map-popup p { margin-bottom: 15px; color: #4b5563; }

/* =========================================
   LEARNINGS & FOOTER
   ========================================= */
.learnings-section { padding: 40px 20px; text-align: center; background: white; }
.tags-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tag-card { padding: 8px 16px; background: var(--primary); color: white; border-radius: 20px; font-weight: 500; }
.tag-card.outline { background: white; color: var(--primary); border: 1px solid var(--primary); }

.footer { background: var(--dark); color: white; text-align: center; padding: 30px 20px; }
.footer-title { font-size: 1.2rem; font-weight: 500; margin-bottom: 5px; }
.footer-subtitle { color: #9ca3af; font-size: 0.9rem; }
