/* ============================================
   CaeTrader — Shared Navigation CSS
   Single source of truth for all pages.
   Loaded via: <link rel="stylesheet" href="/static/nav.css?v=1">
   ============================================ */

:root {
    --layout-gutter: 10px;
    --card-gap: 10px;
    --header-gap: var(--card-gap);
}

@media (max-width: 900px) {
    :root {
        --layout-gutter: 10px;
        --card-gap: 8px;
        --header-gap: var(--card-gap);
    }
}

/* === Desktop: Full-width glass header bar === */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    width: calc(100% - 2 * var(--layout-gutter));
    margin: 10px auto var(--header-gap);
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(245, 158, 11, 0.15);
    border-radius: 16px;
    flex-shrink: 0;
    animation: fadeSlideUp 0.5s ease-out;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Brand / Logo Area */
.header .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    min-width: 130px;
}

/* Sign Out / Right Area */
.header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 130px;
    justify-content: flex-end;
}

.header h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.25));
    object-fit: contain;
    border-radius: 50%;
}

.brand-title {
    background: linear-gradient(135deg, #e8873a, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Legacy: hide stats-area if still present in HTML */
.header .stats-area {
    display: none;
}

/* === Navigation Pill Container === */
.nav-tabs {
    display: flex;
    gap: 6px;
    background: transparent;
    padding: 5px;
    border-radius: 0;
    border: none;
    width: fit-content;
    justify-content: center;
}

/* === Individual Tab === */
.nav-tab {
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
    color: #000;
    background: linear-gradient(135deg, var(--accent-amber), #D97706);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
    border: none;
}

/* === Sign Out Tab === */
.nav-tab.sign-out {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s ease;
}

.nav-tab.sign-out:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.15);
}

/* === Mobile Bottom Navigation (Floating Dock) === */
.mobile-nav {
    display: none; /* hidden on desktop */
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateZ(0);
    background: rgba(10, 10, 14, 0.75);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    backdrop-filter: blur(24px) saturate(200%);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 0, 0, 0.2);
    will-change: transform;
}

.mobile-nav-inner {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    padding: 6px;
}

.mobile-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: rgba(90, 98, 117, 0.8);
    font-size: 11px;
    font-weight: 700;
    font-family: 'Inter', -apple-system, sans-serif;
    border-radius: 22px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    position: relative;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav a:active {
    transform: scale(0.92);
}

.mobile-nav a svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
    flex-shrink: 0;
    transition: stroke-width 0.3s ease;
}

/* Hide text on inactive tabs */
.mobile-nav a span {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active state — expanded pill with label */
.mobile-nav a.active {
    color: var(--accent-amber, #F59E0B);
    background: rgba(245, 158, 11, 0.12);
    padding: 0 16px 0 12px;
}

.mobile-nav a.active svg {
    stroke-width: 2.2;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.4));
}

.mobile-nav a.active span {
    max-width: 80px; /* Enough space for text label */
    opacity: 1;
}

/* Hover state for non-active */
.mobile-nav a:not(.active):hover {
    color: var(--text-secondary, #CBD5E1);
    background: rgba(255, 255, 255, 0.05);
}

/* Mobile logout button — hidden until JS shows it */
.mobile-nav .mobile-logout {
    color: rgba(239, 68, 68, 0.7);
}

.mobile-nav .mobile-logout:active {
    color: #ef4444;
}

.mobile-nav .mobile-logout svg {
    stroke: currentColor;
}

/* === Unified Toggle Switch === */
.status-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Standard toggle: 38×20 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
    flex-shrink: 0;
}

