* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8f9fa;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100vh;
    max-height: calc(100vh - 16px);
}

.header {
    text-align: center;
    padding: 8px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.header .info {
    margin: 4px 0 0 0;
    font-size: 0.9rem;
    color: #666;
}

.controls-panel {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.controls-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 140px;
}

.section strong {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 4px;
}

.control-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.control-line input[type='range'] {
    width: 80px;
}

.control-line input[type='number'] {
    width: 50px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.8rem;
}

.control-line label {
    font-size: 0.8rem;
    color: #666;
}

.map-container {
    background: white;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.chart-panel {
    background: white;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#map {
    flex: 1;
    min-height: 400px;
    border: 2px solid #ddd;
    border-radius: 6px;
}

.status-bar {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* Mobile responsive */
@media (max-width: 768px) {
    body {
        padding: 4px;
    }

    #map {
        min-height: 300px;
    }
}

h3 {
    font-size: 1rem;
    margin: 0 0 12px 0;
    color: #333;
    border-bottom: 2px solid #eee;
    padding-bottom: 6px;
}

.button-group {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.filter-controls {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.filter-controls:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.filter-checkbox {
    margin-bottom: 12px;
}

.filter-checkbox input[type='checkbox'] {
    margin-right: 8px;
}

.filter-checkbox label {
    font-size: 0.9rem;
    color: #555;
    cursor: pointer;
}

.filter-group {
    margin-bottom: 10px;
}

.filter-value {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.filter-value input[type='range'] {
    flex: 1;
    min-width: 100px;
}

.filter-value input[type='number'] {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.elevation-display {
    font-weight: 600;
    color: #2c5aa0;
    margin-bottom: 4px;
}

.coordinates {
    font-size: 0.85rem;
    color: #666;
}

.elevation-info {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.elevation-display {
    font-size: 18px;
    font-weight: bold;
    color: #2c5aa0;
    margin-bottom: 10px;
}

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

@media (max-width: 768px) {
    .elevation-info {
        padding: 12px;
    }

    .elevation-display {
        font-size: 16px;
    }

    .coordinates {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .elevation-info {
        padding: 10px;
    }

    .elevation-display {
        font-size: 15px;
        margin-bottom: 8px;
    }

    .coordinates {
        font-size: 12px;
    }
}

.loading {
    color: #ff9800;
    font-style: italic;
}

.error {
    color: #f44336;
}

.success {
    color: #4caf50;
}

.info a {
    color: #2c5aa0;
    text-decoration: none;
    font-weight: 500;
}

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

.controls {
    background: #f0f8ff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

.filter-controls {
    background: #fff5f5;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

.filter-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-option label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.filter-option input[type='range'] {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    outline: none;
}

.filter-option input[type='range']::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: #2c5aa0;
    border-radius: 50%;
    cursor: pointer;
}

.filter-option input[type='range']::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #2c5aa0;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.filter-value {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-value input[type='number'] {
    width: 80px;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.filter-checkbox input[type='checkbox'] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.controls h3 {
    margin: 0 0 10px 0;
    color: #333;
}

@media (max-width: 768px) {
    .controls {
        padding: 12px;
        margin-bottom: 15px;
    }

    .controls h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
}

@media (max-width: 480px) {
    .controls {
        padding: 10px;
    }

    .controls h3 {
        font-size: 1em;
    }
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

@media (max-width: 480px) {
    .button-group {
        flex-direction: column;
        gap: 8px;
    }

    button {
        width: 100%;
    }
}

button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

button.primary {
    background: #2c5aa0;
    color: white;
}

button.primary:hover {
    background: #1a4480;
}

button.secondary {
    background: #666;
    color: white;
}

button.secondary:hover {
    background: #444;
}

button.danger {
    background: #f44336;
    color: white;
}

button.danger:hover {
    background: #d32f2f;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.mode-info {
    font-size: 11px;
    color: #666;
    margin-top: 6px;
    font-style: italic;
}

#chart-container {
    display: none;
}

#chart-container.visible {
    display: block;
}

#chart-container h3 {
    margin: 0 0 15px 0;
    color: #333;
}

#elevation-chart {
    max-height: 400px;
}

@media (max-width: 768px) {
    #chart-container {
        padding: 15px;
        margin-bottom: 15px;
    }

    #chart-container h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }

    #elevation-chart {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    #chart-container {
        padding: 10px;
    }

    #chart-container h3 {
        font-size: 1em;
        margin-bottom: 10px;
    }

    #elevation-chart {
        max-height: 250px;
    }
}

.chart-info {
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 14px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

@media (max-width: 768px) {
    .stats {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .stat-value {
        font-size: 16px;
    }

    .stat-label {
        font-size: 11px;
    }
}

.stat {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #2c5aa0;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

/* GPX Upload Styles */
.gpx-status {
    font-size: 0.8rem;
    margin-top: 4px;
    min-height: 1rem;
    color: #666;
}

.gpx-status.loading {
    color: #ff9800;
    font-style: italic;
}

.gpx-status.success {
    color: #4caf50;
    font-weight: 500;
}

.gpx-status.error {
    color: #f44336;
    font-weight: 500;
}

/* Mobile responsive for GPX controls */
@media (max-width: 480px) {
    .gpx-status {
        font-size: 0.75rem;
    }
}
