/* Map Page Specific Styles */

* { box-sizing: border-box; }

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
}

.app-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

/* Main Map Card */
.map-main-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
    border-radius: 16px;
    padding: 30px;
    margin: 20px auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    position: relative;
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
}

.map-main-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, #007bff, #00c6ff);
    border-radius: 16px 16px 0 0;
}

/* Map Header */
.map-header {
    text-align: center;
    margin-bottom: 30px;
}

.map-header h2 {
    font-size: 2.2em;
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.map-subtitle {
    color: #7f8c8d;
    font-size: 1.1em;
    margin: 0;
    line-height: 1.5;
}

/* Map Container */
.map-container {
    position: relative;
    margin-bottom: 30px;
}

#map {
    height: 500px;
    border-radius: 12px;
    width: 100%;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Map Controls */
.map-controls {
    text-align: center;
    margin-bottom: 30px;
}

.map-controls h3 {
    font-size: 1.4em;
    color: #2c3e50;
    margin: 0 0 8px 0;
    font-weight: 600;
}

.controls-subtitle {
    color: #7f8c8d;
    font-size: 0.95em;
    margin: 0 0 20px 0;
    line-height: 1.4;
}

.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

button {
    padding: 14px 24px;
    font-size: 16px;
    margin: 0;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    color: white;
    transition: all 0.3s ease;
    min-width: 160px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.safe-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.safe-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea085);
}

