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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Header styles */
header {
    background: linear-gradient(135deg, #2c5f2d, #4a7c59);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 300;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content */
main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

/* Controls */
#controls {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#loadData {
    background: #4a7c59;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

#loadData:hover {
    background: #2c5f2d;
}

#info {
    color: #666;
    font-style: italic;
}

/* Map container */
#map {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Legend styles */
#legend {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #555;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid #ccc;
}

.legend-dot.green { background-color: #4285f4; }
.legend-dot.ltblue { background-color: #34a853; }
.legend-dot.yellow { background-color: #fbbc04; }
.legend-dot.orange { background-color: #ff6d01; }
.legend-dot.blue { background-color: #cc0300; }

/* Trails Table Styles */
#trails-table-container {
    margin-top: 30px;
}

#trails-table-container h2 {
    color: #2c5f2d;
    margin-bottom: 20px;
    text-align: center;
}

#table-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

#search-input, #difficulty-filter {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
}

#search-input {
    flex: 1;
    min-width: 200px;
}

#difficulty-filter {
    min-width: 150px;
}

#trails-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

#trails-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

#trails-table th {
    background: #4a7c59;
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

#trails-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

#trails-table tbody tr:hover {
    background-color: #f8f9fa;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.trail-action-btn {
    background: #4a7c59;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.trail-action-btn:hover {
    background: #2c5f2d;
}

.trail-description, .trail-comments {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trail-description:hover, .trail-comments:hover {
    white-space: normal;
    overflow: visible;
}

/* Responsive design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    #controls {
        flex-direction: column;
        text-align: center;
    }
    
    .legend-items {
        justify-content: center;
        gap: 10px;
    }
    
    #map {
        height: 400px;
    }
    
    main {
        padding: 0 10px;
    }
    
    #table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    #search-input, #difficulty-filter {
        width: 100%;
    }
    
    #trails-table-wrapper {
        font-size: 12px;
    }
    
    #trails-table th, #trails-table td {
        padding: 8px 4px;
    }
    
    .trail-description, .trail-comments {
        max-width: 150px;
    }
}

/* Loading indicator */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a7c59;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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