/**
 * Elevation Lookup App Styles
 * @version 1.0.0
 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #eee;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 5px;
}

header .subtitle {
    color: #888;
    font-size: 1rem;
}

.search-section {
    margin-bottom: 20px;
}

.search-box {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid #333;
    border-radius: 8px;
    background: #252540;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #4a90d9;
}

.search-box input::placeholder {
    color: #666;
}

.search-box button {
    padding: 12px 24px;
    font-size: 1rem;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-box button:hover {
    background: #3a7bc8;
}

.search-box button:disabled {
    background: #555;
    cursor: not-allowed;
}

.hint {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-top: 8px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    flex: 1;
    min-height: 500px;
}

.map-container {
    background: #252540;
    border-radius: 12px;
    overflow: hidden;
    min-height: 500px;
}

#map {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

.results-panel {
    background: #252540;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
}

.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: #1a1a2e;
    border-radius: 8px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #333;
    border-top-color: #4a90d9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error {
    padding: 15px;
    background: #3d1f1f;
    border: 1px solid #8b3a3a;
    border-radius: 8px;
    color: #ff8a8a;
}

.placeholder {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.placeholder .note {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #666;
}

#results h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #fff;
}

.coordinates {
    background: #1a1a2e;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.9rem;
}

.source-card {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid #4a90d9;
}

.source-card.secondary {
    border-left-color: #6b8e6b;
}

.source-card h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.source-card .badge {
    font-size: 0.7rem;
    padding: 2px 8px;
    background: #4a90d9;
    border-radius: 4px;
    text-transform: uppercase;
}

.source-card.secondary .badge {
    background: #6b8e6b;
}

.elevation-value {
    font-size: 2rem;
    font-weight: bold;
    color: #4a90d9;
    margin-bottom: 5px;
}

.source-card.secondary .elevation-value {
    color: #8fbc8f;
}

.elevation-metric {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.source-details {
    font-size: 0.85rem;
    color: #888;
}

.source-details p {
    margin-bottom: 5px;
}

.source-details a {
    color: #4a90d9;
    text-decoration: none;
}

.source-details a:hover {
    text-decoration: underline;
}

.citation-box {
    margin-top: 12px;
    padding: 10px;
    background: #16162d;
    border-radius: 6px;
    border-left: 3px solid #666;
}

.citation-box .label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.citation-box .citation-text {
    font-size: 0.85rem;
    color: #aaa;
}

footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #333;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #666;
}

.citations-info a {
    color: #4a90d9;
    text-decoration: none;
}

.citations-info a:hover {
    text-decoration: underline;
}

#page-timing {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
}

/* Mobile responsive */
@media (max-width: 900px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .map-container {
        min-height: 350px;
    }

    #map {
        min-height: 350px;
    }

    .results-panel {
        min-height: 300px;
    }

    .footer-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-box button {
        width: 100%;
    }
}

/* Info Panel */
.info-panel {
    background: rgba(30, 30, 50, 0.95);
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    color: #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    max-width: 220px;
}

.panel-section {
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

.panel-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-section strong {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: #fff;
}

.panel-section select {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.8rem;
    background: #1a1a2e;
    color: #fff;
    border: 1px solid #444;
    border-radius: 4px;
    margin-bottom: 8px;
    cursor: pointer;
}

.panel-section select:focus {
    outline: none;
    border-color: #4a90d9;
}

.slr-color {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #aaa;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: #ccc;
}

.legend-color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.zoom-note {
    font-size: 0.7rem;
    color: #888;
    font-style: italic;
    margin-top: 6px;
}

.data-info button {
    width: 100%;
    padding: 8px;
    background: #333;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s, color 0.2s;
}

.data-info button:hover {
    background: #444;
    color: #fff;
}

/* Info Modal */
.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 25px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    color: #ddd;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #fff;
    font-size: 1.3rem;
}

.modal-content h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #4a90d9;
    font-size: 1rem;
}

.modal-content p {
    margin-bottom: 10px;
    line-height: 1.5;
    font-size: 0.9rem;
}

.modal-content ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.modal-content li {
    margin-bottom: 5px;
    line-height: 1.4;
    font-size: 0.9rem;
}

.modal-content a {
    color: #4a90d9;
}

.modal-content .note {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

@media (max-width: 600px) {
    .info-panel {
        font-size: 0.75rem;
        padding: 10px 12px;
        max-width: 180px;
    }

    .panel-section select {
        font-size: 0.75rem;
        padding: 5px 6px;
    }

    .legend-item {
        font-size: 0.7rem;
    }

    .modal-content {
        padding: 20px;
        max-height: 90vh;
    }

    .modal-content h2 {
        font-size: 1.1rem;
    }

    .modal-content h3 {
        font-size: 0.95rem;
    }

    .modal-content p,
    .modal-content li {
        font-size: 0.85rem;
    }
}
