:root {
    --dark-bg: #1A1A1A;
    --dark-text: #F0F0F0;
    --dark-card-bg: #2B2B2B;
    --dark-header-bg: #1A1A1A;

    --light-bg: #F8F4ED;

    --light-text: #1A1A1A;
    --light-card-bg: #FFFFFF;
    --light-header-bg: #F8F4ED;

    --primary-orange: #F28C28;

    --primary-blue: #1C2E4A;

    --date-text: #888888;
}

* {
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none !important;
    display: block !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- MODOS DE COLOR --- */

/* Dark Mode Styles (por defecto) */
body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

body.dark-mode header {
    background-color: var(--dark-header-bg);
    color: var(--dark-text);
}

body.dark-mode .news-card {
    background-color: var(--dark-card-bg);
}

/* Light Mode Styles */
body.light-mode {
    background-color: var(--light-bg);
    color: var(--light-text);
}

body.light-mode header {
    background-color: var(--light-header-bg);
    color: var(--light-text);
    border-bottom: 1px solid #E0E0E0;
}

body.light-mode .news-card {
    background-color: var(--light-card-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

body.light-mode h1,
body.light-mode h2 {
    color: var(--primary-blue);
}

body.light-mode .hero-content h1 {
    color: var(--primary-blue);
}

body.light-mode nav a {
    color: var(--primary-blue);
}

/* Ajuste para el Modo Claro del Buscador */
body.light-mode .search-group {
    background-color: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .search-input {
    background: transparent !important;
    color: var(--light-text) !important;
}

body.light-mode .search-btn {
    color: var(--primary-blue) !important;
}

body.light-mode .side-item {
    color: rgb(235, 235, 235);
}

body.dark-mode .text-muted {
    color: white !important;
}

body.light-mode .tradingview-widget-container {
    filter: invert(0.9) hue-rotate(180deg);
}

/* --- HEADER Y NAVEGACIÓN --- */
header {
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Contenedor que agrupa navegación y botones a la derecha */
.nav-right {
    display: flex;
    align-items: center;
    gap: 30px;
}

/* Logo (noticiascripto.com) */
.logo {
    display: flex;
    align-items: flex-end;
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-suffix {
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 2px;
    color: #666666;
}

body.dark-mode .logo-suffix {
    color: #AAAAAA;
}

/* Navegación */

/* Botón Hamburguesa */
.menu-toggle {
    display: none;
    /* Se activa en móvil */
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle span {
    width: 30px;
    height: 3px;
    background-color: var(--primary-orange);
    border-radius: 2px;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 25px;
    display: flex;
    align-items: center;
}

nav a {
    text-decoration: none;
    color: var(--dark-text);
    font-weight: bold;
    transition: color 0.3s;
}

body.light-mode nav a {
    color: var(--primary-blue);
}

nav a:hover {
    color: var(--primary-orange);
}

.close-menu {
    display: none;
}

/* Contenedor del buscador */

.search-box {
    max-width: 300px;
    margin-left: 20px;
}

.search-container-side {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 5px 15px;
    width: 100%;
}

.search-container-side input {
    background: transparent !important;
    border: none !important;
    color: white !important;
    width: 100%;
    /* padding: 8px 10px; */
    outline: none;
}

.search-container-side button {
    background: transparent;
    border: none;
    color: var(--primary-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.search-container-side button:hover, .search-container-side button:active {
    color: var(--primary-orange);
}

.search-btn:hover {
    color: #0d6efd;
}

.search-group:focus-within {
    border-color: #0d6efd;
    box-shadow: 0 0 10px rgba(13, 110, 253, 0.2);
}

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

.mode-toggle-button {
    background-color: transparent;
    color: var(--dark-text);
    /* border: 1px solid var(--dark-text); */
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

body.light-mode .mode-toggle-button {
    color: var(--primary-blue);
    border-color: var(--primary-blue);
}

.subscribe-button {
    background-color: var(--primary-orange);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;

    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s;
}

.subscribe-button:hover {
    background-color: #e07b20;
}


/* --- SECCIÓN 1 (ORIGINAL): HERO VOLATILIDAD --- */
.hero-volatilidad {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 60px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-content {
    flex: 2;
    margin-right: 50px;
}

.hero-content h1 {
    font-size: 3em;
    margin-bottom: 15px;
    line-height: 1.1;
    color: var(--dark-text);
}

.hero-content p {
    font-size: 1.2em;
    color: #b0b0b0;
}

.hero-image {
    flex: 1;
    min-width: 250px;
}

.hero-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}


/* --- SECCIÓN 2 (ORIGINAL): CUADRÍCULA DE 4 NOTICIAS --- */
.primary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    padding-bottom: 50px;
}

.news-card {
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
    padding: 20px;
    transition: transform 0.2s, background-color 0.3s, box-shadow 0.3s;
}

.news-card:hover {
    transform: translateY(-5px);
}

.card-image {
    margin-bottom: 15px;
}

.card-image img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 6px;
}

.news-card h2 {
    font-size: 1.4em;
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--dark-text);
}

.news-card .date {
    font-size: 0.9em;
    color: var(--date-text);
}

.news-card h2 a,
.noticias-list h2 a {
    color: var(--dark-text) !important;
    transition: color 0.3s ease;
}

.news-card h2 a:hover,
.noticias-list h2 a:hover {
    color: var(--primary-orange) !important;
}

/* Color para el texto de descripción que se ve muy oscuro */
.noticias-grid p.text-muted {
    color: #b0b0b0 !important;
    line-height: 1.4;
}

/* Asegura que la card sea un contenedor flexible */
.noticias-grid .news-card {
    display: flex !important;
    /* Fuerza el layout horizontal */
    align-items: stretch;
    padding: 0;
    /* Quitamos el padding para que la imagen pegue al borde */
    height: 150px;
    /* Definimos un alto fijo para la fila */
    margin-bottom: 20px;
}

.noticias-grid .news-card a {
    color: var(--primary-orange);
}

body.light-mode .noticias-grid .news-card a {
    color: var(--light-text) !important;
}

body.light-mode .noticias-grid .news-card a:hover {
    color: var(--primary-orange) !important;
}

/* El contenedor de la imagen debe tener un ancho fijo */
.noticias-grid .news-card .image-placeholder {
    width: 180px;
    flex-shrink: 0;
    height: 100%;
}

/* La imagen debe cubrir todo el espacio */
.noticias-grid .card-image {
    width: 100%;
    height: 100% !important;
    object-fit: cover !important;
    /* Evita que se deforme */
    margin-bottom: 0 !important;
}

/* El contenido del texto */
.noticias-grid .news-card .content {
    padding: 20px;
    width: 80%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.no-image-fallback {
    width: 100%;
    height: 100%;
    padding: 20px;
    display: flex;
    /* Se activará con JS cambiando a 'flex' */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2b2b2b 0%, #1a1a1a 100%);
    /* Degradado sutil */
    color: #666;
    /* Color de texto suave */
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.no-image-fallback i {
    font-size: 2rem;
    /* Tamaño del icono de Bootstrap Icons */
    color: var(--primary-orange);
    /* Tu color naranja de marca */
    margin-bottom: 8px;
    opacity: 0.5;
}

.no-image-fallback span {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.light-mode .sidebar .list-unstyled a {
    color: black !important;
}

/* --- SECCIÓN 3 (NUEVA): NOTICIA PRINCIPAL GRANDE (BITCOIN CAE) --- */
.hero-main-article {
    position: relative;
    height: 400px;
    overflow: hidden;
    border-radius: 8px;
    margin-top: 40px;
    /* Separación después de la primera cuadrícula */
    margin-bottom: 40px;
}

.hero-image-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
}

.hero-content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0) 100%);
}

.hero-content-overlay h1 {
    font-size: 3em;
    margin-bottom: 10px;
    line-height: 1.1;
    color: var(--dark-text);
}

.hero-content-overlay p {
    font-size: 1.1em;
    color: #b0b0b0;
    margin-bottom: 0;
}

.anchor-icon {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-orange);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.anchor-icon img {
    height: 60%;
    width: 60%;
    object-fit: contain;
}


/* --- SECCIÓN 4 (NUEVA): CUADRÍCULA DE 3 NOTICIAS (ETHEREUM) --- */

.secondary-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    /* Una columna grande y dos pequeñas */
    gap: 30px;
    padding-bottom: 50px;
    align-items: stretch;
}

.secondary-grid .news-card {
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: var(--dark-card-bg);
}

/* Estilo para la tarjeta grande de Ethereum */
.secondary-grid .big-card h2 {
    font-size: 1.8em;
    margin-top: 15px;
    line-height: 1.2;
}

.secondary-grid .big-card p {
    color: #b0b0b0;
    margin-top: 10px;
}

/* Estilo para las tarjetas pequeñas */
.secondary-grid .small-card h2 {
    font-size: 1.2em;
    line-height: 1.3;
}

.card-tag {
    display: inline-block;
    background-color: var(--primary-orange);
    color: white;
    padding: 4px 8px;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 10px;
    align-self: flex-start;
}

body.dark-mode .pagination .page-link {
    background-color: #2c2c2c !important;
    border: 1px solid gray;
}

body.dark-mode .pagination .active .page-link {
    background-color: #181818 !important;
    border: 1px solid gray;
}

body.dark-mode .pagination .disabled .page-link {
    color: gray;
}

.main-footer {
    background-color: #0a0a0a;
    color: white;
    padding: 60px 20px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 50px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    justify-content: space-between;
}

.footer-column {
    flex: 1;
    min-width: 200px;
}

.footer-column.branding {
    flex: 2;
}

.footer-column.branding img {
    height: 40px;
    margin-bottom: 20px;
}

.footer-column h3 {
    color: var(--primary-orange);
    font-size: 1.1rem;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.footer-column p {
    color: var(--footer-text);
    line-height: 1.6;
    font-size: 0.95rem;
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul li a {
    color: var(--footer-text);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-column ul li a:hover {
    color: var(--primary-orange);
}

.social-links {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

.social-links a {
    color: white;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-orange);
    transform: translateY(-3px);
}

.email-link {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    margin-top: 10px;
}

.footer-bottom {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: #666;
    font-size: 0.85rem;
}

@media (min-width: 325px) {
    .subscribe-button {
        width: 55%;
    }

}

@media (max-width: 480px) {

    .hero-volatilidad {
        flex-direction: column;
    }

    .secondary-grid {
        grid-template-columns: 1fr;
    }

    nav {
        width: 100%;
    }

    body:has(.search-container-side.active) .logo {
        display: none;
        /* Evita usar display: none para que no haya saltos bruscos; 
       opacity permite una transición suave */
        transition: opacity 0.3s ease;
    }

    /* Contenedor principal */
    .search-container-side {
        display: flex;
        align-items: center;
        background: none;
        border: none;
        border-radius: 25px;
        padding: 5px;
        /* Reducido para que sea circular al estar cerrado */

        /* TRUCO: Ancho inicial pequeño y transición */
        width: 40px;
        height: 40px;
        transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
        cursor: pointer;
        justify-content: flex-end;
        /* Mantiene la lupa a la derecha */
    }

    body.light-mode .search-container-side {
        border: none;
        background: none !important;
    }

    /* Expansión al hacer hover o al tener el foco (clic) */
    .search-container-side.active {
        width: 250px;
        background-color: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.1);
        /* O el ancho que prefieras */
        padding: 5px 15px;
    }

    body.light-mode .search-container-side.active {
        background: rgba(0, 0, 0, 0.05) !important;
    }

    .search-container-side input {
        background: transparent !important;
        border: none !important;
        color: white !important;
        outline: none;

        /* TRUCO: El input empieza sin ancho */
        width: 0;
        padding: 0;
        opacity: 0;
        transition: width 0.4s ease, opacity 0.2s;
    }

    /* Mostrar input cuando se expande */
    .search-container-side.active input {
        width: 100%;
        padding: 8px 10px;
        opacity: 1;
    }

    .search-container-side.active .search-container-side button {
        background: transparent;
        border: none;
        color: #ff9900;
        /* Color naranja de tu imagen */
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        min-width: 30px;
        /* Asegura que la lupa no se deforme */
        cursor: pointer;
    }

    .search-box {
        margin-left: 0px;
    }

    .search-group {
        display: flex;
        justify-content: start;
    }

    .search-input {
        width: 80%;
    }

    .noticias-grid .news-card {
        flex-direction: column !important;
        /* Apila imagen sobre texto */
        height: auto !important;
        /* Deja que crezca según el contenido */
        min-height: 350px;
    }

    /* Ajuste del contenedor de imagen/fallback */
    .noticias-grid .news-card .image-placeholder,
    .noticias-grid .news-card .news-image-wrapper,
    .noticias-grid .news-card .no-image-fallback {
        width: 100% !important;
        /* Ocupa todo el ancho del móvil */
        height: 200px !important;
        /* Altura fija para la imagen en móvil */
        border-radius: 8px 8px 0 0 !important;
        /* Redondeado solo arriba */
    }

    /* Ajuste del contenido de texto */
    .noticias-grid .news-card .content {
        width: 100% !important;
        padding: 15px !important;
    }

    .noticias-grid .news-card h2 {
        font-size: 1.2rem !important;
        /* Texto un poco más pequeño para móviles */
        margin-bottom: 8px;
    }

    /* Icono de "Sin Imagen" más proporcional en móvil */
    .no-image-fallback i {
        font-size: 3rem !important;
    }

    .pagination {
        width: 236px !important;
    }

    .pagination li {
        width: 45% !important;
    }

    .justify-content-between.flex-fill:has(.pagination) .justify-content-between.flex-fill{
        justify-content: center !important;
    }
}

@media (max-width: 570px) {
    .pagination {
        width: 300px;
        display: flex !important;
        flex-direction: row !important;

        /* flex-wrap: wrap; */

        justify-content: center;
        padding-left: 0;
        gap: 5px;
    }

    .pagination li {
        width: 50%;
        display: inline-block !important;
        margin: 0 !important;
    }
}

@media (max-width: 768px) {

    /* Los enlaces/botones individuales */
    .pagination .page-link {
        padding: 6px 10px !important;
        /* Tamaño más compacto para dedos */
        font-size: 0.9rem !important;
        min-width: 35px;
        text-align: center;
    }

    /* Ocultar el texto informativo "Showing 1 to 10..." en móviles muy pequeños */
    .pagination nav div:first-child {
        display: none !important;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
    }

    .social-links {
        justify-content: center;
    }

    .footer-column {
        width: 100%;
    }
}

@media (min-width: 500px) and (max-width: 600px) {
    .noticias-grid .news-card .content .h5 a {
        font-size: 16px;
    }

    .noticias-grid .news-card .content p {
        font-size: 12px;
    }
}

@media (min-width: 768px) {

    .pagination {
        margin-left: 10px;
    }

    .nav-right {
        display: flex;
        justify-content: center;
    }

    .nav-right nav a {
        padding: 10px;
        border-bottom: 2px solid transparent;
    }

    .nav-right nav a.active {
        border-bottom: 4px solid white;
    }

    body.light-mode .nav-right nav a.active {
        border-bottom: 4px solid var(--primary-orange);
    }

    .pagination li {
        margin-left: 0px !important;
    }
}

@media (max-width: 1024px) {
    .news-grid.secondary-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    a:has(.news-card.big-card) {
        grid-column: span 2;

        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

@media (min-width: 1024px) {
    .nav-right {
        width: 80%;
    }

    .header-actions {
        width: 34%;
    }

    .subscribe-button {
        width: 42%;
    }
}

@media (max-width: 992px) {

    header .container {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-right {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background-color: var(--dark-bg);

        z-index: 9999;

        display: flex !important;
        flex-direction: column !important;
        padding: 80px 30px;
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);

        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .nav-right.active {
        right: 0;
    }

    .close-menu {
        display: inline-block;
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        color: white;
        font-size: 30px;
        cursor: pointer;
    }

    nav ul:not(.pagination) {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    nav ul li {
        margin: 15px 0;
        width: 100%;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        margin-top: 30px;
    }

    .subscribe-button {
        text-align: center;
    }

    .search-box-mobile {
        /* width: 100%; */
        margin: 20px 0;
    }

    body.light-mode .search-container-side {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.1);
    }

    body.light-mode .search-container-side input {
        color: var(--light-text) !important;
    }

    body.light-mode .nav-right.active nav a {
        color: white !important;
    }

    body.light-mode .nav-right.active .mode-toggle-button {
        color: rgb(235, 235, 235) !important;
        border-color: rgb(235, 235, 235) !important;
    }
}