/* =============================================
   SISMOALERTA VE — CLEAN DESIGN (FINAL)
   ============================================= */

:root {
    --bg: #eef5fb;
    --panel: rgba(255, 255, 255, 0.92);
    --border: rgba(16, 24, 40, 0.12);
    --text: #102033;
    --text-dim: #5f6f83;
    --blue: #2563eb;
    --green: #059669;
    --yellow: #ca8a04;
    --orange: #ea580c;
    --red: #dc2626;
    --font: 'Inter', sans-serif;
    --font-data: 'Orbitron', sans-serif;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    padding: 16px;
    background-image: linear-gradient(180deg, #f7fbff 0%, #eef5fb 44%, #e6f0f8 100%);
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    flex-wrap: wrap;
    gap: 10px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-dot {
    width: 10px; height: 10px;
    background: var(--red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--red);
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.3); }
}

.header-left h1 {
    font-family: var(--font-data);
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.header-left h1 span {
    color: var(--blue);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.clock {
    font-family: var(--font-data);
    font-size: 0.95rem;
    color: var(--blue);
}

.data-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--yellow);
    background: rgba(234, 179, 8, 0.12);
    border: 1px solid rgba(234, 179, 8, 0.24);
    padding: 4px 10px;
    border-radius: 6px;
}

.data-status.online {
    color: var(--green);
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.24);
}

.data-status.error {
    color: var(--red);
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.24);
}

.notif-btn {
    background: rgba(37, 99, 235, 0.1);
    border: 1px solid rgba(37, 99, 235, 0.25);
    color: var(--blue);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.notif-btn:hover { background: rgba(37, 99, 235, 0.18); }
.notif-btn.granted { color: var(--green); border-color: rgba(16,185,129,0.25); background: rgba(16,185,129,0.1); }
.notif-btn.denied { color: var(--red); border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.1); }

/* MAIN LAYOUT */
.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 16px;
    height: calc(100vh - 100px);
}

/* MAP */
.map-section {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.map-container { flex: 1; min-height: 300px; }

.map-legend {
    display: flex;
    gap: 14px;
    padding: 10px 16px;
    font-size: 0.68rem;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.map-legend .dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

.dot.green { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.orange { background: var(--orange); }
.dot.red { background: var(--red); }

.legend-live {
    color: var(--green);
    font-weight: 700;
    animation: pulse-dot 2s infinite;
}

/* Leaflet popup */
.leaflet-popup-content-wrapper {
    background: #ffffff !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.16);
}
.leaflet-popup-tip { background: #ffffff !important; }

/* RIGHT PANEL */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Status Card */
.status-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.4s ease;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.status-card.danger {
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.1);
}

.status-icon { font-size: 2.2rem; margin-bottom: 8px; }

.status-card h2 {
    font-family: var(--font-data);
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.status-card p {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* Alert Info Box */
.alert-info {
    background: var(--panel);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    gap: 16px;
    align-items: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.4s ease;
}

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

.mag-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 85px; height: 85px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 2px dashed var(--red);
    flex-shrink: 0;
}

.mag-number {
    font-family: var(--font-data);
    font-size: 2.3rem;
    font-weight: 900;
    color: var(--red);
    line-height: 1;
}

.mag-label { font-size: 0.7rem; color: var(--text-dim); font-weight: 600; }

.alert-details { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.detail-row { display: flex; justify-content: space-between; font-size: 0.75rem; }
.detail-label { color: var(--text-dim); }
.detail-value { color: var(--text); font-weight: 600; }
.detail-value.danger { color: var(--red); }

/* BIG ACTIVATE BUTTON */
.activate-btn {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.13), rgba(5, 150, 105, 0.1));
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
}

.activate-btn:hover {
    transform: translateY(-2px);
    border-color: var(--blue);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.25);
}

.activate-btn.activated {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.14), rgba(5, 150, 105, 0.06));
    cursor: default;
}

.activate-btn.activated:hover {
    transform: none;
    box-shadow: none;
}

.activate-btn:disabled {
    opacity: 0.8;
    cursor: wait;
}

.activate-icon {
    font-size: 2rem;
    line-height: 1;
}

.activate-text strong {
    display: block;
    font-family: var(--font-data);
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.activate-text small {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Push Status */
.push-status {
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--text-dim);
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.16);
}

.push-status.success {
    color: #065f46;
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
}

.push-status.warning {
    color: #854d0e;
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.2);
}

