/* ==========================================================================
   NxNotícias - Componentes: Ticker, Cards, Manchete, AdSense e Artigo
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TICKER CARROSSEL FINANCEIRO EM TEMPO REAL (INFINITE MARQUEE)
   -------------------------------------------------------------------------- */
.ticker-bar {
    background-color: #070F1E;
    color: #E2E8F0;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 1010;
    overflow: hidden;
    height: 38px;
    display: flex;
    align-items: center;
}

.ticker-container {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    position: relative;
}

/* Selo Fixo: Mercado Ao Vivo */
.ticker-badge-fixed {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #0B192C;
    padding: 0 1.25rem 0 1rem;
    height: 100%;
    z-index: 10;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 6px 0 12px rgba(7, 15, 30, 0.7);
    flex-shrink: 0;
}

.ticker-badge-fixed .badge-text {
    font-weight: 800;
    color: #F8FAFC;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
}

.live-pulse {
    width: 8px;
    height: 8px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: livePulseAnim 1.8s infinite;
}

@keyframes livePulseAnim {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Máscara e Esteira Deslizante Contínua */
.ticker-track-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
    mask-image: linear-gradient(to right, transparent, black 15px, black 96%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 15px, black 96%, transparent);
}

.ticker-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: tickerSlideAnim 55s linear infinite;
    cursor: default;
}

/* Pausar o carrossel no hover para facilitar a leitura */
.ticker-track-wrapper:hover .ticker-track {
    animation-play-state: paused;
}

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

.ticker-group {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding-right: 1.25rem;
}

/* Card Individual de Cotação dentro do Carrossel */
.ticker-card {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.65rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.ticker-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Tags de Categorização Financeira */
.ticker-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    letter-spacing: 0.03em;
}

.tag-moeda {
    background: rgba(56, 189, 248, 0.15);
    color: #38BDF8;
}

.tag-cripto {
    background: rgba(192, 132, 252, 0.18);
    color: #C084FC;
}

.tag-indice {
    background: rgba(52, 211, 153, 0.15);
    color: #34D399;
}

.tag-juros {
    background: rgba(251, 191, 36, 0.15);
    color: #FBBF24;
}

.tag-commodity {
    background: rgba(251, 146, 60, 0.15);
    color: #FB923C;
}

.ticker-symbol {
    font-weight: 800;
    color: #F8FAFC;
    font-size: 0.82rem;
}

.ticker-value {
    color: #E2E8F0;
    font-weight: 600;
    font-size: 0.8rem;
}

.ticker-change {
    font-weight: 700;
    font-size: 0.72rem;
    padding: 0.05rem 0.25rem;
    border-radius: 2px;
}

.ticker-change.up {
    color: #34D399;
    background: rgba(52, 211, 153, 0.1);
}

.ticker-change.down {
    color: #F87171;
    background: rgba(248, 113, 113, 0.1);
}

@media (max-width: 640px) {
    .ticker-badge-fixed .badge-text {
        display: none;
    }
    .ticker-badge-fixed {
        padding: 0 0.75rem;
    }
}

/* --------------------------------------------------------------------------
   2. ESPAÇOS PUBLICITÁRIOS (ADSENSE PLACEHOLDERS COMPACTOS E INTEGRADOS)
   -------------------------------------------------------------------------- */
.ad-slot {
    background: #F8FAFC;
    border: 1px dashed #CBD5E1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.25rem 0;
    position: relative;
    overflow: hidden;
    text-align: center;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
}

.ad-slot:hover {
    border-color: #94A3B8;
    background: #F1F5F9;
}

.ad-slot-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.ad-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-emerald);
    font-weight: 700;
}

