/* EvacuRoute - Application Styles */

/* Scrollbar */
.scrollbar-thin::-webkit-scrollbar { width: 6px; }
.scrollbar-thin::-webkit-scrollbar-track { background: #1e293b; }
.scrollbar-thin::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }
.scrollbar-thin::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Safe area for iOS bottom bar */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0px); }

/* Map container */
.map-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 0.75rem;
    overflow: hidden;
    z-index: 1;
}

.map-fullscreen { position: fixed; inset: 0; z-index: 30; border-radius: 0; min-height: 100vh; }

/* Leaflet overrides for dark theme */
.leaflet-container { background: #1e293b; font-family: inherit; }
.leaflet-control-zoom a { background: #1e293b !important; color: #e2e8f0 !important; border-color: #334155 !important; }
.leaflet-control-zoom a:hover { background: #334155 !important; }
.leaflet-popup-content-wrapper { background: #1e293b; color: #e2e8f0; border-radius: 0.75rem; box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
.leaflet-popup-tip { background: #1e293b; }
.leaflet-popup-content { margin: 0.75rem 1rem; font-size: 0.875rem; }
.leaflet-control-attribution { background: rgba(15,23,42,0.8) !important; color: #64748b !important; }
.leaflet-control-attribution a { color: #60a5fa !important; }

/* Custom markers */
.hazard-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.evac-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #2563eb;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border: 2px solid white;
}

.evac-marker i { transform: rotate(45deg); }

/* Pulse animation for alerts */
@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.pulse-marker::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid currentColor;
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes safe-btn-pulse {
    0% { transform: scale(0.92); opacity: 0.9; }
    70% { transform: scale(1.15); opacity: 0; }
    100% { transform: scale(1.15); opacity: 0; }
}

.safe-pulse-btn {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 9999px;
    background: #16a34a;
    color: #ffffff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.08em;
    box-shadow: 0 18px 45px rgba(0,0,0,0.35);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.safe-pulse-btn:active { transform: scale(0.98); }
.safe-pulse-btn:hover { filter: brightness(1.03); }

.safe-pulse-btn::before {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 9999px;
    border: 2px solid rgba(34,197,94,0.7);
    animation: safe-btn-pulse 1.6s ease-out infinite;
}

.safe-pulse-btn::after {
    content: '';
    position: absolute;
    inset: -36px;
    border-radius: 9999px;
    border: 2px solid rgba(34,197,94,0.35);
    animation: safe-btn-pulse 1.6s ease-out infinite;
    animation-delay: 0.35s;
}

.safe-pulse-btn__label { font-size: 44px; }

.safe-pulse-btn--active {
    background: #15803d;
}

@media (max-width: 640px) {
    .safe-pulse-btn { width: 190px; height: 190px; }
    .safe-pulse-btn__label { font-size: 38px; }
}

/* Dashboard stat cards */
.stat-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all 0.2s;
}
.stat-card:hover { border-color: #475569; transform: translateY(-1px); }

/* Loading spinner */
.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #334155;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Toast notifications */
.toast-container { position: fixed; top: 5rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
.toast-info { background: #2563eb; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.swal2-container { z-index: 999999 !important; }

/* Mobile-specific styles */
@media (max-width: 768px) {
    .map-container { min-height: 300px; border-radius: 0; }
    .stat-card { padding: 1rem; }
}

/* Dashboard grid */
.dashboard-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Activity feed */
.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #334155;
}
.activity-item:last-child { border-bottom: none; }

/* Status badge animations */
.status-pulse { animation: statusPulse 2s ease-in-out infinite; }
@keyframes statusPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Form styles */
.form-input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.625rem 0.875rem;
    color: #e2e8f0;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.form-input::placeholder { color: #64748b; }

.form-label { display: block; margin-bottom: 0.375rem; font-size: 0.875rem; font-weight: 500; color: #cbd5e1; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-outline { background: transparent; color: #e2e8f0; border: 1px solid #475569; }
.btn-outline:hover { background: #1e293b; border-color: #64748b; }

/* Card component */
.card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* Table styles */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 0.75rem 1rem; text-align: left; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; color: #94a3b8; border-bottom: 1px solid #334155; }
.data-table td { padding: 0.75rem 1rem; font-size: 0.875rem; border-bottom: 1px solid #1e293b; }
.data-table tbody tr:hover { background: #1e293b; }

:root {
    --app-banner-h: 0px;
    --app-header-h: 64px;
}

.has-alert-banner {
    --app-banner-h: 40px;
}

@media (max-width: 640px) {
    .has-alert-banner {
        --app-banner-h: 56px;
    }
}

.app-topbar {
    top: var(--app-banner-h) !important;
}

.app-content {
    padding-top: calc(var(--app-banner-h) + var(--app-header-h)) !important;
}

#sidebar {
    top: calc(var(--app-banner-h) + var(--app-header-h)) !important;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

#notif-panel,
#msg-panel {
    top: calc(var(--app-banner-h) + var(--app-header-h)) !important;
}

.toast-container {
    top: calc(var(--app-banner-h) + 5rem) !important;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 240px);
    min-height: 420px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.chat-composer {
    position: sticky;
    bottom: 0;
    background: #1e293b;
    border-top: 1px solid #334155;
    padding: 1rem;
}

.chat-image-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.chat-image-thumb {
    width: 100%;
    height: 96px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.chat-location-map {
    width: 100%;
    height: 140px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
