/* Fonts & Base System */
:root {
    --fno-font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --fno-font-mono: 'JetBrains Mono', Consolas, "Courier New", monospace;
    --brand-primary: #0d6efd;
    --brand-success: #198754;
    --brand-danger: #dc3545;
    --brand-warning: #ffc107;
}

body {
    font-family: var(--fno-font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Brand Typography */
.brand-text {
    font-weight: 800;
    letter-spacing: -0.03em;
}

/* Card & News styling */
.news-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 0.6rem;
    overflow: hidden;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* Impact Left Border Indicators */
.border-start-success {
    border-left: 5px solid #198754 !important;
}

.border-start-danger {
    border-left: 5px solid #dc3545 !important;
}

.border-start-warning {
    border-left: 5px solid #ffc107 !important;
}

.border-start-secondary {
    border-left: 5px solid #6c757d !important;
}

/* Analysis Box */
.analysis-box {
    background-color: var(--bs-tertiary-bg);
}

.font-monospace-preview {
    font-family: var(--fno-font);
    line-height: 1.5;
}

/* Metric Cards */
.metric-card {
    border-radius: 0.6rem;
    transition: transform 0.15s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
}

.metric-icon-box {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quick Filter Pills Scrollable */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.quick-chip {
    white-space: nowrap;
    transition: all 0.2s ease;
}

.quick-chip.active {
    background-color: var(--bs-primary);
    color: white;
    border-color: var(--bs-primary);
}

/* Marquee Breaking News */
.marquee-wrapper {
    position: relative;
    width: 100%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,1) 2%, rgba(0,0,0,1) 98%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,1) 2%, rgba(0,0,0,1) 98%, transparent 100%);
}

.marquee-content {
    animation: marquee 35s linear infinite;
    display: inline-flex;
}

.marquee-wrapper:hover .marquee-content,
.marquee-wrapper:active .marquee-content {
    animation-play-state: paused;
}

.ticker-item {
    transition: background-color 0.15s ease, transform 0.1s ease;
    user-select: none;
    border-radius: 6px;
}

.ticker-item:hover {
    background-color: rgba(0, 0, 0, 0.08);
}

.ticker-item:hover .ticker-headline {
    text-decoration: underline;
}

[data-bs-theme="dark"] .ticker-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Metric Pulse Cards */
.metric-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    user-select: none;
    border-radius: 0.75rem;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.12) !important;
}

.metric-card:active {
    transform: scale(0.98);
}

.metric-card.active-filter {
    outline: 2px solid var(--bs-primary);
    box-shadow: 0 0.5rem 1.25rem rgba(13, 110, 253, 0.25) !important;
}

/* News Toolbar Card & Active Filters */
.news-toolbar-card {
    border-radius: 0.75rem;
    background-color: var(--bs-body-bg);
}

.hover-primary:hover {
    color: var(--bs-primary) !important;
}

.active-filter-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background-color: var(--bs-primary-subtle);
    color: var(--bs-primary);
    border: 1px solid var(--bs-primary-border-subtle, rgba(13, 110, 253, 0.2));
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.active-filter-badge:hover {
    background-color: rgba(13, 110, 253, 0.2);
}

.active-filter-badge .btn-close-filter {
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    opacity: 0.75;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
}

.active-filter-badge .btn-close-filter:hover {
    opacity: 1;
}

/* Prediction Pills with Modern Gradient */
.prediction-pill-bullish {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.prediction-pill-bearish {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%) !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.prediction-pill-neutral {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%) !important;
    color: #ffffff !important;
}

/* News Wishlist (Star) Button */
.news-wishlist-btn {
    background: transparent;
    border: none;
    padding: 2px 4px;
    border-radius: 50%;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
    outline: none;
}

.news-wishlist-btn:hover {
    transform: scale(1.25);
}

.news-wishlist-btn:active {
    transform: scale(0.85);
}

.news-wishlist-btn .bi-star {
    color: #94a3b8;
    transition: color 0.15s ease;
}

.news-wishlist-btn:hover .bi-star {
    color: #f59e0b;
}

.news-wishlist-btn.is-wishlisted .bi-star-fill,
.news-wishlist-btn .bi-star-fill {
    color: #f59e0b !important;
    filter: drop-shadow(0 1px 3px rgba(245, 158, 11, 0.45));
}

@keyframes starPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4) rotate(18deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.news-wishlist-btn.star-popping {
    animation: starPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes marquee {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

/* Spinning Refresh Icon */
.refresh-spinning {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Typography Helpers */
.text-balance {
    text-wrap: balance;
}

.fs-7 {
    font-size: 0.8rem;
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.tracking-tight {
    letter-spacing: -0.02em;
}

/* Mobile & Touch Optimizations */
@media (max-width: 768px) {
    .news-card .card-body {
        padding: 0.9rem !important;
    }

    .brand-text {
        font-size: 1.05rem;
    }

    .metric-card {
        border-radius: 0.65rem;
    }

    .metric-card .card-body {
        padding: 0.75rem !important;
    }

    .metric-card h3 {
        font-size: 1.3rem !important;
    }

    .metric-icon-box {
        width: 2rem;
        height: 2rem;
        font-size: 0.85rem;
    }

    .news-card .card-title {
        font-size: 1.02rem;
        line-height: 1.38;
    }

    .quick-chip {
        font-size: 0.76rem !important;
        padding: 0.3rem 0.65rem !important;
    }

    /* Modal Fullscreen Optimization on Mobile */
    .modal-fullscreen-sm-down .modal-content {
        border-radius: 0;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .metric-card h3 {
        font-size: 1.2rem !important;
    }

    .metric-card .small {
        font-size: 0.68rem !important;
    }

    /* Wrap buttons nicely on mobile */
    .news-card .card-footer-actions {
        width: 100%;
        justify-content: stretch;
    }

    .news-card .card-footer-actions .btn {
        flex: 1 1 auto;
        text-align: center;
    }
}
