/* =========================================================================
   Sandy Boys Surf Dashboard
   ========================================================================= */

:root {
    --font-mono: 'JetBrains Mono', monospace;
    --bg: #fafafa;
    --surface: #fff;
    --border: #ddd;
    --text: #1a1a1a;
    --text-muted: #888;
    --accent: #2563eb;
    --green: #16a34a;
    --red: #dc2626;
    --amber: #d97706;
    --col-w: 58px;
    --label-w: 80px;
}

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

body {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.3;
    background: var(--bg);
    color: var(--text);
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px;
}

@media (min-width: 1800px) {
    body { max-width: 1600px; }
}

@media (max-width: 768px) {
    body { padding: 12px 8px; }
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.cam-thumb:hover { text-decoration: none; }


/* -- Page header ------------------------------------------------------- */

.page-header {
    margin-bottom: 24px;
    padding-bottom: 8px;
}

.page-header h1 {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tagline {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}


/* -- Tabs -------------------------------------------------------------- */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 400;
    padding: 8px 16px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}

.tab:hover {
    color: var(--text);
}

.tab--active {
    color: var(--text);
    font-weight: 500;
    border-bottom-color: var(--text);
}

.tab-panel {
    display: none;
}

.tab-panel--active {
    display: block;
}


/* -- Spot jump nav ---------------------------------------------------- */

.spot-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 2px;
    margin-bottom: 16px;
    font-size: 10px;
    line-height: 1.6;
}

.spot-nav-link {
    color: var(--text-muted);
    white-space: nowrap;
}

.spot-nav-link:hover {
    color: var(--accent);
}

.spot-nav-sep {
    color: var(--border);
    margin: 0 3px;
}


/* -- Spot section ------------------------------------------------------ */

.spot-section {
    margin-bottom: 32px;
}

.spot-header {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 8px;
}

.spot-header a { color: var(--text); }
.spot-header a:hover { color: var(--accent); }


/* -- Table scroll wrapper ---------------------------------------------- */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 3px;
}

/* -- Day separator ----------------------------------------------------- */

.day-sep {
    border-left: 2px solid var(--border) !important;
}


/* -- Data table -------------------------------------------------------- */

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th {
    width: var(--label-w);
    min-width: var(--label-w);
    max-width: var(--label-w);
    text-align: left;
    padding: 2px 8px 2px 6px;
    font-weight: 400;
    font-size: 10px;
    color: var(--text);
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--surface);
}

.data-table td {
    min-width: var(--col-w);
    text-align: right;
    padding: 2px 6px;
}

.data-table tr + tr td,
.data-table tr + tr th {
    border-top: 1px solid #eee;
}

.day-header {
    font-weight: 500;
    padding: 4px 6px !important;
    background: #e8e8e8;
    color: #444;
    border-bottom: 1px solid var(--border);
}

td.day-header {
    text-align: center !important;
}

th.day-header {
    text-align: left !important;
    background: #e8e8e8;
}

.time-cell {
    font-weight: 500;
    background: #f4f4f4;
}


/* -- Text color indicators --------------------------------------------- */

.good { color: var(--green); font-weight: 500; background: #dcf5e2; }
.warn { color: var(--amber); font-weight: 500; background: #fcefd8; }
.poor { color: var(--red); font-weight: 500; background: #fcdcdc; }
.optimal { box-shadow: inset 3px 0 0 #93c5fd; }


/* -- Direction arrow SVG ----------------------------------------------- */

.direction-arrow {
    display: inline-block;
    vertical-align: middle;
    fill: var(--text);
    opacity: 0.65;
}


/* -- Tide bar indicator ------------------------------------------------ */

.tide-bar-container {
    display: inline-block;
    width: 4px;
    height: 14px;
    vertical-align: middle;
    position: relative;
    margin-left: 3px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}

.tide-bar {
    display: block;
    width: 100%;
    position: absolute;
    bottom: 0;
    border-radius: 2px;
}


/* -- Full-width tide bar row ------------------------------------------- */

.tide-bar-cell {
    padding: 0 !important;
    position: relative;
    height: 20px;
    vertical-align: bottom;
}

.tide-bar-full {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
}


/* -- Spot guide strip ------------------------------------------------- */

.spot-guide {
    display: flex;
    gap: 16px;
    margin-bottom: 8px;
    font-size: 10px;
}

.guide-bars {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.guide-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    line-height: 1.5;
}

.guide-item {
    color: var(--text-muted);
}

.guide-label {
    color: var(--text);
    font-weight: 500;
    margin-right: 2px;
}

.spark-bar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.spark-label {
    font-size: 9px;
    width: 34px;
    min-width: 34px;
    flex-shrink: 0;
    text-align: right;
    color: var(--text-muted);
    white-space: nowrap;
}

.spark-track {
    position: relative;
    width: 48px;
    min-width: 48px;
    flex-shrink: 0;
    height: 12px;
    background: #e8e8e8;
    border-radius: 2px;
    overflow: hidden;
}

.spark-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #c0c0c0;
    border-radius: 2px;
}

.spark-value {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 500;
    color: var(--text);
    z-index: 1;
}

.spark-summary {
    font-size: 9px;
    font-weight: 500;
    color: var(--text);
}

.spark-desc {
    font-size: 9px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .spot-guide { flex-direction: column; }
    .cam-thumb { flex: 0 0 80vw; }
}


/* -- Cam thumbnails --------------------------------------------------- */

.cam-scroll-wrap {
    position: relative;
    margin-bottom: 6px;
}

.cam-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: #999 #e8e8e8;
}


/* Thin, squared-off scrollbar */
.cam-strip::-webkit-scrollbar {
    height: 4px;
}

.cam-strip::-webkit-scrollbar-track {
    background: #e8e8e8;
    border-radius: 0;
}

.cam-strip::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 0;
}

/* Scroll hint arrows */
.cam-scroll-hint {
    position: absolute;
    top: 50%;
    transform: translateY(calc(-50% - 3px));
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    background: rgba(0,0,0,0.45);
    border-radius: 50%;
}

.cam-scroll-hint--visible {
    opacity: 1;
}

.cam-scroll-hint--right {
    right: 6px;
}

.cam-scroll-hint--left {
    left: 6px;
}

.cam-scroll-hint svg {
    width: 14px;
    height: 14px;
    fill: #fff;
}

.cam-thumb {
    flex: 0 0 calc((100% - 18px) / 4);
    border-radius: 3px;
    overflow: hidden;
    display: block;
    background: #0c0c0c;
    border: 1px solid #2a2a2a;
}

.cam-thumb video {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    cursor: pointer;
}

.cam-still {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    display: block;
    filter: grayscale(1) brightness(0.6);
}

.cam-still--empty {
    background: #1a1a1a;
}

.cam-offline-badge {
    color: #666;
    font-size: 8px;
}

.cam-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 6px;
    background: #0c0c0c;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-top: 1px solid #1a1a1a;
}


/* -- Loading spinner --------------------------------------------------- */

.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 12px;
    color: var(--text-muted);
}
