/* Reset and Base Styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: Arial, sans-serif; 
    background: linear-gradient(135deg, #0C2B4E 0%, #1A3D64 100%); 
    min-height: 100vh; 
    padding: 20px; 
}

/* Container */
.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    background: #F4F4F4; 
    border-radius: 15px; 
    padding: 30px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.2); 
}

/* Typography */
h1 { 
    color: #0C2B4E; 
    text-align: center; 
    margin-bottom: 10px; 
}

.subtitle { 
    text-align: center; 
    color: #1D546C; 
    margin-bottom: 30px; 
}

/* Form Elements */
select { 
    padding: 15px 30px;
    font-size: 16px; 
    border: 2px solid #e0e0e0; 
    border-radius: 8px; 
    background: white; 
    cursor: pointer; 
    transition: border 0.3s; 
    width: auto;
    min-width: 470px;  
    margin-bottom: 20px; 
    display: block;
    margin-left: auto;
    margin-right: auto;
}

select:hover { 
    border-color: #1D546C; 
}

button { 
    padding: 15px 30px;
    font-size: 16px; 
    border: none; 
    border-radius: 8px; 
    background: #C1785A; 
    color: white; 
    cursor: pointer; 
    transition: all 0.3s; 
    width: auto;
    min-width: 470px;  
    margin-bottom: 30px; 
    display: block;
    margin-left: auto;
    margin-right: auto;
    white-space: nowrap;  
}

button:hover { 
    background: #a86548; 
}

button:active { 
    transform: scale(0.98); 
}

/* Loading State */
.loading { 
    text-align: center; 
    padding: 40px; 
    color: #7f8c8d; 
    display: none; 
}

.loading p {
    color: #1D546C;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    white-space: nowrap;
}

.loading-dots::after {
    content: '';
    animation: dots 2.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Error State */
.error { 
    background: #ffebee; 
    border-left: 4px solid #f44336; 
    padding: 20px; 
    border-radius: 8px; 
    color: #c62828; 
    display: none; 
}

/* Comparison Table */
.comparison-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 20px; 
    background: white; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1); 
}

.comparison-table th { 
    background: #1D546C; 
    color: white; 
    padding: 15px; 
    text-align: left; 
    font-weight: bold; 
}

.comparison-table td { 
    padding: 12px 15px; 
    border-bottom: 1px solid #e0e0e0; 
}

.comparison-table .location-row { 
    cursor: pointer; 
}

.comparison-table .location-row:hover { 
    background: #f5f5f5; 
}

/* Rank Badge */
.rank-badge { 
    display: inline-block; 
    width: 30px; 
    height: 30px; 
    line-height: 30px; 
    text-align: center; 
    border-radius: 50%; 
    font-weight: bold; 
    color: white; 
}

/* Score Bar */
.score-bar { 
    height: 20px; 
    background: #e0e0e0; 
    border-radius: 10px; 
    overflow: hidden; 
}

.score-fill { 
    height: 100%; 
    background: linear-gradient(90deg, #e74c3c, #f39c12, #2ecc71); 
    transition: width 0.5s; 
}

/* Map Styles */
#map { 
    width: 100%; 
    height: 500px; 
    border-radius: 10px; 
    margin-top: 20px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    position: relative; 
}

.map-container { 
    display: none; 
    margin-top: 30px; 
    position: relative; 
}

.map-sidebar { 
    position: absolute; 
    top: 0; 
    left: 0;
    width: 30%;
    height: 100%; 
    background: white; 
    box-shadow: 4px 0 12px rgba(0,0,0,0.3);
    z-index: 1000; 
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out; 
    border-radius: 10px 0 0 10px;
    pointer-events: auto;
}

.map-sidebar.open { 
    transform: translateX(0); 
}

.map-sidebar-content { 
    padding: 15px;
    font-size: 12px;
}

.map-sidebar-content h3 { 
    font-size: 16px; 
    margin-bottom: 10px; 
}

.map-sidebar-content h4 { 
    font-size: 12px; 
}

.map-sidebar-content .gear-grid { 
    grid-template-columns: 1fr; 
    gap: 10px; 
}

.map-sidebar-content .gear-card { 
    padding: 10px; 
    font-size: 11px; 
}

.map-sidebar-content .gear-card ul { 
    font-size: 11px; 
    line-height: 1.6; 
}

.map-sidebar-content .species-tag { 
    font-size: 10px; 
    padding: 3px 8px; 
}

.map-sidebar-content p { 
    font-size: 11px; 
}

.map-sidebar-content div[style*="font-size: 14px"] { 
    font-size: 11px !important; 
}

.map-sidebar-content div[style*="font-size: 36px"] { 
    font-size: 28px !important; 
}

.leaflet-control-zoom { 
    display: none !important; 
}

/* Expanded Row Details */
.expanded-row { 
    display: none; 
}

.expanded-row.show { 
    display: table-row; 
}

.expanded-row td { 
    padding: 0 !important; 
    background: #f8f9fa !important; 
}

.detail-wrapper { 
    padding: 20px; 
}

.detail-grid-4 { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 10px; 
    margin-bottom: 15px; 
}

.detail-grid-2 { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px; 
    margin-bottom: 15px; 
}

.detail-box { 
    background: white; 
    padding: 15px; 
    border-radius: 6px; 
    border-left: 3px solid #1D546C; 
}

/* Tide Chart */
.tide-chart-container {
    background: white;
    padding: 20px;
    border-radius: 6px;
    border-left: 3px solid #1D546C;
    margin-bottom: 15px;
}

.tide-chart-header {
    font-size: 10px;
    color: #1A3D64;
    font-weight: bold;
    margin-bottom: 10px;
}

.tide-chart-canvas {
    width: 100%;
    height: 200px;
    border-radius: 4px;
}

.tide-chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    font-size: 11px;
    color: #7f8c8d;
}

.tide-chart-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.tide-chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.tide-chart-legend-line {
    width: 20px;
    height: 2px;
}

/* Gear and Species */
.gear-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
    gap: 15px; 
    margin-top: 15px; 
}

.gear-card { 
    background: white; 
    padding: 15px; 
    border-radius: 6px; 
    border: 1px solid #e0e0e0; 
}

.gear-card h4 { 
    color: #C1785A; 
    font-size: 14px; 
    margin-bottom: 10px; 
}

.gear-card ul { 
    margin: 0; 
    padding-left: 20px; 
    font-size: 13px; 
    color: #555; 
    line-height: 1.8; 
}

.species-list { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 8px; 
    margin-top: 10px; 
}

.species-tag { 
    background: #1D546C; 
    color: white; 
    padding: 4px 12px; 
    border-radius: 12px; 
    font-size: 12px; 
}

/* Footer */
.footer { 
    text-align: center; 
    margin-top: 40px; 
    padding-top: 20px; 
    border-top: 2px solid #1D546C; 
    color: #1A3D64; 
    font-size: 14px; 
}

/* Responsive Design */
@media (max-width: 768px) {
    .detail-grid-4 { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .detail-grid-2 { 
        grid-template-columns: 1fr; 
    }
    
    .map-sidebar { 
        width: 100%; 
        border-radius: 10px 10px 0 0; 
        bottom: 0; 
        top: auto; 
        height: 70%; 
        transform: translateY(100%); 
    }
    
    .map-sidebar.open { 
        transform: translateY(0); 
    }
    
    select, button {
        min-width: 100%;
    }
}