/* ── Navigation ───────────────────────────────────────────────────────── */

/* Group separator in nav */
.nav-separator {
    border-left: 1px solid var(--pico-muted-border-color, #374151);
    margin: 0 0.15rem;
    padding: 0;
}
.nav-separator a {
    display: none;
}

/* Logout button styling */
.nav-logout a {
    color: var(--pico-muted-color, #6b7280);
    font-size: 0.85rem;
}
.nav-logout a:hover {
    color: var(--pico-del-color, #ef4444);
}

/* Dropdown navigation (Pico .dropdown handles positioning, bg, border, shadow) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown details ul li a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown details ul li a[aria-current="page"] {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

/* ── Flash Messages ──────────────────────────────────────────────────── */

.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    animation: flash-fade-in 0.25s ease-out;
}

@keyframes flash-fade-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash-success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #4ade80;
}

.flash-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.flash-info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #60a5fa;
}

/* ── Layout Utilities ────────────────────────────────────────────────── */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.section-header h2,
.section-header h3,
.section-header h4 {
    margin: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.page-header h2 {
    margin: 0;
}

.inline-form {
    margin: 0;
}

.flex-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Back link */
.back-link {
    display: inline-block;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    opacity: 0.7;
}
.back-link:hover {
    opacity: 1;
}

/* ── HTMX Loading Indicators ────────────────────────────────────────── */

.htmx-indicator {
    display: none;
    opacity: 0.6;
    font-size: 0.85rem;
}

.htmx-request .htmx-indicator {
    display: inline-block;
}

.htmx-request button[type="submit"] {
    opacity: 0.5;
    pointer-events: none;
}

/* Subtle loading bar at top of cockpit during auto-refresh */
.htmx-request #cockpit-content {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

/* ── State badges ────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.state-watch { background: #6b7280; color: #fff; }
.state-on-deck { background: #8b5cf6; color: #fff; }
.state-in-zone { background: #3b82f6; color: #fff; }
.state-h4-break-confirmed { background: #eab308; color: #000; }
.state-h4-reclaim-confirmed { background: #f97316; color: #fff; }
.state-m15-trigger-confirmed { background: #a855f7; color: #fff; }
.state-entry-permitted { background: #22c55e; color: #fff; }
.state-window-expired { background: #ef4444; color: #fff; }
.state-in-trade { background: #14b8a6; color: #fff; }
.state-partial-taken { background: #06b6d4; color: #fff; }
.state-runner-managed { background: #6366f1; color: #fff; }
.state-closed { background: #374151; color: #9ca3af; }
.state-invalidated { background: #dc2626; color: #fff; }

/* ── Override / violation styling ────────────────────────────────────── */

.violation-banner {
    background: #dc2626;
    color: #fff;
    padding: 1rem;
    border-radius: 4px;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* ── Table helpers ───────────────────────────────────────────────────── */

.overflow-auto {
    overflow-x: auto;
}

/* Table hover states for better readability */
table:not(.no-hover) tbody tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* ── Small button variant ────────────────────────────────────────────── */

.small {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
}

/* ── Muted text ──────────────────────────────────────────────────────── */

.muted {
    opacity: 0.6;
}

/* ── Event tags ──────────────────────────────────────────────────────── */

.event-tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.event-tag.pre_alert, .event-tag.pre-alert {
    background: #8b5cf6;
    color: #fff;
}

.event-tag.trigger {
    background: #f97316;
    color: #fff;
}

.event-tag.management {
    background: #06b6d4;
    color: #fff;
}

/* ── Timeline ────────────────────────────────────────────────────────── */

.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--pico-muted-border-color, #374151);
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1rem;
}

.timeline-marker {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--pico-muted-border-color, #6b7280);
}

.timeline-item.pre_alert .timeline-marker { background: #8b5cf6; }
.timeline-item.trigger .timeline-marker { background: #f97316; }
.timeline-item.management .timeline-marker { background: #06b6d4; }

.timeline-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* ── On Deck cards ───────────────────────────────────────────────────── */

.on-deck-card {
    padding: 0;
}

.on-deck-card header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pre-alert-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

/* ── Checklist ───────────────────────────────────────────────────────── */

.check-pass {
    color: #22c55e;
    font-weight: 600;
    font-size: 0.8rem;
}

.check-fail {
    color: #ef4444;
    font-weight: 600;
    font-size: 0.8rem;
}

/* ── Grade badges ────────────────────────────────────────────────────── */

.grade-a { background: #22c55e; color: #fff; }
.grade-b { background: #eab308; color: #000; }
.grade-c { background: #ef4444; color: #fff; }

/* ── Entry window banner ─────────────────────────────────────────────── */

.entry-window-banner {
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    margin-bottom: 1rem;
}

.window-countdown {
    font-weight: 700;
    color: #22c55e;
    font-size: 1.1rem;
}

/* ── Action buttons ──────────────────────────────────────────────────── */

.action-buttons form {
    margin-bottom: 0.5rem;
}

/* ── Danger / destructive button ─────────────────────────────────────── */

.btn-danger {
    --pico-background-color: transparent;
    --pico-border-color: #dc2626;
    --pico-color: #ef4444;
    border: 1px solid #dc2626;
    color: #ef4444;
}
.btn-danger:hover {
    --pico-background-color: rgba(220, 38, 38, 0.15);
    --pico-border-color: #ef4444;
    --pico-color: #f87171;
}

/* ── Trade state badges ──────────────────────────────────────────────── */

.trade-open { background: #14b8a6; color: #fff; }
.trade-partial { background: #06b6d4; color: #fff; }
.trade-runner { background: #6366f1; color: #fff; }
.trade-closed { background: #374151; color: #9ca3af; }

/* ── Addon state badges ──────────────────────────────────────────────── */

.addon-candidate { background: #6b7280; color: #fff; }
.addon-ready { background: #22c55e; color: #fff; }
.addon-entered { background: #14b8a6; color: #fff; }
.addon-expired { background: #ef4444; color: #fff; }
.addon-rejected { background: #374151; color: #9ca3af; }

/* ── AI suggestions ──────────────────────────────────────────────────── */

.ai-suggestion {
    padding: 0.5rem;
    border-left: 3px solid #8b5cf6;
    margin-bottom: 0.5rem;
    background: rgba(139, 92, 246, 0.05);
}

.htf-map {
    font-size: 0.9rem;
}

/* ── News filter bar ─────────────────────────────────────────────────── */

.news-filters {
    margin-bottom: 1.5rem;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
}

.filter-bar > * {
    flex-shrink: 0;
}

.filter-bar select {
    margin: 0 !important;
    width: auto !important;
    min-width: 7rem;
    padding: 0.35rem 1.75rem 0.35rem 0.6rem;
    font-size: 0.8rem;
    height: auto;
    flex-grow: 0;
    background-size: 0.8rem;
}

.impact-chips {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

.impact-chip {
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    padding: 0;
    cursor: pointer;
    user-select: none;
    width: auto !important;
}

.impact-chip input[type="checkbox"] {
    display: none;
}

.impact-chip span {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1.5px solid transparent;
    transition: all 0.15s ease;
    opacity: 0.4;
    line-height: 1;
}

.impact-chip input:checked + span {
    opacity: 1;
}

.impact-chip-high span {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}
.impact-chip-high input:checked + span {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
}

.impact-chip-medium span {
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.3);
}
.impact-chip-medium input:checked + span {
    background: rgba(249, 115, 22, 0.15);
    border-color: #f97316;
    color: #fb923c;
}

.impact-chip-low span {
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.3);
}
.impact-chip-low input:checked + span {
    background: rgba(107, 114, 128, 0.15);
    border-color: #6b7280;
    color: #9ca3af;
}

.impact-chip-holiday span {
    color: #8b5cf6;
    border-color: rgba(139, 92, 246, 0.3);
}
.impact-chip-holiday input:checked + span {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    color: #a78bfa;
}

.filter-clear {
    margin: 0 !important;
    margin-left: auto !important;
    white-space: nowrap;
}

/* ── Watchlist filter bar ────────────────────────────────────────────── */

.watchlist-filters {
    margin-bottom: 1.5rem;
}

.wl-chips {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-shrink: 0;
}

.wl-chip {
    display: inline-flex;
    align-items: center;
    margin: 0 !important;
    padding: 0;
    cursor: pointer;
    user-select: none;
    width: auto !important;
}

.wl-chip input[type="checkbox"],
.wl-chip input[type="radio"] {
    display: none;
}

.wl-chip span {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border: 1.5px solid transparent;
    transition: all 0.15s ease;
    opacity: 0.4;
    line-height: 1;
}

.wl-chip input:checked + span {
    opacity: 1;
}

.wl-chip-enabled span {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}
.wl-chip-enabled input:checked + span {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
}

.wl-chip-disabled span {
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.3);
}
.wl-chip-disabled input:checked + span {
    background: rgba(107, 114, 128, 0.15);
    border-color: #6b7280;
    color: #9ca3af;
}

.wl-chip-all span {
    color: #6b7280;
    border-color: rgba(107, 114, 128, 0.3);
}
.wl-chip-all input:checked + span {
    background: rgba(107, 114, 128, 0.15);
    border-color: #6b7280;
    color: #9ca3af;
}

.wl-chip-bull span {
    color: #22c55e;
    border-color: rgba(34, 197, 94, 0.3);
}
.wl-chip-bull input:checked + span {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #4ade80;
}

.wl-chip-bear span {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}
.wl-chip-bear input:checked + span {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #f87171;
}

.wl-chip-neutral span {
    color: #f97316;
    border-color: rgba(249, 115, 22, 0.3);
}
.wl-chip-neutral input:checked + span {
    background: rgba(249, 115, 22, 0.15);
    border-color: #f97316;
    color: #fb923c;
}

.wl-chip-unscreened span {
    color: #8b5cf6;
    border-color: rgba(139, 92, 246, 0.3);
}
.wl-chip-unscreened input:checked + span {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    color: #a78bfa;
}

/* ── Watchlist settings popover ──────────────────────────────────────── */

.inline-details {
    display: inline;
    margin-right: 0.5rem;
}

.inline-details > summary {
    display: inline;
    cursor: pointer;
    font-size: 0.75rem;
    list-style: none;
}

.inline-details > summary::-webkit-details-marker {
    display: none;
}

.settings-popover {
    position: absolute;
    z-index: 10;
    right: 0;
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 8px;
    padding: 0.75rem;
    min-width: 10rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ── News impact badges ──────────────────────────────────────────────── */

.impact-high { background: #ef4444; color: #fff; }
.impact-medium { background: #f97316; color: #fff; }
.impact-low { background: #6b7280; color: #fff; }
.impact-holiday { background: #8b5cf6; color: #fff; }

/* ── News block banner ───────────────────────────────────────────────── */

.news-block-banner {
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.news-block-banner strong {
    color: #ef4444;
}

/* ── Section count badge ─────────────────────────────────────────────── */

.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--pico-muted-border-color, #374151);
    color: var(--pico-color, #e5e7eb);
    margin-left: 0.35rem;
    vertical-align: middle;
}

/* ── Journal ─────────────────────────────────────────────────────────── */

.journal-draft { background: #eab308; color: #000; }
.journal-completed { background: #22c55e; color: #fff; }

.journal-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    text-decoration: none;
    margin-right: 0.2rem;
    margin-bottom: 0.2rem;
}
a.journal-tag:hover {
    background: rgba(139, 92, 246, 0.35);
    color: #e0d4fc;
}

.journal-rating .star {
    color: #374151;
    font-size: 0.85rem;
}
.journal-rating .star-filled {
    color: #eab308;
}

.r-positive { color: #22c55e; }
.r-negative { color: #ef4444; }

/* ── Brief filter tabs ───────────────────────────────────────────────── */

.filter-tab {
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    border: 2px solid transparent;
    user-select: none;
}

.filter-tab:hover {
    border-color: rgba(139, 92, 246, 0.4);
}

.filter-tab.active {
    border-color: #8b5cf6;
}

.filter-tab.active header {
    color: #c4b5fd;
}

/* ── Footer ──────────────────────────────────────────────────────────── */

footer.container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    opacity: 0.5;
}
