/* ==========================================================================
   LUNITIDAL INTERVAL — DESIGN SISTEMÁTICO COM ALTO CONTRASTE
   ========================================================================== */

:root {
    /* Modo Claro: Fundo cinzento suave (slate-100) vs Cards Branco Puro */
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --card-border: #cbd5e1;
    --card-border-hover: #2563eb;
    --text: #0f172a;
    --text-muted: #475569;
    --header-bg: #ffffff;
    
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    
    --accent: #d97706;
    --accent-light: #fef3c7;
    --accent-text: #b45309;
    
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-card-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
    /* Modo Escuro: Fundo muito escuro vs Cards com tom azul-marinho visível */
    --bg: #070b14;
    --card-bg: #111a2e;
    --card-border: #1e2c47;
    --card-border-hover: #3b82f6;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --header-bg: #0d1424;
    
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.18);
    
    --accent: #f59e0b;
    --accent-light: rgba(245, 158, 11, 0.15);
    --accent-text: #fbbf24;
    
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 10px 20px -3px rgba(0, 0, 0, 0.6);
    --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

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

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.site-header {
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--card-border);
    padding: 0.85rem 0;
}

.header-inner { display: flex; align-items: center; justify-content: space-between; }
.brand-link { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--text); }
.brand-name { font-size: 1.25rem; letter-spacing: -0.02em; }
.brand-logo { display: block; border-radius: 8px; }

