/* ═══════════════════════════════════════════════════════════
   Early Trade Signals — Professional Dashboard CSS
   Bootstrap 5.3 augmentation
   ═══════════════════════════════════════════════════════════ */

/* ── Custom properties ──────────────────────────────────── */
:root {
    --sp-sidebar-w:     240px;
    --sp-sidebar-bg:    #0f1729;
    --sp-sidebar-text:  #8892b0;
    --sp-sidebar-hover: rgba(255,255,255,.06);
    --sp-sidebar-active:#1d3461;
    --sp-accent:        #3d8ef8;
    --sp-accent-glow:   rgba(61,142,248,.15);

    --sp-up:   #10b981;
    --sp-down: #ef4444;
    --sp-up-bg:   rgba(16,185,129,.08);
    --sp-down-bg: rgba(239,68,68,.08);

    --sp-card-border: rgba(0,0,0,.06);
    --sp-card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --sp-card-shadow-hover: 0 4px 12px rgba(0,0,0,.1);

    --sp-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Base ────────────────────────────────────────────────── */
body { font-family: var(--sp-font); background: #f4f6fb; color: #1a202c; }

/* ── Sidebar ─────────────────────────────────────────────── */
#sp-sidebar {
    width: var(--sp-sidebar-w);
    min-height: 100vh;
    background: var(--sp-sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
    transition: transform .25s ease;
    display: flex;
    flex-direction: column;
}

.sp-brand {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.sp-brand-icon {
    width: 34px; height: 34px;
    background: var(--sp-accent);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sp-brand-icon svg { width: 18px; height: 18px; }
.sp-brand-name { color: #fff; font-weight: 700; font-size: 15px; letter-spacing: -.3px; }
.sp-brand-tag  { color: var(--sp-sidebar-text); font-size: 10px; margin-top: 1px; }

.sp-nav { padding: .75rem 0; flex: 1; }
.sp-nav-section {
    padding: .5rem 1.5rem .25rem;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(136,146,176,.5);
    margin-top: .5rem;
}
.sp-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: .55rem 1.5rem;
    color: var(--sp-sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 450;
    border-radius: 0;
    transition: color .15s, background .15s;
    position: relative;
}
.sp-nav-link svg { width: 16px; height: 16px; opacity: .7; flex-shrink: 0; }
.sp-nav-link:hover { color: #fff; background: var(--sp-sidebar-hover); }
.sp-nav-link.active {
    color: #fff;
    background: var(--sp-sidebar-active);
    font-weight: 500;
}
.sp-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sp-accent);
    border-radius: 0 2px 2px 0;
}
.sp-nav-link .badge { font-size: 10px; margin-left: auto; }

.sp-sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,.06);
    font-size: 11px;
    color: rgba(136,146,176,.6);
}
.sp-live-dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: var(--sp-up);
    border-radius: 50%;
    animation: sp-pulse 2s ease-in-out infinite;
    margin-right: 5px;
}
@keyframes sp-pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Main content ────────────────────────────────────────── */
#sp-main {
    margin-left: var(--sp-sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Topbar ──────────────────────────────────────────────── */
#sp-topbar {
    background: #fff;
    border-bottom: 1px solid var(--sp-card-border);
    padding: 0 1.75rem;
    height: 58px;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}
.sp-page-title { font-size: 16px; font-weight: 600; color: #1a202c; }
.sp-page-sub   { font-size: 12px; color: #718096; margin-top: 1px; }
.sp-topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .5rem; }

/* ── Content area ────────────────────────────────────────── */
#sp-content { padding: 1.5rem 1.75rem; flex: 1; }

/* ── KPI Cards ───────────────────────────────────────────── */
.sp-kpi {
    background: #fff;
    border: 1px solid var(--sp-card-border);
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    box-shadow: var(--sp-card-shadow);
    transition: box-shadow .2s;
}
.sp-kpi:hover { box-shadow: var(--sp-card-shadow-hover); }
.sp-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #718096;
    margin-bottom: .4rem;
}
.sp-kpi-val {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.5px;
    line-height: 1.1;
    color: #1a202c;
}
.sp-kpi-sub { font-size: 12px; margin-top: .35rem; color: #718096; }
.sp-kpi-icon {
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    float: right;
    margin-top: -4px;
}
.sp-kpi-icon svg { width: 20px; height: 20px; }

/* ── Chart cards ─────────────────────────────────────────── */
.sp-card {
    background: #fff;
    border: 1px solid var(--sp-card-border);
    border-radius: 14px;
    box-shadow: var(--sp-card-shadow);
    overflow: hidden;
}
.sp-card-head {
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--sp-card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.sp-card-title { font-size: 14px; font-weight: 600; color: #2d3748; margin: 0; }
.sp-card-sub   { font-size: 12px; color: #718096; }
.sp-card-body  { padding: 1.25rem; }

/* ── Table ───────────────────────────────────────────────── */
.sp-table { font-size: 13px; }
.sp-table th {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #718096;
    padding: .7rem 1rem;
    border-bottom: 1px solid #eef0f5;
    white-space: nowrap;
    background: #fafbfd;
}
.sp-table td {
    padding: .85rem 1rem;
    border-bottom: 1px solid #f0f2f7;
    vertical-align: middle;
    color: #2d3748;
}
.sp-table tbody tr:last-child td { border-bottom: none; }
.sp-table tbody tr:hover td { background: #fafbfd; }
.sp-table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: 'SF Mono', 'Fira Mono', monospace; }

/* ── Symbol badge ────────────────────────────────────────── */
.sp-symbol {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.sp-symbol-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sp-symbol-name { font-weight: 600; font-size: 13px; }
.sp-symbol-sub  { font-size: 11px; color: #718096; }

/* ── Driver badges ───────────────────────────────────────── */
.sp-drv { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
.sp-drv-fh { background: #eff6ff; color: #1d4ed8; }
.sp-drv-av { background: #fffbeb; color: #92400e; }
.sp-drv-bse { background: #f0fdf4; color: #166534; }
.sp-drv-yahoo { background: #fdf4ff; color: #7e22ce; }

/* ── P&L pills ───────────────────────────────────────────── */
.sp-pnl-up   { color: var(--sp-up);   background: var(--sp-up-bg);   padding: 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sp-pnl-down { color: var(--sp-down); background: var(--sp-down-bg); padding: 3px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sp-pnl-zero { color: #718096; font-size: 12px; }

/* ── Buttons ─────────────────────────────────────────────── */
.sp-btn { border-radius: 8px; font-size: 13px; font-weight: 500; border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .15s; }
.sp-btn svg { width: 14px; height: 14px; }
.sp-btn-primary { background: var(--sp-accent); color: #fff; padding: 8px 16px; }
.sp-btn-primary:hover { background: #2d7ef0; }
.sp-btn-ghost   { background: #f4f6fb; color: #4a5568; padding: 7px 14px; border: 1px solid #e2e8f0; }
.sp-btn-ghost:hover { background: #e9ecf5; }
.sp-btn-success { background: var(--sp-up); color: #fff; padding: 6px 12px; }
.sp-btn-success:hover { background: #0ea572; }
.sp-btn-danger  { background: transparent; color: var(--sp-down); padding: 6px 12px; border: 1px solid rgba(239,68,68,.3); }
.sp-btn-danger:hover  { background: var(--sp-down-bg); }
.sp-btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.sp-btn-icon { padding: 7px; border-radius: 8px; }

/* ── Allocation bars ─────────────────────────────────────── */
.sp-alloc-bar-wrap { height: 6px; background: #eef0f5; border-radius: 3px; overflow: hidden; }
.sp-alloc-bar      { height: 100%; border-radius: 3px; transition: width .5s ease; }

/* ── Chart loading ───────────────────────────────────────── */
.sp-chart-loading {
    height: 220px;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 10px;
    color: #718096; font-size: 13px;
}
.sp-spinner {
    width: 28px; height: 28px;
    border: 2px solid #e2e8f0;
    border-top-color: var(--sp-accent);
    border-radius: 50%;
    animation: sp-spin .7s linear infinite;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ── Modals (Bootstrap override) ────────────────────────── */
.sp-modal .modal-content { border: none; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.15); }
.sp-modal .modal-header { border-bottom: 1px solid #f0f2f7; padding: 1.1rem 1.5rem; }
.sp-modal .modal-title  { font-size: 15px; font-weight: 600; }
.sp-modal .modal-body   { padding: 1.25rem 1.5rem; }
.sp-modal .modal-footer { border-top: 1px solid #f0f2f7; padding: .85rem 1.5rem; }
.sp-modal .form-label   { font-size: 12px; font-weight: 600; color: #4a5568; }
.sp-modal .form-control, .sp-modal .form-select {
    border-radius: 8px;
    border-color: #e2e8f0;
    font-size: 13px;
}
.sp-modal .form-control:focus, .sp-modal .form-select:focus {
    border-color: var(--sp-accent);
    box-shadow: 0 0 0 3px var(--sp-accent-glow);
}

/* ── Price preview box ───────────────────────────────────── */
.sp-price-preview {
    background: #f8faff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: .85rem 1rem;
    font-size: 13px;
}

/* ── Toast notifications ─────────────────────────────────── */
.sp-toast-wrap {
    position: fixed;
    top: 1.25rem; right: 1.25rem;
    z-index: 9999;
    display: flex; flex-direction: column; gap: .5rem;
    pointer-events: none;
}
.sp-toast {
    background: #fff;
    border-radius: 10px;
    padding: .85rem 1.1rem;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    font-size: 13px;
    display: flex; align-items: center; gap: 10px;
    min-width: 280px;
    pointer-events: auto;
    animation: sp-slidein .25s ease;
    border-left: 3px solid var(--sp-accent);
}
.sp-toast.success { border-left-color: var(--sp-up); }
.sp-toast.error   { border-left-color: var(--sp-down); }
@keyframes sp-slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Livewire loading state ──────────────────────────────── */
[wire\:loading] { opacity: .5; pointer-events: none; }
.sp-refresh-spin { animation: sp-spin .7s linear infinite; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991px) {
    #sp-sidebar  { transform: translateX(-100%); }
    #sp-sidebar.open { transform: none; }
    #sp-main    { margin-left: 0; }
    #sp-content { padding: 1rem; }
    #sp-topbar  { padding: 0 1rem; }
}

/* ── Scrollbar ───────────────────────────────────────────── */
#sp-sidebar::-webkit-scrollbar { width: 4px; }
#sp-sidebar::-webkit-scrollbar-track { background: transparent; }
#sp-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* ── Utility ─────────────────────────────────────────────── */
.sp-up   { color: var(--sp-up)   !important; }
.sp-down { color: var(--sp-down) !important; }
.sp-mono { font-family: 'SF Mono', 'Fira Mono', monospace; }
.text-muted-sm { font-size: 12px; color: #718096; }
