/* ── Easy Stock Tickers v1.5.0 ───────────────────────────────────────────── */

/* ── CSS Custom Properties ─────────────────────────────────────────────── */
.asw-light {
    --asw-bg:           #ffffff;
    --asw-bg-2:         #f8f9fa;
    --asw-border:       #e2e8f0;
    --asw-text:         #1a202c;
    --asw-text-muted:   #718096;
    --asw-ticker-bg:    #f1f5f9;
    --asw-ticker-text:  #1a202c;
    --asw-label-bg:     #e53e3e;
    --asw-label-text:   #ffffff;
    --asw-sep:          #cbd5e0;
    --asw-dot:          #cbd5e0;
    --asw-dot-active:   #3182ce;
    --asw-progress-bg:  #e2e8f0;
    --asw-progress-bar: #3182ce;
}

.asw-dark {
    --asw-bg:           #1a202c;
    --asw-bg-2:         #2d3748;
    --asw-border:       #4a5568;
    --asw-text:         #f7fafc;
    --asw-text-muted:   #a0aec0;
    --asw-ticker-bg:    #0d1117;
    --asw-ticker-text:  #e2e8f0;
    --asw-label-bg:     #e53e3e;
    --asw-label-text:   #ffffff;
    --asw-sep:          #4a5568;
    --asw-dot:          #4a5568;
    --asw-dot-active:   #63b3ed;
    --asw-progress-bg:  #2d3748;
    --asw-progress-bar: #63b3ed;
}

.asw-up   { color: #38a169; }
.asw-down { color: #e53e3e; }

/* ── Error state ───────────────────────────────────────────────────────── */
.asw-error {
    padding: 12px 16px;
    background: #fff5f5;
    border-left: 4px solid #e53e3e;
    border-radius: 4px;
    color: #c53030;
    font-size: 14px;
}

/* ══════════════════════════════════════════════════════════════════════════
   STOCK CARD  (shared by card grid and carousel)
══════════════════════════════════════════════════════════════════════════ */

.asw-cards-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.asw-card {
    background: var(--asw-bg);
    border: 1px solid var(--asw-border);
    border-radius: 10px;
    padding: 20px;
    min-width: 220px;
    flex: 1 1 220px;
    max-width: 320px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08);
    position: relative;
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}

.asw-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.asw-card--up   { border-left: 4px solid #38a169; }
.asw-card--down { border-left: 4px solid #e53e3e; }

.asw-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.asw-card__symbol {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--asw-text);
}

.asw-card__day {
    font-size: 11px;
    color: var(--asw-text-muted);
    background: var(--asw-bg-2);
    padding: 3px 7px;
    border-radius: 12px;
}

.asw-card__price {
    margin-bottom: 16px;
}

.asw-card__current {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--asw-text);
    line-height: 1.1;
}

.asw-card__current::before {
    content: '$';
    font-size: 16px;
    font-weight: 400;
    vertical-align: super;
    margin-right: 2px;
    color: var(--asw-text-muted);
}

.asw-card__change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 500;
    margin-top: 4px;
}

.asw-arrow { font-size: 10px; }

.asw-card__stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    border-top: 1px solid var(--asw-border);
    padding-top: 12px;
}

.asw-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.asw-stat__label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--asw-text-muted);
}

.asw-stat__value {
    font-size: 13px;
    font-weight: 600;
    color: var(--asw-text);
}

/* ══════════════════════════════════════════════════════════════════════════
   CAROUSEL
══════════════════════════════════════════════════════════════════════════ */

.asw-carousel-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Width: constrained to a single card */
    max-width: 360px;
}

/* Viewport stacks all cards on top of each other */
.asw-carousel-viewport {
    position: relative;
}

/* All cards inside carousel: hidden by default, absolutely layered */
.asw-carousel-viewport .asw-card {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    /* Don't lift on hover inside carousel — avoids jank during transition */
    pointer-events: none;
}

/* The active card sits in normal flow to set the viewport height */
.asw-carousel-viewport .asw-card.asw-card--active {
    position: relative;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Dot navigation ──────────────────────────────────────────────────── */

.asw-carousel-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.asw-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: none;
    padding: 0;
    background: var(--asw-dot);
    cursor: pointer;
    transition: background 0.25s ease, transform 0.25s ease;
    outline: none;
}

.asw-carousel-dot:hover {
    background: var(--asw-dot-active);
    transform: scale(1.3);
}

.asw-carousel-dot.asw-dot--active {
    background: var(--asw-dot-active);
    transform: scale(1.25);
}

