:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(20, 25, 40, 0.95);
    --primary: #3b82f6;
    --accent: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --safe: #22c55e;
    --warning: #eab308;
    --font-main: 'Outfit', sans-serif;
}

body.light-mode {
    --bg-dark: #f0f9ff;
    --panel-bg: rgba(255, 255, 255, 0.9);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #2563eb;
}

body.light-mode .input-group,
body.light-mode .route-card,
body.light-mode .mode-option span {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
}

body.light-mode .route-card:hover {
    background: rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;

    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    height: 60px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 1000;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo {
    font-size: 1.5em;
}

.nav-title {
    font-weight: 700;
    font-size: 1.2em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}



/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--panel-bg);
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: translateY(20px);
    transition: transform 0.3s;
    max-height: 90vh;
    overflow-y: auto;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 1.5em;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--danger);
}

.modal-content h2 {
    font-size: 2em;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mission-text {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 30px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.feature-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.feature-icon {
    font-size: 2em;
    display: block;
    margin-bottom: 10px;
}

.feature-item h3 {
    margin-bottom: 8px;
    font-size: 1em;
}

.feature-item p {
    font-size: 0.85em;
    color: var(--text-muted);
}

.team-section {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.app-container {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Map takes full screen behind */
#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Control Panel Overlay */
.control-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 400px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 24px;
    z-index: 999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.header h1 {
    font-weight: 700;
    margin-bottom: 4px;
}

.ai-badge {
    font-size: 0.6em;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
}

.header p {
    color: var(--text-muted);
    font-size: 0.9em;
    margin-bottom: 20px;
}

/* Inputs */
.input-group {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 20px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon {
    font-size: 1.2em;
}

input {
    background: transparent;
    border: none;
    color: var(--text-main);
    width: 100%;
    padding: 8px 0;
    font-family: var(--font-main);
    font-size: 1em;
    outline: none;
    outline: none;
}

#gps-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0 8px;
    transition: transform 0.2s;
}

#gps-btn:hover {
    transform: scale(1.1);
}

.connector-line {
    height: 20px;
    border-left: 2px dotted var(--text-muted);
    margin-left: 9px;
    opacity: 0.3;
}

.transport-modes {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.mode-option {
    flex: 1;
    cursor: pointer;
}

.mode-option input {
    display: none;
}

.mode-option span {
    display: block;
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: 0.2s;
    font-size: 0.9em;
}

.mode-option input:checked+span {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}

/* Buttons */
.primary-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.sos-btn {
    width: 100%;
    margin-top: 20px;
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 10px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.sos-btn:hover {
    background: var(--danger);
    color: white;
}

/* Routes List */
.routes-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.route-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.route-card:hover,
.route-card.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.route-info h3 {
    font-size: 1em;
    margin-bottom: 4px;
}

.route-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.safety-badge {
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 700;
    color: #1a1a1a;
}

.safety-badge.green {
    background: var(--safe);
}

.safety-badge.yellow {
    background: var(--warning);
}

.safety-badge.red {
    background: var(--danger);
    color: white;
}

/* AI Panel */
.ai-panel {
    margin-top: 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.ai-header {
    font-weight: 600;
    color: #d8b4fe;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#ai-text {
    font-size: 0.9em;
    line-height: 1.5;
    color: #e2e8f0;
}

/* Utilities */
.hidden {
    display: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 600px) {
    .control-panel {
        width: 100%;
        top: auto;
        bottom: 0px;
        left: 0;
        border-radius: 20px 20px 0 0;
        max-height: 60vh;
    }
}

/* Marker Icons */
.police-icon,
.safe-icon {
    background: transparent !important;
    border: none !important;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.police-icon {
    z-index: 1000 !important;
}

.safe-icon {
    z-index: 900 !important;
}

.highlight-247 {
    filter: drop-shadow(0 0 8px #22c55e) !important;
    z-index: 1100 !important;
}

.badge-24h {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #22c55e;
    color: black;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* Floating Map Button */
.map-floating-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: white;
    color: #1a1a1a;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-floating-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    background: #f8fafc;
}

.map-floating-btn:active {
    transform: translateY(0);
}

body.dark-mode .map-floating-btn {
    background: #1e293b;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}

.splash-content {
    text-align: center;
    animation: fadeUp 0.8s ease-out;
}

.logo-pulse {
    font-size: 4em;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.splash-content h1 {
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.splash-content p {
    color: var(--text-muted);
    font-size: 1.1em;
    letter-spacing: 1px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}