.ad-content-slim {
    color: #64748B;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ad-icon-mini {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Tamanhos de AdSense IAB */
.ad-top-leaderboard {
    max-width: 970px;
    margin: 0.75rem auto 1.25rem auto;
}

.ad-in-article {
    max-width: 100%;
    margin: 1.5rem 0;
}

.ad-sidebar {
    width: 100%;
    margin-bottom: 1.25rem;
}

/* --------------------------------------------------------------------------
   3. GRID DA PÁGINA INICIAL (HOME)
   -------------------------------------------------------------------------- */
.home-hero-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Manchete Principal (Destaque) */
.featured-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.featured-card:hover {
    box-shadow: var(--shadow-md);
}

.featured-card .thumb-wrapper {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
    background: #0B192C;
}

.featured-card .thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.featured-card:hover .thumb-wrapper img {
    transform: scale(1.03);
}

.featured-card .content-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.meta-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.featured-title {
    font-family: var(--font-sans);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-title a:hover {
    color: var(--color-emerald);
}

.featured-excerpt {
    font-size: 0.88rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 0.85rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author-reading {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

/* Sidebar "Mais Lidas" */
.sidebar-box {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-emerald);
}

.ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.ranking-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.ranking-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ranking-number {
    font-size: 1.75rem;
    font-weight: 900;
    color: var(--color-emerald);
    line-height: 1;
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

.ranking-content {
    flex: 1;
}

.ranking-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-primary-light);
    line-height: 1.35;
    margin-bottom: 0.35rem;
}

.ranking-title a:hover {
    color: var(--color-emerald);
}

/* Grid de Últimas Notícias */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.5rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.02em;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--color-emerald);
}

.view-all-link {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-emerald);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.view-all-link:hover {
    text-decoration: underline;
}

.news-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.card-news {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-news:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-thumb {
    position: relative;
    height: 160px;
    overflow: hidden;
    background: #0B192C;
}

.card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.card-news:hover .card-thumb img {
    transform: scale(1.05);
}

.card-body {
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.35;
    margin: 0.35rem 0 0.5rem 0;
    letter-spacing: -0.01em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a:hover {
    color: var(--color-emerald);
}

.card-excerpt {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    line-height: 1.45;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--color-text-light);
    padding-top: 0.65rem;
    border-top: 1px solid var(--color-border);
}

.read-more-link {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-emerald);
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    transition: color 0.15s ease, transform 0.15s ease;
}

.read-more-link:hover {
    color: #047857;
    transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   4. PÁGINA DO ARTIGO (LEITURA E RETENÇÃO)
   -------------------------------------------------------------------------- */
.article-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 2.5rem;
    margin-top: 1rem;
}

.article-header {
    margin-bottom: 1.75rem;
}

.article-title {
    font-family: var(--font-sans);
    font-size: 2.35rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--color-primary);
    letter-spacing: -0.03em;
    margin: 0.85rem 0;
}

.article-lead {
    font-size: 1.2rem;
    color: #475569;
    line-height: 1.5;
    font-weight: 400;
    margin-bottom: 1.25rem;
}

.article-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.author-badge-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.author-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.author-details .author-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
}

.author-details .pub-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Botões de Compartilhamento */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #F1F5F9;
    color: var(--color-primary-light);
    border: 1px solid var(--color-border);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: translateY(-2px);
    color: #FFFFFF;
}

.share-btn.whatsapp:hover { background-color: #25D366; border-color: #25D366; }
.share-btn.twitter:hover { background-color: #000000; border-color: #000000; }
.share-btn.linkedin:hover { background-color: #0A66C2; border-color: #0A66C2; }
.share-btn.copy:hover { background-color: var(--color-emerald); border-color: var(--color-emerald); }

.article-featured-image {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.article-featured-image img {
    width: 100%;
    max-height: 460px;
    object-fit: cover;
}

.article-body-content {
    font-family: var(--font-sans);
    font-size: 1.125rem;
    line-height: 1.8;
    color: #1E293B;
}

.article-body-content p {
    margin-bottom: 1.5rem;
}

.article-body-content h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-primary);
    margin: 2rem 0 1rem;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.article-body-content ul, .article-body-content ol {
    margin: 1.25rem 0 1.75rem 1.75rem;
}

.article-body-content li {
    margin-bottom: 0.6rem;
}

.article-body-content blockquote {
    border-left: 4px solid var(--color-emerald);
    background: #F8FAFC;
    padding: 1.25rem 1.5rem;
    font-style: italic;
    margin: 1.75rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-primary-light);
}

/* Toast de Link Copiado */
.toast-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--color-primary);
    color: #FFFFFF;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    display: none;
    z-index: 9999;
}

