/* components.css — Editorial Trading Terminal components
 * Buttons, cards, empty states, dashboard widgets, animations, global polish. */

/* ===== Animations ===== */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.animate-fade-up { animation: fade-up 0.7s var(--ease-out) both; }

@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

@keyframes pulse { 50% { opacity: 0.5; } }
.animate-pulse { animation: pulse 2.4s var(--ease-in-out) infinite; }

@keyframes count-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-ring {
    0%   { transform: scale(0.92); opacity: 0.55; }
    100% { transform: scale(1.45); opacity: 0; }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ===== Global interaction polish ===== */
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: 6px;
}
button:active { transform: scale(0.98); }
button, a {
    transition:
        color 0.2s var(--ease-out),
        background-color 0.2s var(--ease-out),
        border-color 0.2s var(--ease-out),
        box-shadow 0.2s var(--ease-out),
        transform 0.2s var(--ease-out);
}

input[type="date"], input[type="time"] { color-scheme: dark; }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6); cursor: pointer; opacity: 0.7; transition: opacity 0.15s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

input, textarea, select {
    background-color: rgba(255, 255, 255, 0.015);
    transition:
        border-color 0.2s var(--ease-out),
        box-shadow 0.2s var(--ease-out),
        background-color 0.2s var(--ease-out);
}
input:focus, textarea:focus, select:focus { background-color: rgba(255, 255, 255, 0.03); }

select option { background: #0c0c10; color: #ededf0; }

::-webkit-scrollbar        { width: 8px; height: 8px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: rgba(255, 255, 255, 0.08); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

main { animation: fade-up 0.5s var(--ease-out) both; }

/* ===== Primary CTA — gradient + shine sweep + lift ===== */
.bg-primary {
    background-image: linear-gradient(135deg, #14b8a6 0%, #0f8f82 55%, #14b8a6 100%);
    background-size: 200% 200%;
    background-position: 0% 50%;
    border: 0.5px solid rgba(94, 234, 212, 0.28);
    color: #ffffff !important;
    transition:
        background-position 0.6s var(--ease-out),
        box-shadow 0.3s var(--ease-out),
        transform 0.2s var(--ease-out);
}
.bg-primary:hover {
    background-position: 100% 50%;
    box-shadow:
        0 16px 40px -8px rgba(20, 184, 166, 0.5),
        0 0 0 0.5px rgba(94, 234, 212, 0.4) inset;
    transform: translateY(-1px);
}
.bg-primary:active { transform: translateY(0); }

/* ===== Button loading state ===== */
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-loading { pointer-events: none; opacity: 0.75; }
.btn-loading .btn-spinner {
    display: inline-block; width: 12px; height: 12px;
    border: 1.5px solid currentColor; border-top-color: transparent;
    border-radius: 50%; animation: btn-spin 0.6s linear infinite;
    vertical-align: middle; margin-left: 6px;
}

/* ===== Generic card hover ===== */
.card-hover {
    transition:
        border-color 0.3s var(--ease-out),
        background 0.3s var(--ease-out),
        box-shadow 0.3s var(--ease-out),
        transform 0.3s var(--ease-out);
}
.card-hover:hover {
    border-color: rgba(20, 184, 166, 0.28);
    box-shadow:
        0 0 0 0.5px rgba(20, 184, 166, 0.2),
        0 20px 40px -12px rgba(0, 0, 0, 0.6);
    transform: translateY(-1px);
}

/* ===== Live indicator dot
   Static glow on the dot, plus a ::before ring that expands + fades out
   then rests until the next beat. One-way motion only (no shrink-back),
   with ~45% of the cycle as silence so the rhythm reads as a heartbeat
   instead of a continuous twitch. */
.indicator-dot {
    position: relative;
    box-shadow: 0 0 10px rgba(94, 234, 212, 0.45);
}
.indicator-dot::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--color-primary-light);
    pointer-events: none;
    transform-origin: center;
    animation: indicator-ring 3.4s cubic-bezier(0.16, 0.84, 0.44, 1) infinite;
}

@keyframes indicator-ring {
    0%   { opacity: 0;    transform: scale(1); }
    8%   { opacity: 0.55; transform: scale(1); }
    55%  { opacity: 0;    transform: scale(3.6); }
    100% { opacity: 0;    transform: scale(3.6); }
}

@media (prefers-reduced-motion: reduce) {
    .indicator-dot::before { animation: none; opacity: 0; }
}

/* ===== Backtest KPI Hero — dominant total-return display ===== */
.kpi-hero {
    position: relative;
}
.kpi-hero-number {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: clamp(2.75rem, 6vw, 4rem);
    line-height: 1;
    letter-spacing: -0.035em;
    font-variant-numeric: tabular-nums slashed-zero;
}
.kpi-hero-unit {
    font-size: 0.55em;
    font-weight: 500;
    margin-left: 0.06em;
    letter-spacing: 0;
    opacity: 0.7;
    vertical-align: baseline;
}
.kpi-cell {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.kpi-cell:nth-child(odd) {
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.kpi-cell:nth-last-child(-n+2) {
    border-bottom: none;
}

/* ===== Shape/layout utilities used across templates ===== */
.rounded-md   { border-radius: 6px; }
.rounded-lg   { border-radius: 10px; }
.rounded-xl   { border-radius: 14px; }
.rounded-2xl  { border-radius: 20px; }
.rounded-full { border-radius: 9999px; }
.rounded-l-md { border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.rounded-r-md { border-top-right-radius: 6px; border-bottom-right-radius: 6px; }

.border    { border-width: 1px; border-style: solid; }
.border-t  { border-top-width: 1px; border-top-style: solid; }
.border-b  { border-bottom-width: 1px; border-bottom-style: solid; }

.backdrop-blur-sm { backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.backdrop-blur-md { backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.backdrop-blur-xl { backdrop-filter: blur(22px) saturate(140%); -webkit-backdrop-filter: blur(22px) saturate(140%); }

.blur-\[100px\] { filter: blur(100px); }

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

.transition           { transition: all 0.2s var(--ease-out); }
.transition-all       { transition: all 0.3s var(--ease-out); }
.transition-transform { transition: transform 0.25s var(--ease-out); }

.-translate-x-1\/2 { transform: translateX(-50%); }

/* Confirm-dialog styles moved to overlays.css (uses qb-* design tokens). */
