:root {
    --primary: #3b82f6;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text: #0f172a;
    --header: #0f172a;
    --border: #e2e8f0;
}

body.dark-mode {
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --text: #f1f5f9;
    --header: #020617;
    --border: #334155;
}

body { 
    font-family: 'Montserrat', sans-serif; 
    margin: 0; background: var(--bg); color: var(--text);
    display: flex; flex-direction: column; height: 100vh; transition: 0.3s;
    overflow: hidden;
}

/* --- AUTH LAYERS & LOADING STATE --- */
#login-overlay, #admin-auth-modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(2, 6, 23, 0.98); z-index: 10000; display: flex; align-items: center; justify-content: center;
}

.login-card { 
    background: #1e293b; padding: 40px; border-radius: 16px; text-align: center; 
    width: 340px; border: 1px solid #334155; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
}

/* Updated inputs to handle both Username and Password neatly */
.login-card input { 
    width: 100%; padding: 12px; margin: 10px 0; border-radius: 8px; border: 1px solid #334155; 
    background: #0f172a; color: white; outline: none; box-sizing: border-box;
}

.login-card button { 
    width: 100%; padding: 12px; margin-top: 10px; background: var(--primary); border: none; color: white; 
    border-radius: 8px; cursor: pointer; font-weight: 600; transition: 0.2s;
}

/* NEW: Loading Animations */
.fa-spin-slow {
    animation: fa-spin 2s infinite linear;
}

@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Disable button and fade slightly when initializing */
button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    filter: grayscale(0.5);
}

/* --- DASHBOARD LAYOUT --- */
#dashboard-content, #kobo-page { display: none; flex-direction: column; height: 100vh; }
header { background: var(--header); color: white; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; }

.nav-btn { 
    background: #334155; color: white; border: none; padding: 8px 16px; 
    border-radius: 6px; cursor: pointer; font-size: 0.75rem; margin-right: 8px; font-weight: 600;
}
.nav-btn.active { background: var(--primary); }

/* --- MAP & STATS --- */
#map-container { flex: 1; position: relative; display: flex; flex-direction: column; }
#map { flex: 1; z-index: 1; }
.stats-overlay { position: absolute; top: 20px; left: 20px; z-index: 999; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.stat-card { background: var(--card-bg); backdrop-filter: blur(10px); padding: 16px; border-radius: 12px; border: 1px solid var(--border); pointer-events: auto; }
.stat-card h3 { margin: 0; font-size: 0.7rem; color: #94a3b8; text-transform: uppercase; }
.stat-card p { margin: 4px 0 0; font-size: 1.4rem; font-weight: 600; }

.controls-overlay { position: absolute; top: 20px; right: 20px; z-index: 999; }
.toggle-btn { background: var(--primary); color: white; border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }

/* --- TABLE AREA --- */
#table-area { height: 35vh; padding: 20px; background: var(--bg); overflow-x: auto; border-top: 1px solid var(--border); }
.marker-pin { width: 30px; height: 30px; background: var(--primary); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: flex; align-items: center; justify-content: center; border: 2px solid white; }
.marker-pin i { transform: rotate(45deg); color: white; font-size: 12px; }

/* --- KOBO PAGE --- */
.iframe-container { flex: 1; padding: 15px; background: #020617; }
iframe { width: 100%; height: 100%; border-radius: 8px; border: 1px solid #334155; }