@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #ff4757;
    --primary-dark: #ff6b81;
    --secondary: #2ed573;
    --bg-dark: #121212;
    --surface: #1e1e1e;
    --surface-glass: rgba(30, 30, 30, 0.7);
    --text-primary: #ffffff;
    --text-secondary: #a4b0be;
    --border: rgba(255, 255, 255, 0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Glassmorphism utilities */
.glass {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--radius);
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(45deg, #ff6b81, #ff4757);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Container */
.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 4px rgba(255, 71, 87, 0.1);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #ff2a3f);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Toggle Switch for Blood Donor */
.switch-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.2);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Map specific styles */
#map {
    width: 100%;
    height: calc(100vh - 200px);
    border-radius: var(--radius);
    z-index: 1; /* Keep map below modals */
}

.map-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    z-index: 1000; /* Above Leaflet map */
    display: flex;
    gap: 10px;
}

.map-controls select, .map-controls input[type="range"] {
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: white;
}

/* Leaflet Popup overrides for dark theme */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--surface) !important;
    color: white !important;
    border-radius: var(--radius-sm) !important;
}

.leaflet-popup-content h3 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    -webkit-text-fill-color: var(--primary);
}

.leaflet-popup-content .donor-call-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 15px;
    background: var(--secondary);
    color: #121212;
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
}

/* Modals / Sections */
.screen {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--surface);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success { border-left-color: var(--secondary); }

/* Loader */
.loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: none;
}
.loading .loader { display: block; }
.loading .btn-text { display: none; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    z-index: 1000;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    gap: 4px;
    transition: color 0.3s;
    cursor: pointer;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
