/* 
 * Interactive Earthquake Visualization Application
 * © 2025 Mustafa Comoglu. All Rights Reserved.
 * Modern UI Styles
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    display: flex;
    height: 100vh;
    overflow: hidden;
    background: #f0f2f5;
}

/* Modern Sidebar */
#sidebar {
    width: 320px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    z-index: 1001;
}

#sidebar.collapsed {
    transform: translateX(-100%);
}

/* Sidebar Header */
.sidebar-header {
    padding: 20px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    color: white;
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h2 i {
    font-size: 1.2rem;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Modern Accordion */
.accordion {
    margin-bottom: 15px;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.accordion-header {
    padding: 15px 20px;
    background: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    color: #333;
    font-size: 0.95rem;
}

.accordion-header:hover {
    background: #f8f9fa;
}

.accordion-header i {
    transition: transform 0.3s ease;
    color: #667eea;
}

.accordion-header.active i {
    transform: rotate(180deg);
}

.accordion-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: white;
}

.accordion-content.active {
    padding: 20px;
    max-height: 600px;
}

/* Form Controls */
.control-group {
    margin-bottom: 15px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 6px;
}

input, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

/* Action Buttons Container */
.sidebar-actions {
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-actions .control-group {
    margin-bottom: 10px;
}

/* Earthquake Counter */
#earthquake-counter {
    background: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Main Content */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

#map {
    flex: 1;
    background: #e0e0e0;
}

/* Mobile Menu Toggle */
#sidebar-toggle {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 1002;
    background: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

#sidebar-toggle:hover {
    transform: scale(1.1);
}

/* Compact Hoverable Map Controls */
.map-controls-compact {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.controls-trigger {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    position: relative;
}

.controls-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.controls-trigger i {
    font-size: 1.2rem;
    color: #667eea;
    transition: transform 0.3s ease;
}

.map-controls-compact:hover .controls-trigger i {
    transform: rotate(180deg);
}

.controls-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    overflow: hidden;
}

.map-controls-compact:hover .controls-panel {
    width: 300px;
    opacity: 1;
    visibility: visible;
}

.controls-panel-inner {
    padding: 20px;
    width: 300px;
}

.controls-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.controls-header h3 {
    font-size: 1rem;
    color: #333;
    font-weight: 600;
}

/* Map Grid Selector */
.map-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.map-tile {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 8px;
    background: white;
    position: relative;
    overflow: hidden;
}

.map-tile:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.map-tile.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.map-tile.active::after {
    content: '✓';
    position: absolute;
    top: 4px;
    right: 4px;
    background: #667eea;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.map-tile i {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 4px;
}

.map-tile span {
    font-size: 0.65rem;
    text-align: center;
    color: #666;
    line-height: 1.2;
}

/* Color Scheme Selector */
.color-scheme-selector {
    margin-bottom: 20px;
}

.color-options {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.color-option {
    flex: 1;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.color-option:hover {
    border-color: #667eea;
    background: #f8f9fa;
}

.color-option.active {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

/* Fault Lines Toggle */
.fault-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fault-toggle:hover {
    background: #e9ecef;
}

.toggle-switch {
    width: 48px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: #667eea;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

/* Footer */
footer {
    background: white;
    padding: 10px;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    border-top: 1px solid #eee;
}

/* Loading Indicator */
#loadingIndicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 2000;
    text-align: center;
}

#loadingIndicator p {
    margin-bottom: 15px;
    color: #333;
    font-weight: 500;
}

/* Stats Panel */
.stats-panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0,0,0,0.15);
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    max-width: 320px;
    max-height: 70vh;
    overflow-y: auto;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #333;
}

/* Credits Modal */
#creditsModal {
    display: none;
    position: fixed;
    z-index: 2001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 50px rgba(0,0,0,0.3);
}

/* Stats Tabs Styling */
.stats-tabs { 
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.tab-btn {
    background: #e0e0e0;
    border: 1px solid #ccc;
    outline: none;
    cursor: pointer;
    padding: 5px 8px;
    margin-right: 2px;
    font-size: 0.85em;
    border-radius: 3px 3px 0 0;
    color: #333;
    font-weight: bold;
}

.tab-btn.active {
    background-color: #4CAF50;
    color: white;
    border-bottom: 1px solid #4CAF50;
}

.tab-pane {
    display: none;
    padding: 5px;
    border-top: none;
}

.tab-pane.active {
    display: block;
}

/* Leaflet Custom Styles */
.legend {
    background: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    line-height: 18px;
    color: #555;
}

.legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.7;
}

.info {
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font: 14px/16px Arial, Helvetica, sans-serif;
    background: rgba(255,255,255,0.8);
}

/* Data Range Display */
.data-range {
    font-size: 0.9em;
    color: #555;
    margin-top: 4px;
}

.data-range i {
    width: 16px;
    text-align: center;
    margin-right: 5px;
    color: #666;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        position: fixed;
    }
    
    .map-controls-compact:hover .controls-panel {
        width: calc(100vw - 40px);
        right: -20px;
    }
    
    .controls-panel-inner {
        width: 100%;
    }
    
    .map-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    #map {
        height: calc(100vh - 50px);
    }
    
    #sidebar.collapsed {
        height: 40px;
        overflow: hidden;
    }
}

/* Tooltip for map tiles */
.map-tile[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 10;
}

/* Cluster Controls */
.cluster-control {
    background: white;
    padding: 5px;
    border-radius: 5px;
}

.cluster-control a {
    display: block;
    text-align: center;
    padding: 5px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

/* Marker Cluster Custom Styles */
.marker-cluster {
    background-clip: padding-box;
    border-radius: 20px;
}

.marker-cluster div {
    width: 30px;
    height: 30px;
    margin-left: 5px;
    margin-top: 5px;
    text-align: center;
    border-radius: 15px;
    font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
}

.marker-cluster span {
    line-height: 30px;
}

/* Watermark Styles */
.map-watermark-corner {
    position: absolute;
    top: 110px;
    left: 80px;
    padding: 4px 8px;
    color: rgba(0, 0, 0, 0.3);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 999;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 4px;
}

.map-watermark-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    color: rgba(0, 0, 0, 0.1);
    font-size: 32px;
    font-weight: bold;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 999;
}

.map-watermark-grid {
    position: absolute;
    color: rgba(0, 0, 0, 0.08);
    font-size: 14px;
    font-weight: bold;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    z-index: 998;
}

/* Map Date Overlay for Animation */
#map-date-overlay {
    position: absolute;
    top: 50px;
    left: 50px;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 6px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
    font-size: 24px;
    font-weight: bold;
    z-index: 1000;
    display: none;
}

#map-date-value {
    color: #333;
}