.push-status.error {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.test-alert-button {
    align-self: flex-end;
    width: auto;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #991b1b;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0;
    cursor: pointer;
}

.test-alert-button:hover {
    background: rgba(239, 68, 68, 0.16);
}

.test-alert-button:disabled {
    opacity: 0.75;
    cursor: wait;
}

/* GPS Status */
.gps-status {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.72rem;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.gps-status strong {
    color: var(--green);
}

#gps-distance {
    color: var(--yellow);
    font-weight: 600;
}

/* Silence */
.silence-button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #ea580c, #f97316);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(249,115,22,0.3);
}

.silence-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(249,115,22,0.45);
}

/* Live Events List */
.live-events {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.live-events h3 {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.events-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.loading-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    padding: 20px 0;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(248, 250, 252, 0.88);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.event-item:hover {
    background: #ffffff;
    border-color: rgba(37, 99, 235, 0.2);
}

.event-mag {
    font-family: var(--font-data);
    font-size: 0.95rem;
    font-weight: 800;
    min-width: 42px;
    text-align: center;
}

.event-mag.low { color: var(--green); }
.event-mag.med { color: var(--yellow); }
.event-mag.high { color: var(--orange); }
.event-mag.crit { color: var(--red); }

.event-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.event-place {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
}

.event-time {
    font-size: 0.62rem;
    color: var(--text-dim);
}

.event-depth {
    font-size: 0.62rem;
    color: var(--text-dim);
}

.refresh-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.auto-refresh {
    font-size: 0.65rem;
    color: var(--text-dim);
}

/* Safety */
.safety-tips {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.safety-tips h3 { font-size: 0.82rem; font-weight: 700; margin-bottom: 10px; }

.safety-tips ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.safety-tips li {
    font-size: 0.73rem;
    color: var(--text-dim);
    line-height: 1.4;
    padding-left: 10px;
    border-left: 2px solid rgba(59,130,246,0.3);
}

.safety-tips li strong { color: var(--text); }

/* Data Sources */
.data-sources {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.data-sources h3 { font-size: 0.82rem; font-weight: 700; margin-bottom: 10px; }

.data-sources ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.data-sources li {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.data-sources a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 600;
}

.data-sources a:hover { text-decoration: underline; }

.api-note {
    font-size: 0.65rem;
    color: var(--text-dim);
    margin-top: 8px;
    line-height: 1.4;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

/* NOTIFICATIONS */
.notifications {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.notif {
    pointer-events: auto;
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    transition: all 0.5s cubic-bezier(0.175,0.885,0.32,1.275);
    transform-origin: top right;
}

.notif.hidden {
    opacity: 0;
    transform: translateY(-40px) scale(0.85);
    pointer-events: none;
}

.ios-notif {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid rgba(15, 23, 42, 0.12);
}

.android-notif {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 24px;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: rgba(15, 23, 42, 0.55);
    margin-bottom: 4px;
}

.notif-app { font-weight: 700; color: rgba(15, 23, 42, 0.72); }

.notif-title { font-size: 0.82rem; font-weight: 700; color: var(--red); margin-bottom: 3px; }
.notif-body { font-size: 0.75rem; color: rgba(15, 23, 42, 0.86); line-height: 1.35; }

.notif-actions { margin-top: 10px; text-align: right; }
.notif-actions button {
    background: rgba(37, 99, 235, 0.08);
    border: none;
    color: var(--blue);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 16px;
    cursor: pointer;
}
.notif-actions button:hover { background: rgba(37, 99, 235, 0.15); }

/* STROBE */
.alert-strobe {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
}

.alert-strobe.active {
    animation: strobe 1.5s infinite;
}

@keyframes strobe {
    0%, 100% { background: transparent; }
    50% { background: rgba(239,68,68,0.03); box-shadow: inset 0 0 60px 20px rgba(239,68,68,0.2); }
}

/* Map markers */
.epicenter-marker { background: transparent; border: none; }

.epicenter-dot {
    width: 18px; height: 18px;
    background: var(--red);
    border-radius: 50%;
    box-shadow: 0 0 12px var(--red);
    position: relative;
    left: -9px; top: -9px;
}

.epicenter-dot::after {
    content: '';
    position: absolute;
    left: -16px; top: -16px;
    width: 50px; height: 50px;
    border-radius: 50%;
    border: 2px solid var(--red);
    animation: ripple 2s infinite linear;
}

@keyframes ripple {
    0% { transform: scale(0.2); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.18); border-radius: 3px; }

/* RESPONSIVE */
@media (max-width: 900px) {
    .main-content { grid-template-columns: 1fr; height: auto; }
    .map-section { min-height: 350px; }
    .header { flex-direction: column; text-align: center; }
    .header-right { justify-content: center; }
    .notifications { width: calc(100% - 32px); left: 16px; right: 16px; }
}