.danger-btn {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.danger-btn:hover {
    background: linear-gradient(135deg, #c82333, #d63031);
}

.loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.legend {
    position: absolute;
    left: 10px;
    bottom: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 40px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.legend-bar {
    width: 100%;
    height: 160px;
    position: relative;
    background: linear-gradient(to top, 
        rgb(220, 53, 69),   /* Danger: -10 */
        rgb(255, 193, 7),   /* -5 */
        transparent,        /* 0 */
        rgb(40, 167, 69),   /* 5 */
        rgb(25, 135, 84)    /* Safe: 10 */
    );
    border-radius: 4px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.legend-labels {
    position: absolute;
    right: -50px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: #2c3e50;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    min-width: 45px;
}

.legend-labels span {
    line-height: 1.2;
    text-align: left;
    white-space: nowrap;
}

.toast {
    visibility: hidden;
    min-width: 250px;
    margin-left: -140px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 8px;
    padding: 16px;
    position: fixed;
    z-index: 3000;
    left: 50%;
    top: 140px;
    font-size: 17px;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
}

.toast.safe {
    background-color: #28a745; /* Safe color */
}

.toast.dangerous {
    background-color: #dc3545; /* Dangerous color */
}

/* Weather Info Styles */
.weather-info {
    margin-top: 0;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.weather-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.weather-icon {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.weather-title h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d3436;
    font-weight: 600;
}

.weather-subtitle {
    margin: 5px 0 0 0;
    color: #636e72;
    font-size: 0.9rem;
    font-weight: 400;
}

.weather-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.weather-card {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.weather-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

.weather-card-risk {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(255, 82, 82, 0.05));
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.weather-card-risk:hover {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.15), rgba(255, 82, 82, 0.1));
}

.weather-card-icon {
    font-size: 1.8rem;
    min-width: 40px;
    text-align: center;
}

.weather-card-content {
    flex: 1;
}

.weather-card-label {
    font-size: 0.85rem;
    color: #636e72;
    font-weight: 500;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-card-value {
    font-size: 1.2rem;
    color: #2d3436;
    font-weight: 600;
    line-height: 1.2;
}

#flood-risk {
    font-weight: bold;
}

.flood-risk-high {
    color: #dc3545;
}

.flood-risk-medium {
    color: #ffc107;
}

.flood-risk-low {
    color: #28a745;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .map-main-card {
        padding: 20px;
        margin: 150px 10px 0 10px;
        border-radius: 12px;
        max-width: none;
    }
    
    .map-header h2 {
        font-size: 1.8em;
    }
    
    .map-subtitle {
        font-size: 1em;
    }
    
    #map {
        height: 400px;
        border-radius: 8px;
    }
    
    .map-controls h3 {
        font-size: 1.2em;
    }
    
    .controls {
        flex-direction: column;
        gap: 12px;
    }
    
    button {
        width: 100%;
        min-width: auto;
        padding: 12px 20px;
    }
    
    .legend {
        bottom: 5px;
        left: 5px;
        padding: 8px;
        width: 32px;
    }
    
    .legend-bar {
        height: 120px;
    }
    
    .legend-labels {
        right: -40px;
        font-size: 8px;
        min-width: 35px;
    }
    
    .toast {
        top: 150px;
        left: 50%;
        margin-left: -125px;
        min-width: 250px;
    }
    
    .weather-info {
        padding: 15px;
        margin-top: 0;
    }
    
    .weather-header {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .weather-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .weather-title h3 {
        font-size: 1.3rem;
    }
    
    .weather-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .weather-card {
        padding: 12px;
    }
    
    .weather-card-icon {
        font-size: 1.5rem;
        min-width: 35px;
    }
    
    .weather-card-value {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .map-main-card {
        padding: 15px;
        margin: 150px 5px 0 5px;
    }
    
    .map-header h2 {
        font-size: 1.6em;
    }
    
    .map-subtitle {
        font-size: 0.9em;
    }
    
    #map {
        height: 340px;
    }
    
    .map-controls h3 {
        font-size: 1.1em;
    }
    
    .controls-subtitle {
        font-size: 0.85em;
    }
    
    button {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .legend {
        bottom: 5px;
        left: 5px;
        padding: 6px;
        width: 28px;
    }
    
    .legend-bar {
        height: 110px;
    }
    
    .legend-labels {
        right: -32px;
        font-size: 7px;
        min-width: 28px;
    }
    
    .toast {
        top: 150px;
        left: 50%;
        margin-left: -120px;
        min-width: 240px;
    }
    
    .weather-info {
        padding: 12px;
    }
    
    .weather-header {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .weather-icon {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .weather-title h3 {
        font-size: 1.2rem;
    }
    
    .weather-subtitle {
        font-size: 0.8rem;
    }
    
    .weather-card {
        padding: 10px;
    }
    
    .weather-card-icon {
        font-size: 1.3rem;
        min-width: 30px;
    }
    
    .weather-card-value {
        font-size: 1rem;
    }
}

/* Community Intelligence Section */
.community-intelligence {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
}

.intelligence-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
}

.intelligence-icon {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #74b9ff, #0984e3);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(116, 185, 255, 0.3);
}

.intelligence-title h4 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d3436;
    font-weight: 600;
}

.intelligence-subtitle {
    margin: 5px 0 0 0;
    color: #636e72;
    font-size: 0.95rem;
    font-weight: 400;
}

.intelligence-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.intelligence-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.intelligence-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.intelligence-label {
    display: block;
    color: #636e72;
    font-size: 0.9rem;
    margin-bottom: 8px;
    font-weight: 500;
}

.intelligence-value {
    display: block;
    color: #2d3436;
    font-weight: 600;
    font-size: 1.1rem;
}

/* Mobile responsive for community intelligence */
@media (max-width: 768px) {
    .intelligence-header {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .intelligence-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }
    
    .intelligence-title h4 {
        font-size: 1.3rem;
    }
    
    .intelligence-subtitle {
        font-size: 0.9rem;
    }
    
    .intelligence-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .intelligence-item {
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .intelligence-header {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .intelligence-icon {
        width: 45px;
        height: 45px;
        font-size: 1.8rem;
    }
    
    .intelligence-title h4 {
        font-size: 1.2rem;
    }
    
    .intelligence-subtitle {
        font-size: 0.8rem;
    }
    
    .intelligence-item {
        padding: 10px;
    }
}
