/* =================================================================
   GEOSeis Epicenter App - Modern Material Design Styling
   Based on React GeoSeis project styling
   ================================================================= */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    color: #333;
    height: 100vh;
    overflow: hidden;
}

/* =================================================================
   HEADER STYLING - Material Design inspired
   ================================================================= */
.header {
    background-color: #1976d2;
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1000;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
    color: white;
}

.header-content p {
    font-size: 12px;
    opacity: 0.8;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow: visible;
}

/* =================================================================
   DROPDOWN MENUS - Clean Material Design
   ================================================================= */
.dropdown {
    position: relative;
    display: inline-block;
    overflow: visible;
}

.dropdown-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.dropdown-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    z-index: 10000;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    margin-top: 4px;
}

.dropdown.show .dropdown-content {
    display: block;
}

.dropdown-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item i {
    width: 16px;
    text-align: center;
}

/* =================================================================
   STATUS BAR - Clean and informative
   ================================================================= */
.status-bar {
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-left {
    display: flex;
    gap: 24px;
    align-items: center;
}

.status-item {
    font-size: 14px;
    color: #666;
}

.status-item strong {
    color: #1976d2;
    font-weight: 600;
}

.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quick-btn:hover {
    background-color: #1565c0;
}

/* =================================================================
   MAIN CONTAINER AND MAP
   ================================================================= */
.container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    /* Subtract header and status bar height */
}

.map-container {
    flex: 1;
    position: relative;
    background-color: #f5f5f5;
}

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

/* =================================================================
   CIRCLE CONTROLS - Material Design card
   ================================================================= */
.circle-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0e0e0;
    min-width: 250px;
    z-index: 1000;
}

.circle-controls h4 {
    margin: 0 0 16px 0;
    color: #1976d2;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 8px;
}

/* =================================================================
   BUTTONS - Material Design style
   ================================================================= */
.btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-transform: none;
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
}

.btn:hover {
    background-color: #1565c0;
    box-shadow: 0 4px 8px rgba(25, 118, 210, 0.3);
}

.btn:active {
    transform: translateY(1px);
}

.btn-secondary {
    background-color: #757575;
    box-shadow: 0 2px 4px rgba(117, 117, 117, 0.2);
}

.btn-secondary:hover {
    background-color: #616161;
    box-shadow: 0 4px 8px rgba(117, 117, 117, 0.3);
}

.btn:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}

/* =================================================================
   MODALS - Material Design dialog style
   ================================================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 24px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid #e0e0e0;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #1976d2;
    font-size: 20px;
    font-weight: 600;
    border-bottom: 2px solid #e3f2fd;
    padding-bottom: 12px;
}

.close {
    position: absolute;
    right: 16px;
    top: 16px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #1976d2;
}

/* =================================================================
   FORMS - Material Design form elements
   ================================================================= */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* =================================================================
   SEARCH CONTAINER
   ================================================================= */
.search-container {
    position: relative;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 16px;
}

/* =================================================================
   SEARCH RESULTS
   ================================================================= */
#searchResults {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 16px;
    background-color: white;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background-color: #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item.selected {
    background-color: #e3f2fd;
    border-left: 4px solid #1976d2;
}

/* =================================================================
   INFO BOXES
   ================================================================= */
.info-box {
    background-color: #e3f2fd;
    border: 1px solid #bbdefb;
    border-radius: 4px;
    padding: 12px;
    margin: 16px 0;
    font-size: 14px;
    color: #1565c0;
}

.info-box strong {
    font-weight: 600;
}

/* =================================================================
   UNDO BUTTON
   ================================================================= */
.undo-button {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: #ff9800;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
    z-index: 1000;
}

.undo-button:hover:not(:disabled) {
    background-color: #f57c00;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.undo-button:disabled {
    background-color: #e0e0e0;
    color: #9e9e9e;
    cursor: not-allowed;
    box-shadow: none;
}

/* =================================================================
   MAP MARKERS - Custom styling
   ================================================================= */
.station-marker {
    background: #1976d2;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    text-align: center;
    min-width: 40px;
}

.epicenter-marker {
    background: #ff4500;
    color: white;
    padding: 8px 12px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid white;
    text-align: center;
    min-width: 60px;
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .status-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .status-left {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .quick-actions {
        width: 100%;
        justify-content: center;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .circle-controls {
        position: relative;
        top: auto;
        right: auto;
        margin: 16px;
        width: calc(100% - 32px);
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 20px;
    }

    .dropdown-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 12px;
    }
}

/* =================================================================
   CUSTOM SCROLLBAR
   ================================================================= */
::-webkit-scrollbar {
    width: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

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

/* =================================================================
   LOADING AND ANIMATION STATES
   ================================================================= */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #1976d2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.p-1 {
    padding: 8px;
}

.p-2 {
    padding: 16px;
}

.p-3 {
    padding: 24px;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* =================================================================
   ACCESSIBILITY
   ================================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }

    .modal-content {
        border: 2px solid #333;
    }
}

/* =================================================================
   CIRCLE DRAWING MODE STYLES
   ================================================================= */
.drawing-mode-active {
    cursor: crosshair !important;
}

.drawing-mode-active #map {
    cursor: crosshair !important;
}

/* Drawing message tooltip */
#drawingMessage,
#profileMessage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(25, 118, 210, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    animation: fadeIn 0.2s ease;
}

/* Profile marker styles */
.profile-marker {
    background: transparent;
    border: none;
}

/* =================================================================
   ELEVATION PROFILE MODAL
   ================================================================= */
#elevationProfileModal .modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

#elevationPlotContainer {
    width: 100%;
    height: 400px;
    background: white;
    border-radius: 4px;
}

/* Elevation stats grid */
.elevation-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.elevation-stat {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    text-align: center;
}

.elevation-stat strong {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.elevation-stat span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1976d2;
}

/* =================================================================
   EPICENTER MARKER STYLES
   ================================================================= */
.epicenter-label {
    background: transparent;
    border: none;
}

.epicenter-label div {
    white-space: nowrap;
}

/* =================================================================
   QUICK ACTION BUTTONS ENHANCEMENT
   ================================================================= */
.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-btn {
    background-color: #1976d2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.quick-btn:hover {
    background-color: #1565c0;
    transform: translateY(-1px);
}

.quick-btn:active {
    transform: translateY(0);
}

/* =================================================================
   RESPONSIVE ADJUSTMENTS FOR NEW FEATURES
   ================================================================= */
@media (max-width: 768px) {
    .elevation-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    #elevationProfileModal .modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 16px;
    }

    #elevationPlotContainer {
        height: 300px;
    }

    .quick-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .elevation-stats {
        grid-template-columns: 1fr;
    }

    .quick-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
}