* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a2e;
    color: #eee;
    height: 100vh;
    overflow: hidden;
}

.screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
}

.hidden { display: none !important; }

.card {
    background: #16213e;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.card h1 { margin-bottom: 0.5rem; color: #4fc3f7; }
.card p { margin-bottom: 1.5rem; color: #aaa; }

.card input, .card select {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #333;
    border-radius: 6px;
    background: #0f3460;
    color: #eee;
    font-size: 1rem;
}

button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: #4fc3f7;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    margin: 0.25rem;
}

button:hover { background: #81d4fa; }

.error { color: #ef5350; margin-top: 0.5rem; }

#map, #admin-map {
    width: 100%;
    height: 100%;
    flex: 1;
    min-height: 0;
}

#map-screen {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
}

#status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(22, 33, 62, 0.9);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    z-index: 1000;
}

/* Admin layout */
#admin-container {
    display: flex;
    height: 100vh;
}

#sidebar {
    width: 320px;
    background: #16213e;
    padding: 1rem;
    overflow-y: auto;
    border-right: 1px solid #333;
}

#sidebar h1 { color: #4fc3f7; margin-bottom: 1rem; }
#sidebar h2 { margin: 1rem 0 0.5rem; color: #81d4fa; font-size: 1rem; }
#sidebar h3 { margin: 1rem 0 0.5rem; color: #81d4fa; font-size: 0.9rem; }

#sidebar input, #sidebar select {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #333;
    border-radius: 4px;
    background: #0f3460;
    color: #eee;
}

#sidebar ul { list-style: none; }
#sidebar li {
    padding: 0.5rem;
    margin: 0.25rem 0;
    background: #0f3460;
    border-radius: 4px;
    cursor: pointer;
}
#sidebar li:hover { background: #1a4080; }

main { flex: 1; }

#qr-container { margin-top: 1rem; text-align: center; }
#qr-container canvas { background: white; padding: 8px; border-radius: 4px; }

/* Rescue plan toolbar */
#plan-controls {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.plan-toolbar {
    display: flex;
    gap: 4px;
    background: rgba(22, 33, 62, 0.92);
    padding: 6px 10px;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.plan-toolbar button {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 4px;
    background: #0f3460;
    color: #eee;
    border: 1px solid #333;
}

.plan-toolbar button:hover { background: #1a4080; }
.plan-toolbar button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Start search button */
.start-btn {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 16px 32px;
    font-size: 1.3rem;
    background: #ff6d00;
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(255,109,0,0.4);
}

.start-btn:hover { background: #ff8f00; }
.start-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Countdown timer */
.countdown {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(22, 33, 62, 0.92);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 2rem;
    font-weight: bold;
    color: #ff6d00;
}

/* Danger alert */
.danger-alert {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    background: rgba(211, 47, 47, 0.95);
    color: white;
    padding: 20px 32px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 24px rgba(211,47,47,0.5);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.03); }
}

/* Found people panel */
#found-panel {
    display: inline-block;
    background: rgba(22, 33, 62, 0.92);
    padding: 8px 14px;
    border-radius: 8px;
}

#found-count {
    font-size: 0.9rem;
    color: #eee;
    font-weight: bold;
}

#found-person-btn {
    padding: 8px 14px;
    font-size: 0.85rem;
    background: #4caf50;
    border-radius: 6px;
}

/* Action controls (same position as plan toolbar) */
#action-controls {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.action-toggle-btn {
    padding: 8px 14px;
    font-size: 0.9rem;
    border-radius: 6px;
    background: #0f3460;
    color: #eee;
    border: 1px solid #333;
}

.action-toggle-btn:hover { background: #1a4080; }
.action-toggle-btn.active {
    background: #4caf50;
    color: #fff;
    border-color: #4caf50;
}

/* Accept plan button */
.accept-plan-btn {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 14px 28px;
    font-size: 1.1rem;
    background: #4fc3f7;
    color: #1a1a2e;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(79,195,247,0.4);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal-card {
    background: #16213e;
    border-radius: 12px;
    padding: 24px;
    min-width: 280px;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-card h3 { margin: 0 0 12px; color: #eee; font-size: 1.1rem; }
.modal-card p { margin: 0 0 16px; color: #ccc; font-size: 0.95rem; }
.modal-card input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #0f3460;
    color: #eee;
    font-size: 1rem;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.modal-buttons { display: flex; gap: 10px; justify-content: flex-end; }
.modal-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
}
.modal-btn-ok { background: #4caf50; color: #fff; }
.modal-btn-cancel { background: #555; color: #eee; }
.modal-btn:hover { opacity: 0.85; }

/* All found alert */
.all-found-alert {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    background: rgba(76, 175, 80, 0.95);
    color: white;
    padding: 24px 36px;
    border-radius: 12px;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 4px 24px rgba(76,175,80,0.5);
}
