/* ================================================================
   CatenarySentinel — Anchor Catenary Forecaster
   Nautical deep-blue dark theme · Split dashboard layout
   ================================================================ */

/* -- Design Tokens ------------------------------------------------ */
:root {
    --color-bg: #060d1a;
    --color-surface: #0c1829;
    --color-surface-alt: #111f35;
    --color-text: #d0e4f5;
    --color-text-muted: #4a6a8a;
    --color-accent: #22d3ee;
    --color-accent-glow: rgba(34, 211, 238, 0.15);
    --color-ocean-deep: #0a1628;
    --color-ocean-mid: #0f2847;
    --color-seabed: #3d2f1a;
    --color-safe: #22c55e;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-chain: #94a3b8;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.3s ease;
}

/* -- Reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    -webkit-font-smoothing: antialiased;
}

/* -- Header ------------------------------------------------------- */
.app-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.app-header .accent { color: var(--color-accent); }

.app-header p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: 0.3rem;
}

/* -- Ad Placeholders ---------------------------------------------- */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(74, 106, 138, 0.3);
    background-color: rgba(0, 0, 0, 0.2);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0 auto;
    width: 100%;
}

.ad-mobile { height: 50px; max-width: 320px; }
.ad-desktop { display: none; height: 90px; max-width: 728px; }

/* -- Main Layout -------------------------------------------------- */
.app-main {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

/* -- Sidebar ------------------------------------------------------ */
.sidebar { width: 100%; }

.input-panel {
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.06);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.6rem;
}

.input-panel h2 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    margin-bottom: 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.input-group {
    margin-bottom: 0.7rem;
}

.input-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
}

.input-group input[type="number"] {
    width: 100%;
    background: var(--color-surface-alt);
    border: 1px solid rgba(148, 163, 184, 0.1);
    color: var(--color-text);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input[type="number"]:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.help-text {
    display: block;
    font-size: 0.68rem;
    color: rgba(74, 106, 138, 0.7);
    margin-top: 0.2rem;
    font-style: italic;
}

/* Wind Slider */
.wind-slider-group { padding-top: 0.3rem; }

input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    outline: none;
    margin-top: 0.4rem;
    background: linear-gradient(to right,
        var(--color-safe) 0%, var(--color-safe) 30%,
        var(--color-warning) 50%,
        var(--color-danger) 80%, #7f1d1d 100%
    );
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-text);
    cursor: pointer;
    border: 3px solid var(--color-bg);
    box-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-text);
    cursor: pointer;
    border: 3px solid var(--color-bg);
}

.wind-output {
    display: block;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-top: 0.3rem;
    font-variant-numeric: tabular-nums;
}

.beaufort-label {
    text-align: center;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    margin-top: 0.15rem;
    font-weight: 500;
}

/* Scope Panel */
.scope-panel {
    border: 1px solid rgba(34, 211, 238, 0.15);
}

.scope-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.2rem;
    margin-bottom: 0.3rem;
}

.scope-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-accent);
    font-variant-numeric: tabular-nums;
}

.scope-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.scope-guide {
    text-align: center;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

/* -- Main View ---------------------------------------------------- */
.main-view { width: 100%; }

.results-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.result-card {
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.06);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
}

.result-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
}

.result-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

.status-card.safe { border-color: var(--color-safe); }
.status-card.safe .result-value { color: var(--color-safe); }
.status-card.warning { border-color: var(--color-warning); }
.status-card.warning .result-value { color: var(--color-warning); }
.status-card.danger { border-color: var(--color-danger); }
.status-card.danger .result-value { color: var(--color-danger); }

/* Wind Gauge */
.gauge-row {
    margin-bottom: 0.75rem;
}

.gauge-container {
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.06);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}

.gauge-label-top {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.4rem;
    text-align: center;
}

.gauge-track {
    position: relative;
    width: 100%;
    height: 10px;
    background: var(--color-surface-alt);
    border-radius: 5px;
    overflow: visible;
}

.gauge-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.3s ease, background 0.3s ease;
    background: var(--color-safe);
}

.gauge-fill.warning { background: var(--color-warning); }
.gauge-fill.danger { background: var(--color-danger); }

.gauge-marker {
    position: absolute;
    top: -4px;
    width: 3px;
    height: 18px;
    background: #fff;
    border-radius: 2px;
    transition: left 0.3s ease;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.3rem;
    font-size: 0.68rem;
    color: var(--color-text-muted);
    font-weight: 600;
}

/* SVG Viewport */
.svg-viewport {
    background: var(--color-surface);
    border: 1px solid rgba(148, 163, 184, 0.06);
    border-radius: var(--radius-lg);
    padding: 0.75rem;
    overflow: hidden;
}

#oceanSvg {
    width: 100%;
    height: auto;
    min-height: 250px;
}

/* Legend */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-top: 0.75rem;
    padding: 0.5rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.legend-line {
    width: 18px;
    height: 3px;
    border-radius: 2px;
}

.chain-line { background: var(--color-chain); }
.seabed-line { background: var(--color-seabed); height: 2px; border-style: dashed; }

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.anchor-dot { background: var(--color-accent); }

/* Anchor Flash Animation */
@keyframes anchorFlash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.anchor-danger {
    animation: anchorFlash 0.5s ease-in-out infinite;
}

/* -- Footer ------------------------------------------------------- */
.app-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* ================================================================
   RESPONSIVE — Desktop
   ================================================================ */
@media (min-width: 768px) {
    .ad-mobile { display: none; }
    .ad-desktop { display: flex; }

    .dashboard {
        flex-direction: row;
        align-items: flex-start;
    }

    .sidebar {
        width: 300px;
        flex-shrink: 0;
    }

    .main-view {
        flex: 1;
        min-width: 0;
    }

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

/* ═══════════════ AFFILIATE & SEO ═══════════════ */
.seo-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 2rem 0;
}
.seo-card h2 {
    color: var(--color-accent);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}
.seo-card p {
    color: var(--color-text-muted);
    line-height: 1.6;
}
.affiliate-gear a {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
}
.affiliate-gear a:hover {
    color: var(--color-text);
    text-decoration: underline;
}