/* ── Progress bar ────────────────────────────────────────────────────── */

.asw-carousel-progress {
    height: 3px;
    background: var(--asw-progress-bg);
    border-radius: 2px;
    margin-top: 10px;
    overflow: hidden;
}

.asw-carousel-progress-bar {
    height: 100%;
    width: 0;
    background: var(--asw-progress-bar);
    border-radius: 2px;
}

.asw-carousel-progress-bar.asw-progress--run {
    animation: asw-progress-fill linear forwards;
}

@keyframes asw-progress-fill {
    from { width: 0%; }
    to   { width: 100%; }
}

/* Pause progress on hover */
.asw-carousel-wrap:hover .asw-carousel-progress-bar {
    animation-play-state: paused;
}

/* ══════════════════════════════════════════════════════════════════════════
   TICKER TAPE
══════════════════════════════════════════════════════════════════════════ */

.asw-ticker-wrap {
    display: flex;
    align-items: center;
    background: var(--asw-ticker-bg);
    color: var(--asw-ticker-text);
    height: 44px;
    border-radius: 6px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
    font-size: 13px;
    user-select: none;
}

.asw-ticker__label {
    flex-shrink: 0;
    background: var(--asw-label-bg);
    color: var(--asw-label-text);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 0 14px;
    height: 100%;
    display: flex;
    align-items: center;
}

.asw-ticker__viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 100%;
}

.asw-ticker__viewport::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, transparent, var(--asw-ticker-bg));
    pointer-events: none;
}

.asw-ticker__track {
    display: flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
    animation: asw-scroll linear infinite;
}

.asw-ticker-wrap:hover .asw-ticker__track {
    animation-play-state: paused;
}

@keyframes asw-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

.asw-ticker__item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px 0 0;
}

.asw-ticker__symbol { font-weight: 700; letter-spacing: .5px; }

.asw-ticker__price { font-weight: 600; }
.asw-ticker__price::before { content: '$'; opacity: .7; font-size: .85em; }

.asw-ticker__change { font-size: 12px; font-weight: 500; }

.asw-ticker__sep {
    color: var(--asw-sep);
    margin-right: 18px;
    font-size: 18px;
    line-height: 1;
}

/* ══════════════════════════════════════════════════════════════════════════
   MINI CARD  (transparent background, compact inline display)
══════════════════════════════════════════════════════════════════════════ */

.asw-mini-group {
    display: flex;
    align-items: flex-start;
}

.asw-mini-group--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
}

.asw-mini-group--vertical {
    flex-direction: column;
    gap: 16px;
}

.asw-mini-wrap {
    background: transparent;
    display: inline-flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.1;
    min-width: 100px;
}