.footer-link { font-size:0.8rem; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.footer-link a { text-decoration: none; color: var(--primary); }

.btn-theme {
    background: transparent; border: 1px solid var(--card-border);
    cursor: pointer; color: var(--text); padding: 0.5rem;
    border-radius: var(--radius-sm); transition: all 0.2s ease;
}
.btn-theme:hover { background-color: var(--primary-light); color: var(--primary); }

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Hero */
.page-home { padding-top: 3rem; padding-bottom: 5rem; flex: 1; }
.hero-intro { text-align: center; margin-bottom: 3rem; }
.hero-title { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.hero-subtitle { color: var(--text-muted); font-size: 1.05rem; max-width: 720px; margin: 0 auto; line-height: 1.6; }

/* Calculator Card */
.calculator-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2.25rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 4.5rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.wizard-stepper {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1.5rem;
    margin-bottom: 2rem;
    gap: 0.75rem;
}

.step-indicator { display: flex; align-items: center; gap: 0.65rem; opacity: 0.45; font-weight: 600; font-size: 0.95rem; }
.step-indicator.is-active { opacity: 1; }
.step-num { width: 30px; height: 30px; border-radius: 50%; background-color: var(--bg); border: 1px solid var(--card-border); color: var(--text); display: flex; align-items: center; justify-content: center; font-size: 0.85rem; font-weight: 700; }
.step-indicator.is-active .step-num { background-color: var(--primary); border-color: var(--primary); color: #ffffff; }

.wizard-pane { display: none; }
.wizard-pane.is-visible { display: block; animation: paneFade 0.25s ease; }
@keyframes paneFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.pane-header { margin-bottom: 1.75rem; }
.pane-badge { background-color: var(--primary-light); color: var(--primary); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; padding: 0.25rem 0.55rem; border-radius: 4px; display: inline-block; margin-bottom: 0.5rem; }
.pane-header h2 { font-size: 1.5rem; margin-bottom: 0.35rem; }
.pane-header p { color: var(--text-muted); }

.actions-geo { display: flex; align-items: center; flex-wrap: wrap; gap: 0.85rem; margin-bottom: 1.5rem; }
.sep-text { font-size: 0.9rem; color: var(--text-muted); }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-bottom: 1.75rem; }
@media (min-width: 560px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.form-group { display: flex; flex-direction: column; gap: 0.45rem; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .picker-group select {
    padding: 0.8rem 1rem; border: 1px solid var(--card-border); border-radius: var(--radius-sm);
    background-color: var(--bg); color: var(--text); font-size: 1rem; transition: border-color 0.2s;
}
.form-group input:focus, .picker-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* Buttons */
.btn-primary, .btn-secondary, .btn-accent, .btn-ghost {
    padding: 0.75rem 1.4rem; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.95rem;
    cursor: pointer; border: none; display: inline-flex; align-items: center; gap: 0.5rem; transition: all 0.2s ease;
}
.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background-color: var(--primary-light); color: var(--primary); border: 1px solid var(--card-border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-accent { background-color: var(--accent); color: #ffffff; }
.btn-accent:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--card-border); }
.btn-ghost:hover { background-color: var(--bg); color: var(--text); }

.pane-footer { display: flex; justify-content: flex-end; margin-top: 2rem; border-top: 1px solid var(--card-border); padding-top: 1.5rem; }
.pane-footer.double-actions { justify-content: space-between; }

/* Info box & pickers */
.info-box { background-color: var(--bg); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.info-row { display: flex; justify-content: space-between; font-size: 0.95rem; }
.info-label { color: var(--text-muted); }
.highlight-row { border-top: 1px solid var(--card-border); padding-top: 0.85rem; }
.highlight-val { font-size: 1.3rem; color: var(--primary); }
.tide-instruction { font-size: 1rem; margin-bottom: 1.5rem; }
.time-picker-wrap { display: flex; align-items: center; justify-content: center; gap: 0.85rem; margin: 1.5rem 0; }
.picker-group { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; }
.time-sep { font-size: 2rem; font-weight: 700; margin-top: 1.25rem; }

/* ==========================================
   DIRETÓRIO DE PAÍSES (country-grid & country-card)
   ========================================== */
.directory-section { margin-top: 2rem; }
.section-heading { margin-bottom: 2rem; }
.section-heading h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.35rem; }
.section-heading p { color: var(--text-muted); font-size: 0.95rem; }

.country-grid {
    display: grid;
    /* Cartões mais largos para evitar amontoamento */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.15rem;
}

/* Card com Alto Contraste */
.country-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 1.1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.country-card:hover {
    border-color: var(--card-border-hover);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.country-name {
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.port-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg);
    border: 1px solid var(--card-border);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    white-space: nowrap;
}

.count-empty {
    color: var(--accent-text);
    background-color: var(--accent-light);
    border-color: transparent;
    font-weight: 700;
}

/* ==========================================
   PAGINAÇÃO (Para o futuro e listagens longas)
   ========================================== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 3.5rem;
}

.page-btn {
    padding: 0.65rem 1.25rem;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.page-indicator {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ==========================================
   MODAL DIALOG (Substitui o alert())
   ========================================== */
.modal-backdrop {
    position: fixed; inset: 0;
    background-color: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.is-active {
    opacity: 1; visibility: visible;
}

.modal-box {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-modal);
    width: 100%; max-width: 440px;
    margin: 1.25rem;
    overflow: hidden;
    transform: scale(0.96);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.is-active .modal-box {
    transform: scale(1);
}

.modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.modal-head h3 { font-size: 1.15rem; font-weight: 700; color: var(--text); }

.modal-close {
    background: none; border: none; font-size: 1.5rem; line-height: 1;
    color: var(--text-muted); cursor: pointer; padding: 0.25rem;
}
.modal-close:hover { color: var(--text); }

.modal-text {
    padding: 1.5rem; font-size: 0.95rem; color: var(--text); line-height: 1.6;
}

.modal-foot {
    display: flex; justify-content: flex-end; padding: 1rem 1.5rem;
    background-color: var(--bg); border-top: 1px solid var(--card-border);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--card-border);
    background-color: var(--header-bg);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================
   BREADCRUMBS & DIRECTORY EXTENSIONS
   ========================================== */
.page-directory {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .sep {
    color: var(--card-border);
}

.breadcrumb .current {
    font-weight: 600;
    color: var(--text);
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

/* Notice / Crowdsource Disclaimer Card */
.notice-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    box-shadow: var(--shadow-card);
}

.notice-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.notice-body strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.notice-body p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Utilitário de visibilidade */
.is-hidden {
    display: none !important;
}

/* Estilos específicos da checkbox */
.checkbox-group {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.custom-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    cursor: pointer;
    color: var(--text);
    font-weight: 500;
}

/* Cartão do Porto */
.port-detail-card {
    align-items: center;
}

.port-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.port-coords {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

.port-interval {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    background-color: var(--primary-light);
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-family: monospace;
}

/* ==========================================
   GPS SECUNDÁRIO & SECÇÃO DE CÁLCULO
   ========================================== */
.geo-secondary-box {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.15rem;
    background-color: var(--bg);
    border: 1px dashed var(--card-border);
    border-radius: var(--radius-sm);
    margin-bottom: 1.75rem;
}

@media (min-width: 640px) {
    .geo-secondary-box {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.geo-secondary-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.geo-secondary-text strong {
    font-size: 0.9rem;
    color: var(--text);
}

.geo-secondary-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 480px;
}

.page-calc-section {
    margin-top: 4.5rem;
    border-top: 1px solid var(--card-border);
    padding-top: 3rem;
}


/* ==========================================================================
   PÁGINA DO PORTO: HERO CARD, TABELA & GRÁFICO (location.html)
   ========================================================================== */
.page-location {
    padding-top: 2rem;
    padding-bottom: 5rem;
}

/* 1. HERO CARD DO INTERVALO LUNITIDAL */
.interval-hero-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card-hover);
    padding: 2.5rem 2.25rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@media (min-width: 768px) {
    .interval-hero-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.hero-val-col {
    flex: 1;
}

.hero-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.hero-num-wrap {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.hero-val {
    font-size: 4.25rem;
    font-weight: 900;
    line-height: 1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: var(--primary);
    letter-spacing: -0.04em;
}

.hero-unit {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-muted);
}

.hero-explainer {
    margin-top: 0.75rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 520px;
    line-height: 1.5;
}

.hero-info-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-top: 1px solid var(--card-border);
    padding-top: 1.5rem;
}

@media (min-width: 768px) {
    .hero-info-col {
        border-top: none;
        border-left: 1px solid var(--card-border);
        padding-top: 0;
        padding-left: 2.5rem;
        min-width: 280px;
    }
}

.hero-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.hero-info-title {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.meta-coords-box {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--text);
    background-color: var(--bg);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    border: 1px solid var(--card-border);
}

.meta-city-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.badge-confidence {
    font-size: 0.825rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    cursor: help;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

/* Garante que o span interno com o tooltip mantem o flexbox ativo */
.badge-confidence > span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem; /* Espaçamento limpo entre o ícone e o texto */
}

.badge-confidence svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Cores e bordos refinados com maior legibilidade */
.badge-official    { background-color: rgba(139, 92, 246, 0.12); color: #6d28d9; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge-verified    { background-color: var(--primary-light); color: var(--primary); border: 1px solid rgba(37, 99, 235, 0.3); }
.badge-high        { background-color: rgba(16, 185, 129, 0.12); color: #047857; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-calculated  { background-color: var(--accent-light); color: var(--accent-text); border: 1px solid rgba(217, 119, 6, 0.3); }
.badge-preliminary { background-color: rgba(239, 68, 68, 0.12); color: #b91c1c; border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-legacy      { background-color: rgba(100, 116, 139, 0.12); color: #334155; border: 1px solid rgba(100, 116, 139, 0.3); }


.share-bar-row {
    margin-top: 0.5rem;
}

.share-bar {
    display: flex;
    gap: 0.5rem;
}

.btn-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: var(--bg);
    color: var(--text-muted);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-share:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* Aviso de Desresponsabilização */
.notice-warning-accent {
    border-left-color: var(--accent);
}

/* 2. BLOCOS E TABELA DE PREVISÕES */
.section-card-block {
    margin-bottom: 3.5rem;
}

.section-block-head {
    margin-bottom: 1.25rem;
}

.section-block-head h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.section-block-head p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.card-table-wrap {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow-x: auto;
}

.tide-forecast-table {
    width: 100%;
    min-width: 580px;
    border-collapse: collapse;
    text-align: left;
}

.tide-forecast-table th {
    background-color: var(--bg);
    color: var(--text-muted);
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid var(--card-border);
}

.tide-forecast-table td {
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--card-border);
    font-size: 0.95rem;
    color: var(--text);
}

.tide-forecast-table tr:last-child td {
    border-bottom: none;
}

.th-align-right, .cell-tides-right {
    text-align: right;
}

.cell-activity {
    vertical-align: middle;
}

.activity-fish-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.fish-rating-item {
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.fish-rating-item svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* Peixes ativos: Sólido a laranja com o olho recortado */
.fish-rating-item.is-active {
    color: var(--accent);
    opacity: 1;
}

/* Peixes inativos: Sólido a cinzento com o olho recortado */
.fish-rating-item.is-inactive {
    color: var(--card-border);
    opacity: 0.7;
}

.tide-time-pill {
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--primary);
    background-color: var(--primary-light);
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    border: 1px solid var(--card-border);
}

.tide-time-sep {
    color: var(--text-muted);
    margin: 0 0.35rem;
}

/* 3. CARD DO GRÁFICO SOLUNAR E SVG */
.chart-canvas-card {
    position: relative; /* FUNDAMENTAL: Fixa o tooltip dentro do card sem empurrar a página */
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 1.5rem 1rem 0.75rem 1rem;
    overflow: hidden;
}

.chart-svg-container {
    width: 100%;
    overflow-x: auto;
}

.chart-svg-container svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Estilos de Traço e Preenchimento SVG */
.solunar-svg-area {
    fill: var(--primary-light);
}

.solunar-svg-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.solunar-grid-line {
    stroke: var(--card-border);
    stroke-dasharray: 4, 4;
    stroke-width: 1;
}

.solunar-axis-label {
    fill: var(--text-muted);
    font-size: 11px;
    font-family: var(--font);
}

.solunar-svg-cursor {
    stroke: var(--accent);
    stroke-width: 1.5;
    stroke-dasharray: 3, 3;
}

.solunar-tide-line {
    stroke: var(--primary);
    stroke-width: 1.5;
    stroke-dasharray: 4, 3;
    opacity: 0.85;
}

.solunar-tide-label {
    fill: var(--primary);
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font);
}

/* Tooltip Flutuante em Posicionamento Absoluto */
.chart-hover-tooltip {
    position: absolute;
    display: none;
    pointer-events: none;
    background-color: var(--header-bg);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
    font-weight: 600;
    box-shadow: var(--shadow-card-hover);
    transform: translate(-50%, -130%);
    white-space: nowrap;
    z-index: 20;
}

/* ==========================================================================
   MARKDOWN PAGE STYLES (.page-markdown / .md-content)
   ========================================================================== */

/* 1. Contentor Principal */
.page-markdown {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
    max-width: 850px; 
    margin: 0 auto;
}

/* 2. O invólucro do conteúdo (Usando as tuas variáveis do cartão) */
.content-wrapper.md-content {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 2.5rem 3rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    color: var(--text);
    line-height: 1.6;
    font-size: 1.05rem;
}

/* 3. Tipografia e Hierarquia */
.md-content h1, 
.md-content h2, 
.md-content h3, 
.md-content h4 {
    color: var(--text);
    font-weight: 800;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.md-content h1 {
    font-size: 2.25rem;
    margin-top: 0;
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.75rem;
}

.md-content h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.md-content h3 {
    font-size: 1.35rem;
}

/* 4. Parágrafos e Listas */
.md-content p {
    margin-bottom: 1.5rem;
}

.md-content ul, 
.md-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.md-content li {
    margin-bottom: 0.5rem;
}

.md-content li > ul,
.md-content li > ol {
    margin-top: 0.5rem;
    margin-bottom: 0;
}

/* 5. Links e Negritos */
.md-content a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.md-content a:hover {
    color: var(--primary-hover);
}

.md-content strong {
    color: var(--text);
    font-weight: 700;
}

/* 6. Linha Horizontal (---) */
.md-content hr {
    border: 0;
    height: 1px;
    background-color: var(--card-border);
    margin: 3rem 0;
}

/* 7. Blocos de Código e Inline Code */
.md-content pre {
    background-color: var(--header-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.md-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    color: var(--primary);
    background-color: var(--primary-light);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

/* Os blocos <pre> têm a sua própria cor, não o badge primary-light */
.md-content pre code {
    background-color: transparent;
    color: var(--text);
    padding: 0;
}

/* 8. Responsividade para Mobile */
@media (max-width: 768px) {
    .content-wrapper.md-content {
        padding: 1.5rem;
    }
    
    .md-content h1 {
        font-size: 1.75rem;
    }
    
    .md-content h2 {
        font-size: 1.4rem;
    }
}

/* ==========================================================================
   PÁGINAS DE ERRO & MANUTENÇÃO (error.html)
   ========================================================================== */

body.layout-error {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--bg);
    color: var(--text);
    padding: 2rem 1.25rem;
}

.error-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    margin: 2rem 0;
}

.error-content {
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 2.75rem 2rem;
    box-shadow: var(--shadow-card-hover);
    text-align: center;
}

.error-logo {
    margin-bottom: 1.5rem;
}

.error-logo img {
    height: 52px;
    width: auto;
    display: inline-block;
    border-radius: var(--radius-sm);
}

.error-code {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.maintenance-icon {
    font-size: 3.75rem;
    line-height: 1;
    margin-bottom: 1.25rem;
}

.maintenance-icon svg {
    width: 1em;
    height: 1em;
}

.error-message h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.error-message p {
    color: var(--text-muted);
    font-size: 0.975rem;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto 1.5rem auto;
}

.error-actions {
    margin-top: 2rem;
}


.error-debug-box {
    margin-top: 2.25rem;
    padding: 1.25rem;
    background-color: #090d16;
    color: #f8fafc;
    border-radius: var(--radius-sm);
    border: 1px solid #1e293b;
    text-align: left;
    font-size: 0.85rem;
}

.error-debug-box h3 {
    color: #38bdf8;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-debug-box p {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    word-break: break-all;
}

.error-trace {
    margin-top: 0.75rem;
    max-height: 320px;
    overflow-x: auto;
    overflow-y: auto;
    background-color: #030712;
    padding: 0.85rem;
    border-radius: 6px;
    border: 1px solid #111827;
}

.error-trace pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.775rem;
    color: #94a3b8;
    white-space: pre;
    line-height: 1.5;
}

.error-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 1rem 0 0 0;
}

.debug-bar {
    background-color: #0f172a;
    color: #38bdf8;
    border-top: 2px solid #0284c7;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    padding: 0.5rem 0;
    margin-top: auto;
    z-index: 9999;
}

.debug-bar-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

.debug-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.debug-item strong {
    color: #f1f5f9;
}

