/* =====================================================
   Deprem İzleme Sistemi - Premium Dark Theme CSS
   ===================================================== */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: rgba(26, 26, 37, 0.8);
    --bg-glass: rgba(18, 18, 26, 0.85);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);

    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    --sidebar-width: 380px;
    --header-height: 70px;
    --footer-height: 40px;
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: var(--bg-primary);
    color: var(--text-primary);
    /* overflow: hidden; Removed global overflow hidden */
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background:
        radial-gradient(ellipse at top left, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(168, 85, 247, 0.05) 0%, transparent 50%),
        var(--bg-primary);
}

/* Header */
.header {
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    position: relative;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo-image {
    max-height: 50px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
    transition: var(--transition-normal);
}

.logo-image:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.5));
}

.header-nav {
    display: flex;
    gap: 20px;
    margin-left: 40px;
    margin-right: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.nav-link svg {
    width: 18px;
    height: 18px;
}

.nav-link:hover {
    color: white;
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.header-stats {
    display: flex;
    gap: 24px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    min-width: 80px;
}

.stat-item.pulse {
    animation: pulse-border 2s ease-in-out infinite;
}

@keyframes pulse-border {

    0%,
    100% {
        border-color: var(--border-color);
    }

    50% {
        border-color: var(--accent-primary);
        box-shadow: var(--shadow-glow);
    }
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item.update-time .stat-value {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - var(--header-height) - var(--footer-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.filter-select {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-select:hover {
    border-color: var(--accent-primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Earthquake List */
.earthquake-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.earthquake-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-normal);
}

.earthquake-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.earthquake-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
}

.eq-magnitude {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.eq-details {
    flex: 1;
    min-width: 0;
}

.eq-location {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eq-meta {
    display: flex;
    gap: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.eq-depth::before {
    content: '⬇ ';
}

/* Map Wrapper */
.map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.map-container {
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
}

/* Legend */
.legend {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    z-index: 400;
    box-shadow: var(--shadow-md);
}

.legend h4 {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 500;
    color: var(--text-secondary);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Message */
.error-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--danger);
    gap: 12px;
}

.error-message svg {
    width: 48px;
    height: 48px;
    opacity: 0.7;
}

/* Footer */
.footer {
    height: var(--footer-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 24px;
}

.footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--accent-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.footer a:hover {
    color: var(--accent-primary);
}

/* Leaflet Custom Styles */
.leaflet-container {
    background: var(--bg-secondary) !important;
    font-family: 'Inter', sans-serif !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    color: var(--text-primary) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
}

.leaflet-popup-tip {
    background: var(--bg-glass) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

.leaflet-control-zoom {
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
}

.leaflet-control-zoom a {
    background: var(--bg-glass) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

.leaflet-control-attribution {
    background: var(--bg-glass) !important;
    color: var(--text-muted) !important;
    font-size: 10px !important;
}

.leaflet-control-attribution a {
    color: var(--accent-secondary) !important;
}

/* Marker Cluster Styles */
.marker-cluster {
    background: var(--bg-glass) !important;
    border: 2px solid var(--accent-primary) !important;
}

.marker-cluster div {
    background: var(--accent-gradient) !important;
    color: white !important;
    font-weight: 600 !important;
}

/* Custom Popup Content */
.popup-content {
    padding: 16px;
    min-width: 220px;
}

.popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.popup-magnitude {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
}

.popup-title {
    flex: 1;
}

.popup-title h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.popup-title .severity {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.popup-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.popup-detail {
    display: flex;
    flex-direction: column;
}

.popup-detail label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.popup-detail span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        width: 320px;
    }

    .header-stats {
        gap: 12px;
    }

    .stat-item {
        padding: 6px 12px;
        min-width: 70px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 60px;
    }

    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 35vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .map-wrapper {
        height: calc(65vh - var(--header-height) - var(--footer-height));
    }

    .header-content {
        flex-direction: column;
        padding: 8px 0;
        gap: 8px;
    }

    .header-stats {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
    }

    .stat-item {
        flex: 1;
        min-width: 60px;
    }

    .stat-item.update-time {
        display: none;
    }

    .legend {
        bottom: 12px;
        right: 12px;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 1.1rem;
    }

    .logo-text .subtitle {
        display: none;
    }

    .stat-item {
        padding: 4px 8px;
    }

    .stat-value {
        font-size: 1rem;
    }

    .earthquake-item {
        padding: 10px;
    }

    .eq-magnitude {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.earthquake-item {
    animation: fadeIn 0.3s ease forwards;
}

.earthquake-item:nth-child(1) {
    animation-delay: 0.05s;
}

.earthquake-item:nth-child(2) {
    animation-delay: 0.1s;
}

.earthquake-item:nth-child(3) {
    animation-delay: 0.15s;
}

.earthquake-item:nth-child(4) {
    animation-delay: 0.2s;
}

.earthquake-item:nth-child(5) {
    animation-delay: 0.25s;
}

/* Pulse animation for new earthquakes */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-2px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(2px);
    }
}

.earthquake-item.new {
    animation: shake 0.5s ease;
    border-color: var(--danger) !important;
}