:root {
    --bg-color: #0d1117;
    --panel-bg: rgba(22, 27, 34, 0.75);
    --panel-border: rgba(255, 255, 255, 0.1);
    --primary-color: #00d26a; /* Emerald green */
    --accent-color: #d4af37; /* Gold */
    --text-primary: #ffffff;
    --text-secondary: #8b949e;
    --font-family: 'Tajawal', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.app-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 10px 20px;
    gap: 15px;
}

.logo-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-header h1 {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-color), #f9e596);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.dashboard {
    position: absolute;
    bottom: 20px;
    left: 10px;
    right: 10px;
    z-index: 10;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Compass Styles */
.compass-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.compass {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(22,27,34,1) 0%, rgba(13,17,23,1) 100%);
    box-shadow: 
        inset 0 0 15px rgba(0,0,0,0.8),
        0 0 20px rgba(0, 210, 106, 0.2);
    border: 2px solid var(--panel-border);
    display: flex;
    justify-content: center;
    align-items: center;
}

.compass-ring {
    position: absolute;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    border: 1px dashed var(--accent-color);
    opacity: 0.5;
    animation: pulse 4s infinite linear;
}

.compass-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 50px solid var(--primary-color);
    transform-origin: bottom center;
    bottom: 50%;
    transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 -2px 4px rgba(0,210,106,0.6));
}

.compass-center {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    z-index: 2;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    gap: 10px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 12px 5px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.stat-icon {
    font-size: 1.2rem;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

/* Permission Overlay */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    background: var(--bg-color); /* solid background for initial screen */
    transition: opacity 0.5s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.permission-content {
    text-align: center;
    padding: 30px;
    max-width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.overlay-logo {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 2px solid var(--accent-color);
}

.permission-content h2 {
    color: var(--accent-color);
}

.permission-content p {
    color: var(--text-secondary);
    line-height: 1.5;
}

.primary-btn {
    background: linear-gradient(135deg, #00d26a, #009e4f);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 210, 106, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:active {
    transform: scale(0.95);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: rgba(13, 17, 23, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    transition: opacity 0.3s;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(212, 175, 55, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.leaflet-control-attribution {
    background: transparent !important;
    color: var(--text-secondary) !important;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(0.95); opacity: 0.5; }
}
