/* Core Styling Variables & Reset */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 30, 47, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    
    --primary: #ff5252;
    --primary-hover: #ff7373;
    --secondary: #3b82f6;
    --success: #10b981;
    --warning: #f59e0b;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.app-header {
    height: 60px;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 24px;
    animation: flicker 1.5s infinite alternate;
}

@keyframes flicker {
    0% { filter: drop-shadow(0 0 2px var(--primary)); }
    100% { filter: drop-shadow(0 0 10px var(--primary)); }
}

.app-header h1 {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.pulse-indicator {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.status-text {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

/* App Main Layout */
.app-layout {
    flex: 1;
    display: flex;
    height: calc(100vh - 60px);
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    height: 100%;
}

#live-map {
    height: 100%;
    width: 100%;
}

/* Styling Leaflet Popups */
.leaflet-container {
    background-color: var(--bg-color) !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #161e2f !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5) !important;
    border-radius: 8px !important;
}

.map-overlay-instructions {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    background: rgba(22, 30, 47, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translate(-50%, 0); }
    40% { transform: translate(-50%, -6px); }
    60% { transform: translate(-50%, -3px); }
}

.instruction-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color);
}

/* Sidebar Layout */
.sidebar-layout {
    width: 420px;
    background: #0f1624;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.sidebar-card h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

/* Form Styles */
.standard-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.form-group input[readonly] {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 8px rgba(255, 82, 82, 0.25);
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    padding: 12px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Feed Badge & Connection */
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header-row h2 {
    margin-bottom: 0;
}

.badge {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-connected {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-disconnected {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Incident Feed Area */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.feed-container::-webkit-scrollbar {
    width: 4px;
}

.feed-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.empty-feed-message {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 40px 0;
    border: 1px dashed rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

/* Feed Cards */
.feed-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transition: var(--transition);
}

.feed-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

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

.feed-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feed-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
}

.severity-tag {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.severity-low { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.severity-medium { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.severity-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

.feed-item-address {
    font-size: 11px;
    color: var(--text-muted);
}

.feed-item-desc {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-color);
}

.dispatch-info {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 8px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dispatch-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
}

.dispatch-team {
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dispatch-team::before {
    content: "🚒";
}

.dispatch-status {
    font-size: 10px;
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
}

/* Control actions buttons */
.dispatch-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 4px;
}

.btn-sm {
    font-size: 10px;
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.btn-sm-success:hover {
    background: rgba(16, 185, 129, 0.25);
    border-color: rgba(16, 185, 129, 0.4);
}

/* Custom Leaflet Map Pin Icons */
.custom-div-icon {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -16px 0 0 -16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: var(--transition);
}

.available-pin {
    background: rgba(16, 185, 129, 0.95);
    border-color: var(--success);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.busy-pin {
    background: rgba(239, 68, 68, 0.95);
    border-color: #ef4444;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.disaster-pin {
    background: rgba(245, 158, 11, 0.95);
    border-color: var(--warning);
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.7);
    animation: pulse-disaster 0.8s infinite alternate;
}

@keyframes pulse-disaster {
    0% { transform: scale(1); }
    100% { transform: scale(1.18); }
}

.app-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* About Button in Header */
.btn-about {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--border-color);
    transition: var(--transition);
}

.btn-about:hover {
    color: var(--primary);
    transform: scale(1.05);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

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

/* Modal Card */
.modal-card {
    background: #0f1624;
    border: 1px solid var(--border-color);
    width: 520px;
    max-width: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 70vh;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-color);
}

.modal-body p {
    margin-bottom: 16px;
}

.modal-body h3 {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 16px 0 8px 0;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
}

.modal-body a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
}

.modal-body a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Disclaimer Modal Styles */
.disclaimer-card {
    border-color: var(--warning) !important;
}

#accept-disclaimer-btn {
    background: var(--warning);
    border-color: var(--warning);
    color: #0b0f19;
    font-weight: 700;
}

#accept-disclaimer-btn:hover {
    background: #d97706;
    border-color: #d97706;
}