/* Large toggle: 44×24 — for primary engine/bot toggles */
.toggle-switch.lg {
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Large thumb: 18×18 */
.toggle-switch.lg .toggle-slider::before {
    height: 18px;
    width: 18px;
}

/* Hover */
.toggle-switch:hover .toggle-slider {
    border-color: rgba(255, 255, 255, 0.18);
}

/* Checked state */
input:checked + .toggle-slider {
    background: var(--accent-green);
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

input:checked + .toggle-slider::before {
    transform: translateX(18px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25), 0 0 6px rgba(34, 197, 94, 0.3);
}

/* Large checked thumb travel: 20px */
.toggle-switch.lg input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Disabled */
.toggle-switch.disabled,
.toggle-switch:has(input:disabled) {
    opacity: 0.45;
    pointer-events: none;
}

/* ============================================
   Mobile: ≤900px
   - Hide desktop nav-tabs
   - Show mobile bottom nav
   - Header becomes invisible (no content)
   ============================================ */
@media (max-width: 900px) {

    /* Hide entire desktop header on mobile */
    .header {
        display: none !important;
    }

    /* Show mobile bottom bar */
    .mobile-nav {
        display: block;
    }

    /* Standardized bottom padding for fixed mobile nav (~56px nav + safe area) */
    body {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* Small mobile (≤480px): tighter spacing */
@media (max-width: 480px) {
    :root {
        --layout-gutter: 6px;
        --card-gap: 6px;
    }
/* Remove conflicting mobile-nav overrides */
}

/* Tablets (901–1024px): compact header */
@media (min-width: 901px) and (max-width: 1024px) {
    .header {
        padding: 8px 16px;
    }

    .header .header-left {
        min-width: auto;
    }

    .header .header-right {
        min-width: auto;
    }

    .header .nav-tabs {
        gap: 4px;
    }

    .nav-tab {
        padding: 8px 14px;
        font-size: 12px;
    }

    .nav-tab.sign-out {
        padding: 6px 12px;
        font-size: 11px;
    }
}

/* ============================================
   Loading Skeletons — Shimmer Animation
   ============================================ */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 25%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
    pointer-events: none;
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 65%;
}

.skeleton-text.long {
    width: 90%;
}

.skeleton-card {
    min-height: 120px;
    border-radius: 16px;
}

.skeleton-chart {
    min-height: 200px;
    border-radius: 16px;
}

.skeleton-stat {
    height: 48px;
    border-radius: 12px;
}

/* ============================================
   Toast Notification System
   ============================================ */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(15, 15, 25, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    transform: translateZ(0); /* Hardware acceleration */
    will-change: transform;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    animation: toast-slide-in 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    transition: all 0.3s ease;
}

.toast.toast-exit {
    animation: toast-slide-out 0.3s ease forwards;
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.toast.toast-buy .toast-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.toast.toast-sell .toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.toast.toast-info .toast-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #f5a623;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.toast-detail {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.toast-close:hover {
    color: #fff;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* ============================================
   Signal Timeline
   ============================================ */
.signal-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 20px;
}

.signal-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.signal-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    position: relative;
}

.signal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    position: absolute;
    left: -17px;
    top: 10px;
    flex-shrink: 0;
}

.signal-dot.accepted {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.signal-dot.held {
    background: #f5a623;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.4);
}

.signal-dot.rejected {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

.signal-dot.filtered {
    background: rgba(255, 255, 255, 0.2);
}

.signal-info {
    flex: 1;
    min-width: 0;
}

.signal-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.signal-header .signal-action {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.signal-action.buy {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.signal-action.sell {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.signal-reason {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1px;
}

.signal-time {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
    animation: empty-pulse 3s ease-in-out infinite;
}

@keyframes empty-pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.empty-state-desc {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    max-width: 360px;
    line-height: 1.6;
}

.empty-checklist {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.empty-checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.empty-checklist-item .check {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    flex-shrink: 0;
}

.empty-checklist-item .check.done {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.empty-checklist-item .check.pending {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

@media (max-width: 480px) {
    .toast-container {
        max-width: 100%;
        right: 8px;
        left: 8px;
        width: auto;
    }

    .toast {
        padding: 10px 12px;
    }

    .toast-title {
        font-size: 12px;
    }

    .empty-state {
        padding: 32px 16px;
    }

    .empty-state-icon {
        font-size: 36px;
    }

    .empty-state-title {
        font-size: 16px;
    }
}