.asw-mini__symbol {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.asw-mini__row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asw-mini__pct {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
}

.asw-mini__arrow {
    font-size: 16px;
    margin-right: 2px;
}

.asw-mini__price {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    align-self: flex-end;
    padding-bottom: 3px;
}

/* Light theme — dark text on any (transparent) background */
.asw-mini--light .asw-mini__symbol       { color: rgba(0, 0, 0, 0.55); }
.asw-mini--light .asw-mini__price        { color: rgba(0, 0, 0, 0.55); }
.asw-mini--light .asw-mini__pct.asw-up   { color: #38a169; }
.asw-mini--light .asw-mini__pct.asw-down { color: #e53e3e; }

/* Dark theme — light text on any (transparent) background */
.asw-mini--dark .asw-mini__symbol       { color: rgba(255, 255, 255, 0.65); }
.asw-mini--dark .asw-mini__price        { color: rgba(255, 255, 255, 0.65); }
.asw-mini--dark .asw-mini__pct.asw-up   { color: #68d391; }
.asw-mini--dark .asw-mini__pct.asw-down { color: #fc8181; }

/* ══════════════════════════════════════════════════════════════════════════
   CHART + FINANCIALS
══════════════════════════════════════════════════════════════════════════ */

.asw-chart-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid var(--asw-border);
    border-radius: 10px;
    background: var(--asw-bg);
    overflow: hidden;
    max-width: 960px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* ── Header ──────────────────────────────────────────────────────────── */

.asw-chart__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid var(--asw-border);
}

.asw-chart__symbol {
    font-size: 20px;
    font-weight: 700;
    color: var(--asw-text);
    line-height: 1.1;
}

.asw-chart__company-name {
    font-size: 12px;
    color: var(--asw-text-muted);
    margin-top: 3px;
    min-height: 16px;
}

.asw-chart__header-price { text-align: right; }

.asw-chart__price {
    font-size: 22px;
    font-weight: 700;
    color: var(--asw-text);
    line-height: 1.1;
}

.asw-chart__change {
    font-size: 13px;
    font-weight: 500;
    margin-top: 2px;
}

/* ── Period buttons ──────────────────────────────────────────────────── */

.asw-chart__periods {
    display: flex;
    gap: 6px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--asw-border);
    background: var(--asw-bg-2);
}

.asw-chart__period {
    background: none;
    border: 1px solid var(--asw-border);
    border-radius: 4px;
    color: var(--asw-text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    transition: all 0.15s ease;
}

.asw-chart__period:hover {
    border-color: var(--asw-text-muted);
    color: var(--asw-text);
}

.asw-chart__period.asw-period--active {
    background: var(--asw-text);
    border-color: var(--asw-text);
    color: var(--asw-bg);
}

/* ── Body grid ───────────────────────────────────────────────────────── */

.asw-chart__body {
    display: grid;
    grid-template-columns: 1fr 260px;
}

/* ── SVG chart area ──────────────────────────────────────────────────── */

.asw-chart__canvas-wrap {
    position: relative;
    min-height: 280px;
    border-right: 1px solid var(--asw-border);
}

.asw-chart__svg {
    display: block;
    width: 100%;
    height: auto;
}

.asw-chart__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--asw-text-muted);
    font-size: 13px;
}

.asw-chart__tooltip {
    position: absolute;
    background: var(--asw-bg);
    border: 1px solid var(--asw-border);
    border-radius: 5px;
    padding: 6px 10px;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    z-index: 10;
}

.asw-chart__tooltip-date  { font-size: 11px; color: var(--asw-text-muted); }
.asw-chart__tooltip-price { font-size: 13px; font-weight: 700; color: var(--asw-text); margin-top: 2px; }

/* ── Financials panel ────────────────────────────────────────────────── */

.asw-chart__financials {
    padding: 14px 14px 14px 16px;
    overflow-y: auto;
    max-height: 420px;
}

.asw-chart__fin-msg {
    font-size: 12px;
    color: var(--asw-text-muted);
    padding: 12px 0;
}

.asw-chart__fin-company { margin-bottom: 12px; }

.asw-chart__fin-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--asw-text);
    line-height: 1.3;
}

.asw-chart__fin-meta {
    font-size: 11px;
    color: var(--asw-text-muted);
    margin-top: 2px;
}

.asw-chart__fin-section { margin-bottom: 12px; }

.asw-chart__fin-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--asw-text-muted);
    padding-bottom: 5px;
    border-bottom: 1px solid var(--asw-border);
    margin-bottom: 5px;
}

.asw-chart__fin-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-size: 12px;
}

.asw-chart__fin-label {
    color: var(--asw-text-muted);
    flex: 1;
    padding-right: 6px;
}

.asw-chart__fin-value {
    color: var(--asw-text);
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 680px) {
    .asw-chart__body             { grid-template-columns: 1fr; }
    .asw-chart__canvas-wrap      { border-right: none; border-bottom: 1px solid var(--asw-border); }
    .asw-chart__financials       { max-height: none; }
}

/* ══════════════════════════════════════════════════════════════════════════
   MICRO CARD  (single-line compact text, transparent background)
══════════════════════════════════════════════════════════════════════════ */

.asw-micro-group {
    display: inline-flex;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.asw-micro-group--horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

.asw-micro-group--vertical {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.asw-micro-wrap {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    white-space: nowrap;
    line-height: 1;
}

.asw-micro__symbol {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
}

.asw-micro__price {
    font-weight: 600;
    font-size: 12px;
}

.asw-micro__change {
    font-size: 12px;
    font-weight: 500;
}

/* Light theme */
.asw-micro--light .asw-micro__symbol              { color: #1a202c; }
.asw-micro--light .asw-micro__price               { color: #1a202c; }
.asw-micro--light .asw-micro__change--up          { color: #38a169; }
.asw-micro--light .asw-micro__change--down        { color: #e53e3e; }

/* Dark theme */
.asw-micro--dark .asw-micro__symbol              { color: #f7fafc; }
.asw-micro--dark .asw-micro__price               { color: #f7fafc; }
.asw-micro--dark .asw-micro__change--up          { color: #68d391; }
.asw-micro--dark .asw-micro__change--down        { color: #fc8181; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .asw-cards-wrap { flex-direction: column; }
    .asw-card { max-width: 100%; }
    .asw-carousel-wrap { max-width: 100%; }
    .asw-ticker-wrap { font-size: 12px; }
}