/* Responsividade dos Componentes */
@media (max-width: 1024px) {
    .home-hero-grid {
        grid-template-columns: 1fr;
    }
    .article-container {
        grid-template-columns: 1fr;
    }
    .news-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 640px) {
    .news-cards-grid {
        grid-template-columns: 1fr;
    }
    .featured-card .thumb-wrapper {
        height: 240px;
    }
    .featured-title {
        font-size: 1.45rem;
    }
    .article-title {
        font-size: 1.75rem;
    }
    .article-lead {
        font-size: 1.05rem;
    }
}

/* --------------------------------------------------------------------------
   5. PÁGINA DE BOLSAS: CARDS DE ÍNDICES PADRONIZADOS E FILTROS
   -------------------------------------------------------------------------- */
.grid-indices-mundiais {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 900px) {
    .grid-indices-mundiais {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 580px) {
    .grid-indices-mundiais {
        grid-template-columns: 1fr;
    }
}

.card-indice-pro {
    background: #FFFFFF;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 145px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card-indice-pro:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #CBD5E1;
}

.card-indice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-indice-body {
    margin: 0.6rem 0;
}

.indice-pontos {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-primary);
    letter-spacing: -0.02em;
}

.card-indice-footer {
    border-top: 1px solid #F1F5F9;
    padding-top: 0.5rem;
}

/* Pills de Filtro de Ações por Setor */
.pill-btn {
    border: 1px solid var(--color-border);
    background: #F8FAFC;
    color: #475569;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pill-btn:hover {
    background: #F1F5F9;
    color: var(--color-primary);
    border-color: #CBD5E1;
}

.pill-btn.active {
    background: var(--color-emerald-bg);
    color: #065F46;
    border-color: #6EE7B7;
    font-weight: 700;
}

/* Badges da Tabela de Ações */
.ticker-badge-code {
    display: inline-block;
    background: #EFF6FF;
    color: #1D4ED8;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    border: 1px solid #BFDBFE;
}

.setor-badge-tag {
    font-size: 0.75rem;
    color: #64748B;
    background: #F1F5F9;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. MODAL E ALERTAS PERSONALIZADOS DO NXNOTÍCIAS
   -------------------------------------------------------------------------- */
.nx-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 25, 44, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 1.25rem;
}

.nx-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.nx-modal-card {
    background: #FFFFFF;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nx-modal-overlay.active .nx-modal-card {
    transform: scale(1);
}

.nx-modal-header {
    background: #0B192C;
    color: #FFFFFF;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--color-emerald);
}

.nx-modal-brand {
    font-size: 1rem;
    font-weight: 800;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nx-modal-body {
    padding: 1.5rem 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.nx-modal-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.nx-modal-icon.aviso {
    background: #FEF3C7;
    color: #B45309;
}

.nx-modal-icon.erro {
    background: #FEE2E2;
    color: #B91C1C;
}

.nx-modal-icon.sucesso {
    background: #D1FAE5;
    color: #047857;
}

.nx-modal-content {
    flex: 1;
}

.nx-modal-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: 0.35rem;
}

.nx-modal-message {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}

.nx-modal-footer {
    padding: 0.85rem 1.25rem 1.25rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: #F8FAFC;
    border-top: 1px solid var(--color-border);
}

.nx-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.nx-modal-btn-primary {
    background: var(--color-emerald);
    color: #FFFFFF;
}

.nx-modal-btn-primary:hover {
    background: #047857;
}

.nx-modal-btn-secondary {
    background: #E2E8F0;
    color: #334155;
}

.nx-modal-btn-secondary:hover {
    background: #CBD5E1;
}
