/* ============================================
   InfoGempa - Main Stylesheet
   Based on plan.txt design
   ============================================ */

:root {
    --primary: #FF4757;
    --primary-dark: #E63946;
    --secondary: #5C7CFA;
    --success: #51CF66;
    --warning: #FFD43B;
    --bg-main: #F8F9FA;
    --bg-white: #FFFFFF;
    --text-dark: #212529;
    --text-gray: #6C757D;
    --text-light: #ADB5BD;
    --border: #DEE2E6;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header */
header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.container {
    max-width: 96%;
    margin: 0 auto;
    padding: 0 1rem;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.125rem;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-family: 'Source Code Pro', monospace;
}

.nav-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-white);
    color: var(--text-dark);
}

.btn:hover {
    background: var(--bg-main);
    border-color: var(--text-gray);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-icon {
    width: 16px;
    height: 16px;
}

/* Main Content */
main {
    padding: 2rem 0;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.page-description {
    font-size: 1rem;
    color: var(--text-gray);
}

/* Stats Grid */
.dashboard-strip {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: stretch;
}

.dashboard-strip .stat-card {
    flex: 0 1 160px;
    min-width: 130px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0;
    align-content: flex-start;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.2s ease;
}

.stat-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--text-light);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-weight: 500;
}

.stat-icon {
    width: 32px;
    height: 32px;
    background: var(--bg-main);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
    font-family: 'Source Code Pro', monospace;
    margin-bottom: 0.125rem;
}

.stat-info {
    font-size: 0.6875rem;
    color: var(--text-light);
}

/* Latest Earthquake Inline */
.latest-eq-inline {
    flex: 1 1 auto;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    min-width: 0;
}

.latest-eq-inline:hover {
    box-shadow: var(--shadow);
    border-color: var(--text-light);
}

.latest-eq-info {
    flex: 1;
    min-width: 0;
}

.latest-eq-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.latest-eq-region {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.latest-eq-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-gray);
    font-family: 'Source Code Pro', monospace;
    margin-bottom: 0.125rem;
}

.latest-eq-potential {
    font-size: 0.6875rem;
    color: var(--text-light);
}

/* Card */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.card-badge {
    padding: 0.25rem 0.5rem;
    background: var(--bg-main);
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-gray);
}

/* Legacy earthquake-grid (kept for fallback) */
.earthquake-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
}

.earthquake-details {
    display: grid;
    gap: 0.5rem;
}

.detail-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    padding: 0.5rem 0.75rem;
    background: var(--bg-main);
    border-radius: 6px;
    gap: 0.75rem;
}

.detail-label {
    color: var(--text-gray);
    font-size: 0.8125rem;
    font-weight: 500;
}

.detail-value {
    font-weight: 600;
    color: var(--text-dark);
    font-family: 'Source Code Pro', monospace;
    font-size: 0.8125rem;
}

.magnitude-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    color: white;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.magnitude-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Source Code Pro', monospace;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.magnitude-label {
    font-size: 0.625rem;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 1px;
}

/* Map */
.map-container {
    margin-bottom: 1.5rem;
}

#map {
    height: 500px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-gray);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-dark);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Earthquake List */
.earthquake-list {
    display: grid;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.earthquake-list::-webkit-scrollbar {
    width: 6px;
}

.earthquake-list::-webkit-scrollbar-track {
    background: var(--bg-main);
    border-radius: 3px;
}

.earthquake-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.earthquake-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

.earthquake-item {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.earthquake-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.earthquake-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.magnitude-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.875rem;
    color: white;
}

.magnitude-low { background: var(--success); }
.magnitude-medium { background: var(--warning); color: var(--text-dark); }
.magnitude-high { background: var(--primary); }

.earthquake-time {
    color: var(--text-gray);
    font-size: 0.8125rem;
    font-family: 'Source Code Pro', monospace;
}

.earthquake-location {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.earthquake-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.8125rem;
    color: var(--text-gray);
}

/* Footer */
footer {
    background: var(--bg-white);
    border-top: 1px solid var(--border);
    padding: 3rem 0 2rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-section p,
.footer-section a {
    color: var(--text-gray);
    font-size: 0.875rem;
    line-height: 1.8;
    text-decoration: none;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-gray);
    font-size: 0.8125rem;
}

.social-links {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.social-link {
    width: 36px;
    height: 36px;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
}

.social-link:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.social-link:hover svg {
    fill: white;
}

.social-link svg {
    width: 18px;
    height: 18px;
    fill: var(--text-gray);
    transition: fill 0.2s ease;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-gray);
}

.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-gray);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--text-light);
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .header-content {
        flex-wrap: wrap;
    }

    .nav-buttons {
        width: 100%;
        justify-content: stretch;
        margin-top: 0.75rem;
    }

    .nav-buttons .btn {
        flex: 1;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .dashboard-strip {
        flex-wrap: wrap;
    }

    .dashboard-strip .stat-card {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 0;
    }

    .latest-eq-inline {
        flex-basis: 100%;
    }

    .latest-eq-meta {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .earthquake-grid {
        grid-template-columns: 1fr;
    }

    .magnitude-box {
        min-width: auto;
    }

    #map {
        height: 400px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        padding-bottom: 0.5rem;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}
