:root {
    --navy-900: #0a1628;
    --navy-800: #111d35;
    --navy-700: #1a2744;
    --navy-600: #243352;
    --accent: #2563eb;
    --text: #1e293b;
    --text-dim: #64748b;
}

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

body {
    background: #f8fafc;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

header {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.6rem 1rem;
}
header h1 { color: #0f172a; }

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}
.back-link:hover { opacity: 0.8; }

#map { z-index: 1; }

/* Layer panel */
.layer-panel {
    position: absolute;
    top: 10px;
    right: 50px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.8rem;
    z-index: 1000;
    min-width: 210px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.layer-panel.hidden { display: none; }
.layer-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.6rem;
    font-weight: 600;
    font-size: 0.85rem;
    color: #0f172a;
}
.layer-panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}
.layer-panel-close:hover { background: #f1f5f9; color: var(--text); }

.layer-toggles {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.layer-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text);
    cursor: pointer;
    padding: 0.2rem 0;
}
.layer-toggle:hover { color: var(--accent); }
.layer-toggle input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

.layer-toggle-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    transition: all 0.15s;
}
.layer-toggle-btn:hover { background: #f1f5f9; box-shadow: 0 2px 10px rgba(0,0,0,0.12); }

/* Footer */
.stt-footer { padding: 0.6rem; text-align: center; border-top: 1px solid #e2e8f0; background: #fff; }
.footer-main { font-size: 0.75rem; color: var(--text-dim); display: flex; align-items: center; justify-content: center; gap: 0.3rem; flex-wrap: wrap; }
.footer-dot { margin: 0 0.3rem; }
.footer-link { color: var(--accent); text-decoration: none; }
.footer-link:hover { opacity: 0.8; }

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12) !important;
}
.leaflet-popup-content { margin: 10px 14px !important; }

/* Ferry popup */
.ferry-popup { font-size: 0.8rem; min-width: 220px; }
.ferry-popup h3 { font-size: 0.95rem; margin-bottom: 0.3rem; color: #0f172a; }
.ferry-popup .detail { color: #64748b; font-size: 0.72rem; }

/* Marina markers */
.marina-popup { font-size: 0.8rem; }
.marina-popup h3 { font-size: 0.9rem; margin-bottom: 0.3rem; color: #0f172a; }
.marina-popup .detail { color: #64748b; font-size: 0.72rem; }

/* Tide station popup */
.tide-popup { font-size: 0.8rem; max-width: 300px; }
.tide-popup h3 { font-size: 0.95rem; margin-bottom: 0.4rem; color: #0f172a; }
.tide-popup .detail { color: #64748b; font-size: 0.72rem; }
.tide-popup .tide-table { width: 100%; font-size: 0.72rem; margin-top: 0.5rem; border-collapse: collapse; }
.tide-popup .tide-table th, .tide-popup .tide-table td { padding: 0.25rem 0.4rem; text-align: left; border-bottom: 1px solid #f1f5f9; }
.tide-popup .tide-table th { color: #94a3b8; font-weight: 500; }

/* Leaflet zoom controls */
.leaflet-control-zoom a {
    background: #fff !important;
    color: #0f172a !important;
    border-color: #e2e8f0 !important;
}
.leaflet-control-zoom a:hover { background: #f1f5f9 !important; }
.leaflet-control-attribution { font-size: 0.6rem !important; background: rgba(255,255,255,0.8) !important; }
.leaflet-control-attribution a { color: var(--accent) !important; }

@media (max-width: 480px) {
    .layer-panel { min-width: 170px; right: 5px; top: 5px; }
    .layer-toggle-btn { top: 5px; right: 5px; }
}
