/* ============================================================
   Stock News Widget – style.css
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.snw-wrapper {
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1a1a2e;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
    margin: 24px 0;
}

/* ── Header ──────────────────────────────────────────────── */
.snw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #fff;
    gap: 12px;
}

.snw-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.snw-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.snw-ticker-badge {
    display: inline-flex;
    align-items: center;
    background: #3b82f6;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .05em;
    padding: 3px 10px;
    border-radius: 6px;
}

.snw-title {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #f8fafc !important;
    border: none !important;
}

.snw-count {
    font-size: 12px;
    color: #94a3b8;
}

.snw-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .2s;
}
.snw-refresh-btn:hover {
    background: rgba(255,255,255,.22);
}
.snw-refresh-btn.snw-spinning svg {
    animation: snw-spin 1s linear infinite;
}

/* ── Articles List ───────────────────────────────────────── */
.snw-articles-list {
    padding: 0;
}

.snw-article {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s;
}
.snw-article:last-child {
    border-bottom: none;
}
.snw-article:hover {
    background: #f8fafc;
}

/* ── Article Meta ────────────────────────────────────────── */
.snw-article-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.snw-source-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Source colours */
.snw-source-yahoo       { background: #6001d2; color: #fff; }
.snw-source-googlenews  { background: #4285f4; color: #fff; }
.snw-source-seekingalpha{ background: #f97316; color: #fff; }
.snw-source-marketwatch { background: #003087; color: #fff; }
.snw-source-reuters     { background: #ff8000; color: #fff; }
.snw-source-benzinga    { background: #e53e3e; color: #fff; }
.snw-source-fool        { background: #22c55e; color: #fff; }
.snw-source-investopedia{ background: #0d9488; color: #fff; }
.snw-source-default     { background: #64748b; color: #fff; }

.snw-date {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Article Title ───────────────────────────────────────── */
.snw-article-title {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b !important;
    text-decoration: none !important;
    line-height: 1.4;
    transition: color .15s;
}
.snw-article-title:hover {
    color: #2563eb !important;
}
.snw-article-title:visited {
    color: #6b21a8 !important;
}
.snw-ext-icon {
    flex-shrink: 0;
    margin-top: 3px;
    opacity: .45;
}
.snw-article-title:hover .snw-ext-icon {
    opacity: .75;
}

/* ── Description ─────────────────────────────────────────── */
.snw-description {
    margin: 0 !important;
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

/* ── Footer ──────────────────────────────────────────────── */
.snw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

.snw-powered {
    font-size: 11px;
    color: #94a3b8;
}

.snw-sources-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.snw-legend-item {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
    opacity: .75;
}
/* Reuse source badge colours */
.snw-legend-item.snw-source-yahoo       { background: #6001d2; color: #fff; }
.snw-legend-item.snw-source-googlenews  { background: #4285f4; color: #fff; }
.snw-legend-item.snw-source-seekingalpha{ background: #f97316; color: #fff; }
.snw-legend-item.snw-source-marketwatch { background: #003087; color: #fff; }
.snw-legend-item.snw-source-reuters     { background: #ff8000; color: #fff; }
.snw-legend-item.snw-source-benzinga    { background: #e53e3e; color: #fff; }
.snw-legend-item.snw-source-fool        { background: #22c55e; color: #fff; }
.snw-legend-item.snw-source-investopedia{ background: #0d9488; color: #fff; }

/* ── Empty State ─────────────────────────────────────────── */
.snw-empty {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}
.snw-empty svg {
    display: block;
    margin: 0 auto 12px;
    color: #cbd5e1;
}
.snw-empty p {
    margin: 0 0 4px;
    font-size: 14px;
}
.snw-empty-hint {
    font-size: 12px !important;
    color: #94a3b8 !important;
}

/* ── Loading Overlay ─────────────────────────────────────── */
.snw-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,.85);
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 13px;
    color: #475569;
    z-index: 10;
    border-radius: 12px;
}

.snw-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: snw-spin .7s linear infinite;
}

@keyframes snw-spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 480px) {
    .snw-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .snw-article {
        padding: 12px 14px;
    }
    .snw-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
