/* ============================================
   NEWS PAGE — Estilos exclusivos
   Requiere: app.css, site-nav.css
============================================ */

/* El icono de cabecera usa emoji en lugar de SVG */
.news-page .brand-icon {
    font-size: 18px;
    line-height: 1;
}

/* ============================================
   BARRA DE FILTROS POR MARCA
============================================ */
.filter-bar {
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.filter-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    flex-shrink: 0;
}

.brand-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.bchip {
    padding: 3px 12px;
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.12s;
}

.bchip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.bchip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.bchip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.update-stamp {
    margin-left: auto;
    font-family: "DM Mono", monospace;
    font-size: 0.68rem;
    color: var(--text-faint);
}

/* ============================================
   ESTADOS (cargando / error / vacío)
============================================ */
.state-msg {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.state-msg a {
    color: var(--accent);
}

.state-err {
    color: #ef4444;
}

/* ============================================
   GRID DE NOTICIAS
============================================ */
.main-content,
.news-feed-main {
    padding-top: 24px;
    padding-bottom: 64px;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

@media (max-width: 960px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 580px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TARJETA DE NOTICIA
============================================ */
.news-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition:
        box-shadow 0.18s,
        border-color 0.18s;
    animation: fadeIn 0.25s ease both;
}

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

.news-card:hover {
    border-color: var(--accent);
    box-shadow:
        0 0 0 1px var(--accent),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

/* Scoped para no colisionar con .card-header de las tarjetas de cámara */
.news-card .card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================
   CHIPS DE MARCA (por fabricante)
============================================ */
.brand-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.brand-fujifilm {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.brand-canon {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.brand-nikon {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.brand-sigma {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}
.brand-ricoh {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
    border: 1px solid rgba(236, 72, 153, 0.3);
}
.brand-photolari {
    background: rgba(20, 184, 166, 0.12);
    color: #14b8a6;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

[data-theme="light"] .brand-fujifilm {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.3);
    background: rgba(22, 163, 74, 0.08);
}
[data-theme="light"] .brand-canon {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.08);
}
[data-theme="light"] .brand-nikon {
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.08);
}
[data-theme="light"] .brand-sigma {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.3);
    background: rgba(37, 99, 235, 0.08);
}
[data-theme="light"] .brand-ricoh {
    color: #db2777;
    border-color: rgba(219, 39, 119, 0.3);
    background: rgba(219, 39, 119, 0.08);
}
[data-theme="light"] .brand-photolari {
    color: #0d9488;
    border-color: rgba(13, 148, 136, 0.3);
    background: rgba(13, 148, 136, 0.08);
}

.brand-other {
    background: rgba(161, 161, 170, 0.12);
    color: #a1a1aa;
    border: 1px solid rgba(161, 161, 170, 0.35);
}
[data-theme="light"] .brand-other {
    color: #52525b;
    border-color: rgba(82, 82, 91, 0.35);
    background: rgba(82, 82, 91, 0.08);
}

/* ============================================
   CONTENIDO DE TARJETA
============================================ */
.card-source {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-faint);
}

.card-date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: "DM Mono", monospace;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.card-date::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
    flex-shrink: 0;
}

.card-title {
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.4;
}

.card-title a {
    color: var(--text-main);
    text-decoration: none;
    transition: color 0.12s;
}

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

.card-summary {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
}

.card-footer {
    margin-top: auto;
    padding-top: 4px;
}

.card-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.12s;
}

.card-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* ============================================
   ICONOS DE TEMA (luna / sol)
============================================ */
.theme-icon-light {
    display: none;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}
[data-theme="light"] .theme-icon-light {
    display: block;
}

/* ============================================
   INVENTARIO + PANEL DE NOTICIAS (index)
============================================ */
.view-tabbar {
    display: none;
    gap: 0;
    margin: 0 0 12px;
    padding: 4px;
    border-radius: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
}

.view-tabbar [role="tab"] {
    flex: 1;
    margin: 0;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    position: relative;
    cursor: pointer;
    transition:
        background 0.15s,
        color 0.15s;
}

.view-tabbar [role="tab"]:hover {
    color: var(--text-main);
    background: var(--bg-hover);
}

.view-tabbar [role="tab"][aria-selected="true"] {
    color: var(--accent);
    background: var(--accent-dim);
    box-shadow: 0 0 0 1px var(--accent);
}

.view-tabbar [role="tab"]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.news-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9999px;
    background: var(--err-color, #ef4444);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 1;
    vertical-align: middle;
    pointer-events: none;
}

.app-layout {
    display: grid;
    grid-template-columns: 1fr minmax(280px, 340px);
    gap: 20px;
    align-items: start;
}

.inventory-panel {
    min-width: 0;
}

.news-sidebar {
    min-width: 0;
}

.news-sidebar-inner {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    padding: 14px 14px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--border-subtle);
}

.news-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-subtle);
}

.news-sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.news-sidebar-title .news-sidebar-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.news-sidebar .filter-bar {
    margin-bottom: 10px;
    padding: 6px 0;
    flex-shrink: 0;
}

.news-sidebar .update-stamp {
    display: none;
}

.news-sidebar .state-msg {
    padding: 20px 12px;
    flex-shrink: 0;
}

.news-sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    margin-right: -6px;
    padding-right: 6px;
}

.news-sidebar .news-feed-main {
    padding-top: 0;
    padding-bottom: 12px;
}

.news-sidebar .news-grid {
    grid-template-columns: 1fr;
    gap: 10px;
}

.news-sidebar .news-card {
    padding: 12px;
    animation: none;
}

.news-sidebar .card-title {
    font-size: 0.82rem;
}

.news-sidebar .card-summary {
    font-size: 0.75rem;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .view-tabbar {
        display: flex;
    }

    .app-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .news-sidebar-inner {
        position: relative;
        top: auto;
        max-height: none;
    }

    .app-layout[data-mobile-view="inventory"] .news-sidebar {
        display: none !important;
    }

    .app-layout[data-mobile-view="news"] .inventory-panel {
        display: none !important;
    }

    /* Vista solo noticias: altura de viewport y scroll en la lista */
    .app-layout[data-mobile-view="news"] {
        display: flex;
        flex-direction: column;
        min-height: calc(100dvh - 100px);
    }

    .app-layout[data-mobile-view="news"] .news-sidebar {
        display: flex !important;
        flex-direction: column;
        min-height: 0;
        flex: 1;
    }

    .app-layout[data-mobile-view="news"] .news-sidebar-inner {
        flex: 1;
        min-height: 0;
        max-height: none;
    }

    .app-layout[data-mobile-view="news"] .news-sidebar-scroll {
        flex: 1;
        min-height: 0;
    }

    .news-sidebar .update-stamp {
        display: block;
        margin-left: 0;
        width: 100%;
        text-align: left;
        margin-top: 4px;
    }

    .news-sidebar .filter-bar {
        flex-wrap: wrap;
    }
}
