@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap');

* {
    box-sizing: border-box;
}

body, html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Inter', sans-serif;
    display: flex;
    flex-direction: column;
}



/* Header */
.main-header {
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    z-index: 10;
}

.header-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h1 {
    margin: 0;
    font-size: 1.25rem;
    color: #2c3e50;
    font-weight: 700;
}

.nav-link {
    text-decoration: none;
    color: #34495e;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background 0.2s;
}

.nav-link:hover {
    background: #f5f6fa;
    color: #2980b9;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Sidebar (Left Column) */
.sidebar {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.02);
    z-index: 5;
}

.sidebar h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2c3e50;
    font-weight: 600;
    font-size: 1.25rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

/* Map (Right Column) */
#map-container {
    flex: 1;
    position: relative;
    z-index: 1;
}

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

/* Earthquake List Items */
.quake-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.quake-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #bdc3c7;
    cursor: pointer;
}

.quake-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    border-color: #d0d0d0;
}

.quake-item.latest {
    border-left-color: #e74c3c;
    background: #fff5f5;
}

.quake-item.latest:hover {
    background: #ffebeb;
}

.quake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.magnitude {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c3e50;
    background: #ecf0f1;
    padding: 4px 8px;
    border-radius: 4px;
}

.quake-item.latest .magnitude {
    background: #e74c3c;
    color: white;
}

.location {
    font-weight: 600;
    color: #34495e;
    font-size: 0.95rem;
}

.details {
    font-size: 0.85rem;
    color: #7f8c8d;
    display: flex;
    justify-content: space-between;
}

/* Footer */
.main-footer {
    height: 40px;
    background: #2c3e50;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.main-footer p {
    margin: 0;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Modal Styling */
.modal {
    display: none; 
    position: fixed; 
    z-index: 3000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.4); 
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.95);
    margin: auto;
    padding: 30px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: fadeIn 0.3s;
}

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

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: #2c3e50;
    text-decoration: none;
    cursor: pointer;
}

.modal-content h2 {
    margin-top: 0;
    color: #2c3e50;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.contact-info p {
    margin: 10px 0;
    color: #34495e;
    font-size: 1.05rem;
}

.contact-info strong {
    color: #2c3e50;
}

/* Pulsating Marker Animation */
.pulsating-circle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translateX(-50%) translateY(-50%);
    width: 60px; /* Increased size */
    height: 60px; /* Increased size */
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.3);
    border: 2px solid rgba(231, 76, 60, 0.8); /* Added border for visibility */
    animation: pulse 2s infinite; /* Slower, more deliberate pulse */
    pointer-events: none;
}

.pulsating-circle:after {
    content: "";
    position: absolute;
    left: -10px; /* Adjust for larger size */
    top: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.9); /* Stronger glow */
    animation: pulse-ring 2s infinite;
}

@keyframes pulse {
    0% {
        transform: translateX(-50%) translateY(-50%) scale(0.5);
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
    100% {
        transform: translateX(-50%) translateY(-50%) scale(2.0); /* Larger expansion */
        opacity: 0;
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* Map Container & Iframe */
#map-container {
    position: relative; /* For absolute positioning of legend */
    width: 100%;
    height: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
}

#map-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    font-family: 'Inter', sans-serif;
    min-width: 140px;
}

.legend-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.legend-list li {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    color: #34495e;
}

.legend-list li:last-child {
    margin-bottom: 0;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    /* Allow page scrolling */
    body, html {
        height: auto;
        overflow-x: hidden;
    }

    .main-content {
        flex-direction: column; /* Stack vertically */
        height: auto; /* Let content define height */
        overflow: visible;
    }

    /* Map on top */
    #map-container {
        height: 50vh; /* Fixed height for map (half screen) */
        width: 100%;
        order: 1; /* Ensure map is first */
        border-radius: 0 0 16px 16px;
        position: relative;
        z-index: 1;
    }

    /* Sidebar (List) below */
    .sidebar {
        width: 100%;
        height: auto; /* Natural height */
        max-height: none; /* Remove any height constraints */
        order: 2; /* Ensure sidebar is second */
        border-right: none;
        border-top: 1px solid #e0e0e0;
        padding: 10px; /* Reduced padding */
        overflow: visible; /* Disable internal scroll, use page scroll */
    }

    .quake-item {
        padding: 10px; /* Reduced padding */
        margin-bottom: 8px;
    }

    .quake-header {
        margin-bottom: 4px;
        align-items: center;
    }

    .location {
        font-size: 0.9rem; /* Smaller font */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 65%; /* Prevent text overflow */
    }

    .magnitude {
        font-size: 0.9rem; /* Smaller font */
        padding: 2px 6px;
        flex-shrink: 0;
    }

    .details {
        font-size: 0.75rem; /* Smaller font */
    }

    .main-header {
        padding: 0 15px;
        height: 50px; /* Reduced header height */
    }

    .main-header h1 {
        font-size: 1rem;
    }

    /* Adjust Legend for Mobile - Make it smaller */
    .map-legend {
        bottom: 10px;
        left: 10px;
        padding: 6px 10px; /* Reduced padding */
        min-width: auto; /* Let content define width */
        background: rgba(255, 255, 255, 0.8); /* More transparent */
        backdrop-filter: blur(4px);
    }

    .legend-title {
        font-size: 11px;
        margin-bottom: 3px;
        font-weight: 600;
    }

    .legend-list li {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .color-dot {
        width: 8px;
        height: 8px;
        margin-right: 5px;
    }

    /* Adjust Modal for Mobile */
    .modal-content {
        width: 90%;
        margin-top: 15vh;
        padding: 15px;
    }
}
