:root {
    --bg-color: #121212;
    --panel-bg: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #1e8d34;
    --accent-glow: rgba(30, 141, 52, 0.5);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #dc2525;
    --border-color: #333333;
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden; /* Mobile app feel */
    height: 100vh;
    height: 100dvh;
    touch-action: none; /* Prevent zoom */
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Header */
.app-header {
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.header-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff, #a0a0a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-weight: 600;
}

.status-badge.pulse {
    animation: pulse 2s infinite;
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger-color);
    border-color: rgba(239, 68, 68, 0.3);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Map */
.map-container {
    flex: 1;
    width: 100%;
    z-index: 1;
    touch-action: auto; /* Allow map interaction */
}

/* Bottom Sheet */
.info-panel {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    border-top: 1px solid rgba(255,255,255,0.1);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.stat-card {
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.stat-icon {
    font-size: 1.1rem;
    color: var(--accent-color);
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0px;
}

.stat-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    font-size: 0.8rem;
    font-weight: 700;
}

.stat-value.highlight {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-glow);
}

.location-details {
    background: rgba(20, 20, 20, 0.4);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid rgba(255,255,255,0.05);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.detail-text {
    font-size: 0.85rem;
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Leaflet Customizations for Dark Mode */
.leaflet-container {
    background: #121212;
}
.leaflet-layer,
.leaflet-control-zoom-in,
.leaflet-control-zoom-out,
.leaflet-control-attribution {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.leaflet-routing-container {
    display: none !important; /* Hide routing textual instructions */
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.form-group {
    margin-bottom: 16px;
}

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

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(0,0,0,0.2);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-color);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    width: 100%;
}

.btn-secondary, .btn-primary {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent-color);
    color: white;
}

/* Login Screen */
.login-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: var(--panel-bg);
    padding: 32px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 350px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.login-box h2 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 1.5rem;
}
.login-box p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}
