/* CSS Variables for theming */
:root {
    --bg-primary: #0a1628;
    --bg-secondary: #152238;
    --bg-card: #1a2d4a;
    --text-primary: #e8f0ff;
    --text-secondary: #8fa4c4;
    --accent-blue: #4a9eff;
    --accent-gold: #ffd700;
    --walk-window: rgba(144, 238, 144, 0.25);
    --walk-window-border: rgba(144, 238, 144, 0.5);
    --high-tide: #ff6b6b;
    --low-tide: #4ecdc4;
    --current-marker: #ffd700;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    background-color: var(--bg-primary);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

header h1 {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: var(--text-primary);
}

header .location {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* Main Content */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Section Styling */
section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

section h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Moon Section */
.moon-display {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.moon-visual {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
}

#moonCanvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* Moon rise/set times */
.moon-times {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.moon-time-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.moon-time-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.moon-time-value {
    font-size: 0.95rem;
    color: var(--accent-gold);
    font-weight: 500;
}

.moon-info {
    flex: 1;
}

.phase-name {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.illumination {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.next-event {
    color: var(--accent-gold);
    font-size: 0.95rem;
}

/* Tide Section */
.station-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.tide-chart-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    height: 200px;
    position: relative;
}

#tideChart {
    width: 100%;
    height: 100%;
}

.tide-times {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tide-day h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tide-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tide-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.9rem;
}

.tide-item.high {
    border-left: 3px solid var(--high-tide);
}

.tide-item.low {
    border-left: 3px solid var(--low-tide);
}

.tide-type {
    font-weight: 500;
    min-width: 35px;
}

.tide-item.high .tide-type {
    color: var(--high-tide);
}

.tide-item.low .tide-type {
    color: var(--low-tide);
}

.tide-time {
    color: var(--text-primary);
}

.tide-height {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Walk Section */
.walk-info {
    background: rgba(144, 238, 144, 0.1);
    border: 1px solid var(--walk-window-border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.walk-window {
    text-align: center;
}

.walk-window .time-range {
    font-size: 1.5rem;
    font-weight: 500;
    color: #90ee90;
    margin-bottom: 0.25rem;
}

.walk-window .description {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.walk-window .low-tide-info {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--low-tide);
}

.no-walk {
    text-align: center;
    color: var(--text-secondary);
}

.calendar-link {
    text-align: center;
}

.calendar-link a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--accent-blue);
    text-decoration: none;
    padding: 0.75rem 1.25rem;
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.calendar-link a:hover {
    background: rgba(74, 158, 255, 0.2);
    border-color: rgba(74, 158, 255, 0.5);
}

.calendar-icon {
    font-size: 1.2rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.last-updated {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    section {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .moon-display {
        flex-direction: column;
        text-align: center;
    }

    .moon-visual {
        width: 120px;
        height: 120px;
    }

    .moon-times {
        justify-content: center;
    }

    .tide-chart-container {
        height: 180px;
        padding: 0.75rem;
    }

    .tide-list {
        grid-template-columns: 1fr 1fr;
    }

    .tide-item {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

@media (min-width: 768px) {
    .container {
        padding: 2rem;
    }

    header {
        padding: 2rem 0;
    }

    header h1 {
        font-size: 2.5rem;
    }

    section {
        padding: 2rem;
    }

    .moon-visual {
        width: 120px;
        height: 120px;
    }

    .tide-chart-container {
        height: 250px;
    }

    .tide-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Error State */
.error {
    color: #ff6b6b;
    text-align: center;
    padding: 1rem;
}
