/* Fire Hydrant Locator - Mobile-First Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --fire-red: #dc2626;
    --fire-red-dark: #b91c1c;
    --fire-yellow: #fbbf24;
    --success-green: #16a34a;
    --warning-orange: #ea580c;
    --text-dark: #1f2937;
    --text-light: #f9fafb;
    --bg-dark: #111827;
    --bg-panel: #1f2937;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--fire-red);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.status-indicator {
    font-size: 1.5rem;
    color: #666;
    transition: color 0.3s;
}

.status-indicator.active {
    color: var(--success-green);
    animation: pulse 2s infinite;
}

.status-indicator.error {
    color: var(--warning-orange);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Map */
#map {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Custom Hydrant Markers */
.hydrant-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--fire-yellow);
    border: 3px solid var(--text-dark);
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.hydrant-marker.out-of-service {
    background: #ef4444;
    color: white;
}

.hydrant-marker.selected {
    transform: scale(1.3);
    border-color: var(--fire-red);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.4);
}

/* User Location Marker */
.user-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #3b82f6;
    border: 3px solid white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Nearest Hydrant Button */
.nearest-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--fire-red);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 18px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
    transition: all 0.2s;
    min-height: 60px;
    /* Large touch target for gloved hands */
    min-width: 250px;
    justify-content: center;
}

.nearest-btn:hover {
    background: var(--fire-red-dark);
    transform: translateX(-50%) scale(1.02);
}

.nearest-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.nearest-btn:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.4rem;
}

/* Info Panel */
.info-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    z-index: 1001;
    transform: translateY(0);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
    max-height: 60vh;
    overflow-y: auto;
}

.info-panel.hidden {
    transform: translateY(100%);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

.hydrant-info {
    padding-top: 8px;
}

.hydrant-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.hydrant-id {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--fire-yellow);
}

.hydrant-status {
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
}

.hydrant-status.operational {
    background: var(--success-green);
    color: white;
}

.hydrant-status.out-of-service {
    background: #ef4444;
    color: white;
}

.hydrant-status.unknown {
    background: #6b7280;
    color: white;
}

.hydrant-address {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.hydrant-w3w {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-family: monospace;
}

.w3w-label {
    color: #ef4444;
    font-weight: bold;
}

.w3w-words {
    color: var(--text-light);
    flex: 1;
    font-size: 1.05rem;
}

.copy-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.copy-btn:hover {
    opacity: 1;
}

.hydrant-distance {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fire-yellow);
    margin-bottom: 8px;
}

.hydrant-detail {
    font-size: 0.95rem;
    color: #d1d5db;
    margin-bottom: 8px;
    line-height: 1.5;
}

.hydrant-notes {
    font-size: 0.9rem;
    color: #9ca3af;
    font-style: italic;
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border-left: 3px solid var(--fire-yellow);
}

.hydrant-notes:empty {
    display: none;
}

.hydrant-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
}

.action-btn:first-child {
    background: #3b82f6;
    color: white;
}

.action-btn:hover {
    opacity: 0.9;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(17, 24, 39, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--fire-red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 16px;
    font-size: 1.1rem;
    color: #d1d5db;
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    background: var(--bg-panel);
    color: var(--text-light);
    border-radius: 12px;
}

.leaflet-popup-tip {
    background: var(--bg-panel);
}

.leaflet-popup-content {
    margin: 12px 16px;
}

/* High Contrast Mode (for bright sunlight) */
@media (prefers-contrast: high) {
    :root {
        --fire-red: #ff0000;
        --fire-yellow: #ffff00;
    }
    
    .hydrant-marker {
        border-width: 4px;
    }
}

/* Prevent text selection during map interaction */
.leaflet-container {
    -webkit-user-select: none;
    user-select: none;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .nearest-btn {
        bottom: 40px;
        padding: 20px 40px;
        font-size: 1.2rem;
    }
    
    .info-panel {
        max-width: 400px;
        left: 20px;
        right: auto;
        border-radius: 20px;
        bottom: 20px;
    }
}
