:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-card: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --accent-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.15);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-card: #242424;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --border-color: #404040;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.header-content h1 {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-bottom: 5px;
}

.header-content h1 i {
    margin-right: 10px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.theme-toggle {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--text-primary);
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-hover);
}

/* Loading & Error */
.loading, .error {
    text-align: center;
    padding: 60px 20px;
}

.loading i {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.error {
    background: var(--bg-card);
    border-radius: 10px;
    border: 2px solid var(--danger-color);
}

.error i {
    font-size: 3rem;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

/* Sections */
.section {
    margin-bottom: 40px;
}

.section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--accent-color);
}

.section h2 i {
    margin-right: 10px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Current Weather */
.current-grid {
    display: grid;
    gap: 25px;
}

.current-main {
    text-align: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.temperature {
    font-size: 4rem;
    font-weight: 300;
    color: var(--accent-color);
}

.temp-unit {
    font-size: 2rem;
    color: var(--text-secondary);
}

.sky-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 10px;
    text-transform: capitalize;
}

.current-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.detail-item i {
    font-size: 1.5rem;
    color: var(--accent-color);
    width: 30px;
    text-align: center;
}

.detail-item > div {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Forecast */
.forecast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.forecast-day {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid var(--border-color);
}

.forecast-day:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.forecast-date {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.forecast-icon {
    font-size: 2.5rem;
    margin: 10px 0;
    color: var(--accent-color);
}

.forecast-temps {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 1.1rem;
}

.temp-max {
    color: var(--danger-color);
    font-weight: 600;
}

.temp-min {
    color: var(--accent-color);
}

.forecast-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.forecast-detail i {
    margin-right: 5px;
}

/* Tides Table */
.table-responsive {
    overflow-x: auto;
}

.tides-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.tides-table th,
.tides-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.tides-table thead th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.tides-table .sub-header th {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.tides-table tbody tr:hover {
    background: var(--bg-secondary);
}

.tides-table td:first-child {
    font-weight: 600;
    text-align: left;
}

.tide-high {
    color: var(--success-color);
    font-weight: 600;
}

.tide-low {
    color: var(--accent-color);
    font-weight: 600;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    margin-top: 50px;
    border-top: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.footer p {
    margin: 8px 0;
}

.footer strong {
    color: var(--accent-color);
}

.update-time {
    font-size: 0.9rem;
}

.disclaimer {
    font-size: 0.85rem;
    font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .temperature {
        font-size: 3rem;
    }
    
    .current-details {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .forecast-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .tides-table {
        font-size: 0.85rem;
    }
    
    .tides-table th,
    .tides-table td {
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px 0;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .card {
        padding: 15px;
    }
    
    .forecast-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
