:root {
    --border-color-2: #B971DA;
    --border-color-1: #7DB9DF;
    --card-bg: #0b0f15;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text-muted: #c5c5c5;
}

/* Lista vertical: 1 card por linha, mobile-first */
#all-news-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 10px 0;
    box-sizing: border-box;
}

/* Card horizontal: mobile (default) — empilhado (imagem em cima) */
.all-news-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: white;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
}

.all-news-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Cores por categoria */
.all-news-card[data-category="NerdSky"] { border-color: #B971DA; box-shadow: 0 0 12px rgba(185, 113, 218, 0.12); }
.all-news-card[data-category="NerdSky"]:hover { box-shadow: 0 8px 24px rgba(185, 113, 218, 0.4); border-color: #D89BF0; }

.all-news-card[data-category="Potato Nerd"] { border-color: #7DB9DF; box-shadow: 0 0 12px rgba(125, 185, 223, 0.12); }
.all-news-card[data-category="Potato Nerd"]:hover { box-shadow: 0 8px 24px rgba(125, 185, 223, 0.4); border-color: #A6D4F0; }

.all-news-card[data-category="NerdDead"] { border-color: #E85D5D; box-shadow: 0 0 12px rgba(232, 93, 93, 0.12); }
.all-news-card[data-category="NerdDead"]:hover { box-shadow: 0 8px 24px rgba(232, 93, 93, 0.4); border-color: #F08080; }

/* Imagem (em mobile: largura 100%, no topo) */
.all-news-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background-color: #1a1f29;
    flex-shrink: 0;
}

.all-news-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

/* Conteúdo do card */
.all-news-content {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    box-sizing: border-box;
}

.all-news-tag {
    display: inline-block;
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: 6px;
    background-color: transparent;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.all-news-tag[data-category="NerdSky"] { background-color: #B971DA; }
.all-news-tag[data-category="Potato Nerd"] { background-color: #7DB9DF; }
.all-news-tag[data-category="NerdDead"] { background-color: #E85D5D; }

.all-news-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
}

.all-news-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.all-news-footer {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.all-news-author {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.all-news-author-head {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
}

.all-news-date {
    margin: 0;
    font-size: 0.8rem;
}

.all-news-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    margin-top: 4px;
    transition: gap 0.3s ease;
}

.all-news-card[data-category="NerdSky"] .all-news-link { color: #B971DA; }
.all-news-card[data-category="Potato Nerd"] .all-news-link { color: #7DB9DF; }
.all-news-card[data-category="NerdDead"] .all-news-link { color: #E85D5D; }

.all-news-card:hover .all-news-link {
    gap: 12px;
}

/* ============================================
   Tablet (≥ 600px): layout horizontal
   Imagem à esquerda, conteúdo à direita
   ============================================ */
@media (min-width: 600px) {
    .all-news-card {
        flex-direction: row;
        align-items: stretch;
        gap: 0;
    }

    .all-news-image {
        width: 200px;
        height: auto;
        min-height: 160px;
    }

    .all-news-content {
        flex: 1;
        padding: 20px;
    }

    .all-news-title {
        font-size: 1.2rem;
    }
}

/* ============================================
   Desktop (≥ 1024px): mais respiro
   ============================================ */
@media (min-width: 1024px) {
    #all-news-container {
        max-width: 1000px;
        gap: 1.5rem;
    }

    .all-news-image {
        width: 260px;
    }

    .all-news-content {
        padding: 24px;
    }

    .all-news-title {
        font-size: 1.35rem;
    }
}

.all-news-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

#voltar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #a1a1aa;
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease, transform 0.2s ease;
}

#voltar:hover {
    color: #ffffff;
    transform: translateX(-3px);
}

/* ============================================
   Barra de pesquisa + filtro de categoria
   ============================================ */
#news-controls {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto 1.25rem auto;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

/* ----- Searchbar ----- */
.news-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.news-search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted, #c5c5c5);
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.2s ease;
}

.news-search-input {
    width: 100%;
    padding: 0.75rem 2.6rem 0.75rem 2.4rem;
    background-color: var(--card-bg);
    border: 1.5px solid var(--border-subtle);
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.news-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.news-search-input::placeholder {
    color: #6b7280;
}

.news-search-input:focus {
    border-color: var(--border-color-1);
    box-shadow: 0 0 0 3px rgba(125, 185, 223, 0.15);
}

.news-search-input:focus ~ .news-search-icon,
.news-search-wrapper:focus-within .news-search-icon {
    color: var(--border-color-1);
}

.news-search-clear {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-muted, #c5c5c5);
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
    opacity: 0;
    pointer-events: none;
}

.news-search-clear.visible {
    opacity: 1;
    pointer-events: auto;
}

.news-search-clear:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    transform: scale(1.05);
}

/* ----- Filter dropdown ----- */
.news-filter-wrapper {
    position: relative;
    width: 100%;
}

.news-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg);
    border: 1.5px solid var(--border-subtle);
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
    box-sizing: border-box;
}

.news-filter-btn:hover {
    border-color: var(--border-color-1);
}

.news-filter-btn[aria-expanded="true"] {
    border-color: var(--border-color-1);
    box-shadow: 0 0 0 3px rgba(125, 185, 223, 0.15);
}

.news-filter-btn > i:first-child {
    color: var(--border-color-1);
    font-size: 0.95rem;
}

.news-filter-chevron {
    color: var(--text-muted, #c5c5c5);
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.news-filter-btn[aria-expanded="true"] .news-filter-chevron {
    transform: rotate(180deg);
}

.news-filter-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    list-style: none;
    margin: 0;
    padding: 6px;
    background-color: var(--card-bg);
    border: 1.5px solid var(--border-subtle);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 50;
    max-height: 280px;
    overflow-y: auto;
    box-sizing: border-box;
}

.news-filter-dropdown[hidden] {
    display: none;
}

.news-filter-dropdown li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    color: white;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    user-select: none;
}

.news-filter-dropdown li:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.news-filter-dropdown li[aria-selected="true"] {
    background-color: rgba(125, 185, 223, 0.15);
    color: var(--border-color-1);
}

.filter-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-dot-all { background-color: #ffffff; }
.filter-dot-nerdsky { background-color: #B971DA; }
.filter-dot-potato { background-color: #7DB9DF; }
.filter-dot-nerddead { background-color: #E85D5D; }

/* ----- Contador de resultados ----- */
.news-results-info {
    text-align: center;
    color: var(--text-muted, #c5c5c5);
    font-size: 0.85rem;
    margin: 0 auto 1rem auto;
    padding: 0 0.5rem;
    max-width: 1000px;
    box-sizing: border-box;
}

.news-results-info span#news-results-count {
    color: var(--border-color-1);
    font-weight: 700;
}

/* ----- Estado vazio (filtragem retorna 0) ----- */
.all-news-empty.filtered {
    padding: 2.5rem 1rem;
    font-size: 1rem;
    color: var(--text-muted, #c5c5c5);
}

/* ----- Destacar o termo buscado dentro dos cards ----- */
.all-news-card mark {
    background-color: rgba(185, 113, 218, 0.35);
    color: white;
    padding: 0 3px;
    border-radius: 3px;
}

/* ----- Animação suave ao filtrar ----- */
.all-news-card {
    animation: fadeIn 0.25s ease;
}

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

/* ----- Tablet (≥ 600px): search e filter lado a lado ----- */
@media (min-width: 600px) {
    #news-controls {
        flex-direction: row;
        align-items: stretch;
        gap: 0.75rem;
    }

    .news-search-wrapper {
        flex: 1;
    }

    .news-filter-wrapper {
        width: auto;
        min-width: 200px;
    }

    .news-filter-btn {
        width: 100%;
    }

    .news-filter-dropdown {
        left: auto;
        right: 0;
        width: 220px;
    }
}
