* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0066cc;
    --primary-dark: #0052a3;
    --secondary: #00d4ff;
    --accent: #ff6b35;
    --success: #06d6a0;
    --warning: #ffa500;
    --danger: #ff3333;
    --bg-dark: #0f1419;
    --bg-light: #1a1f2e;
    --card-bg: #252d3d;
    --text-primary: #ffffff;
    --text-secondary: #a0aac0;
    --border: #3a4454;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-light) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-dark);
}

/* Header */
.header {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.1) 0%, rgba(0, 212, 255, 0.05) 100%);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-link:hover .logo-text h1 {
    color: var(--primary);
}

.logo-img {
    height: 36px;
    width: auto;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0;
    color: var(--secondary);
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

.logo-text p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 2px 0 0 0;
    letter-spacing: 1px;
}

.refresh-btn-header {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: rgba(0, 102, 204, 0.1);
    border-radius: 8px;
    color: var(--secondary);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.refresh-btn-header:hover {
    background: rgba(0, 102, 204, 0.2);
    border-color: var(--secondary);
    transform: rotate(180deg);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
}

/* Hero Card - Wind Status */
.hero-card {
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.2) 0%, rgba(0, 212, 255, 0.1) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px 24px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.wind-hero {
    position: relative;
    z-index: 1;
    text-align: center;
}

.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
    margin-bottom: 16px;
}

.status-dot.warning {
    background: var(--warning);
}

.status-dot.danger {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.wind-status {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 16px;
}

.wind-main {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.wind-value {
    font-size: 64px;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1;
    text-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

.wind-unit {
    font-size: 24px;
    color: var(--text-secondary);
    font-weight: 600;
}

.wind-recommendation {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 16px;
}

/* Quick Stats */
.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(37, 45, 61, 0.95) 0%, rgba(26, 31, 46, 0.9) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 14px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card:nth-child(1) {
    grid-column: span 2;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.12) 0%, rgba(0, 212, 255, 0.08) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.stat-card:hover {
    background: linear-gradient(135deg, rgba(37, 45, 61, 1) 0%, rgba(26, 31, 46, 0.95) 100%);
    border-color: var(--secondary);
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.25);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(2):hover {
    border-color: var(--secondary);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
    text-shadow: 0 0 15px rgba(0, 212, 255, 0.3);
    letter-spacing: -0.5px;
}

/* Compass */
.compass-container {
    width: 100%;
    max-width: 140px;
    margin: 8px auto 10px;
}

.compass {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(0, 212, 255, 0.25));
    aspect-ratio: 1;
    transition: filter 0.3s ease;
}

.stat-card:hover .compass {
    filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.4));
}

#windNeedle {
    filter: drop-shadow(0 0 8px rgba(255, 107, 53, 0.8)) drop-shadow(0 0 3px rgba(255, 51, 0, 1));
}

#needleInner {
    transform-box: fill-box;
    transform-origin: center;
}

#windNeedle polygon {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

#windNeedle circle {
    filter: drop-shadow(0 0 4px rgba(255, 107, 53, 0.9));
}

.wind-compass-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 6px;
    text-shadow: 0 0 10px rgba(255, 107, 53, 0.4);
    letter-spacing: 1px;
}

/* Sections */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tides Section */
.tides-section {
    margin-bottom: 24px;
}

.tides-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.tide-item {
    background: rgba(37, 45, 61, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.tide-item:hover {
    background: rgba(37, 45, 61, 1);
    border-color: var(--secondary);
    transform: translateY(-4px);
}

.tide-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tide-time {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.tide-height {
    font-size: 14px;
    color: var(--text-secondary);
}

.tide-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.tide-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Sun Section */
.sun-section {
    margin-bottom: 24px;
}

.sun-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}

.sun-item {
    background: rgba(37, 45, 61, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.sun-item:hover {
    background: rgba(37, 45, 61, 1);
    border-color: var(--secondary);
    transform: translateY(-4px);
}

.sun-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.sun-time {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

/* Chart Sections */
.chart-section {
    background: rgba(37, 45, 61, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.tide-chart-section {
    background: rgba(37, 45, 61, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

#windChart {
    max-height: 300px;
}

#tideChart {
    max-height: 350px;
}

/* Details Section */
.details-section {
    margin-bottom: 24px;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.detail-card {
    background: rgba(37, 45, 61, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}

.detail-card:hover {
    background: rgba(37, 45, 61, 1);
    border-color: var(--secondary);
    transform: translateY(-4px);
}

.detail-card label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px 16px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 24px;
}

.footer p {
    margin: 4px 0;
    font-size: 13px;
}

#lastUpdated {
    color: var(--secondary);
    font-weight: 600;
}

.footer-text {
    font-size: 12px;
    opacity: 0.8;
}

.footer-text a {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.footer-text a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Loading & Error States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.error {
    background: rgba(255, 51, 51, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card, .tide-item, .sun-item, .detail-card {
    animation: fadeIn 0.5s ease-out;
}

/* Mobile Responsive */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-site-btn {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.18) 0%, rgba(0, 212, 255, 0.12) 100%);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.25s ease;
}

.main-site-btn:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .header {
        padding: 12px;
    }

    .logo-img {
        height: 28px;
    }

    .logo-text h1 {
        font-size: 16px;
    }

    .logo-text p {
        font-size: 10px;
    }

    .main-content {
        padding: 12px;
    }

    .hero-card {
        padding: 24px 16px;
    }

    .wind-value {
        font-size: 48px;
    }

    .wind-unit {
        font-size: 18px;
    }

    .quick-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-card:nth-child(1) {
        grid-column: span 2;
        padding: 10px 12px;
    }

    .compass-container {
        max-width: 120px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 18px;
    }

    .tides-container,
    .sun-container {
        grid-template-columns: 1fr;
    }

    .section-title {
        font-size: 16px;
    }

    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-section {
        padding: 16px 12px;
    }

    #windChart {
        max-height: 250px;
    }
    .main-site-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .logo-text h1 {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .wind-value {
        font-size: 40px;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .stat-card:nth-child(1) {
        grid-column: span 1;
    }

    .compass-container {
        max-width: 110px;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }

    .hero-card {
        padding: 20px 16px;
    }

    .footer p {
        font-size: 12px;
    }
    .main-site-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}
