/* --- Widget del Clima en la parte superior --- */
.weather-widget-top {
    margin-bottom: 2rem;
    border-radius: 12px;
    overflow: hidden; /* Para que el widget respete el borde redondeado */
}

/* --- Contenedor del Feed de Alertas --- */
.articles-grid {
    /* Ya no es un grid, es un contenedor de feed */
    display: flex;
    flex-direction: column;
    gap: 1rem; /* ¡NUEVO! Añadimos espacio entre cada alerta */
    margin-top: 2rem;
    /* Quitamos el borde, fondo y sombra del contenedor general */
}

/* --- Estilo para cada "Alerta" o "Tuit" en el Feed --- */
.feed-item {
    /* ¡NUEVO! Ahora cada item es una tarjeta individual */
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1.25rem 1.5rem;
    transition: background-color 0.2s ease;
}


.feed-item:hover {
    border-color: #ccc; /* Hacemos el borde un poco más oscuro al pasar el cursor */
}

/* --- Encabezado de la Alerta (Autor y Fecha) --- */
.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.feed-author {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
}

.feed-date {
    font-size: 0.85rem;
    color: #888;
}

/* --- Contenido de la Alerta (El texto del Vigía) --- */
.feed-content {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    word-wrap: break-word; /* Para que el texto no se desborde */
}

/* Estilo para la etiqueta (ej: "ALERTA TRÁFICO:") */
.feed-content strong {
    /* ¡NUEVO ESTILO DE PÍLDORA! */
    display: inline-block; /* Permite aplicar padding y bordes */
    padding: 4px 12px;
    background-color: #f0f2f5; /* Un gris muy claro */
    border: 1px solid #e0e0e0;
    border-radius: 20px; /* Bordes redondeados */
    font-size: 0.95em;
    font-weight: 700;
    color: #333; /* Color de texto normal */
    margin-right: 8px; /* Espacio después de la píldora */
    margin-bottom: 0.5rem; /* Espacio si el texto sigue abajo */
}

/* Estilo para los embeds de Instagram dentro del feed */
.feed-content .instagram-media {
    margin-top: 1rem !important; /* Añade espacio arriba del embed */
    border-radius: 8px !important;
    overflow: hidden;
}

/* Mensaje cuando no hay artículos */
.articles-grid p {
    padding: 2rem;
    text-align: center;
    color: #666;
}
/* --- ¡NUEVO! Estilos para el Fallback de Instagram (Global) --- */

/* Contenedor del mensaje de fallback */
.instagram-fallback-wrapper {
    text-align: center;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 500px;
}

.instagram-fallback-wrapper p {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #666;
    font-size: 1rem;
}

/* El botón/enlace para ir a Instagram */
.instagram-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.instagram-fallback-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.instagram-fallback-link img {
    width: 24px;
    height: 24px;
}
/* --- ¡NUEVO! Estilos para el Enlace de la Fuente --- */

/* Contenedor del enlace */
.source-link-wrapper {
    margin-top: 1.5rem;
    text-align: center; /* Centra el contenido */
}

.source-link-wrapper p {
    display: inline-block; /* Permite que el párrafo se comporte como un bloque pero se ajuste al contenido */
    margin: 0;
    padding: 10px 20px;
    background-color: #f0f2f5; /* Un fondo gris claro */
    border: 1px solid #e0e0e0;
    border-radius: 25px; /* Bordes redondeados para forma de píldora */
    font-size: 0.9rem;
    color: #555;
    transition: all 0.3s ease;
}

.source-link-wrapper p:hover {
    background-color: #e9ecef;
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.source-link-wrapper strong {
    margin-right: 8px;
    color: #333;
}

.source-link-wrapper a {
    color: #007bff; /* Azul para el enlace */
    text-decoration: none;
    font-weight: 600;
}

.source-link-wrapper a:hover {
    text-decoration: underline;
}

/* --- ¡NUEVO! Estilos para el Footer del Feed (Likes) --- */
.feed-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 15px; /* Espacio entre el botón de like y el de comentar */
}

.like-section {
    display: flex;
    align-items: center;
}

/* Estilo común para ambos botones */
.like-button, .comment-button, .share-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid #ccc;
    background-color: #f8f9fa;
    color: #555;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

/* Hacemos que el botón de comentar se comporte como un enlace */
.comment-button {
    text-decoration: none;
}

.like-button:hover:not(:disabled), .comment-button:hover, .share-button:hover {
    background-color: #e9ecef;
    border-color: #bbb;
}

.like-button:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.like-button.liked {
    background-color: #007bff;
    color: white;
    border-color: #0056b3;
}

.like-button.liked svg {
    stroke: white;
}

/* --- ¡NUEVO! Estilos para el Formulario de Comentario en el Feed --- */

/* Contenedor del formulario, oculto por defecto */
.comment-form-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, margin-top 0.4s ease-out;
    margin-top: 0;
}

/* Estilo cuando el formulario es visible */
.comment-form-wrapper.visible {
    max-height: 300px; /* Altura suficiente para el formulario */
    margin-top: 1rem; /* Espacio cuando se abre */
}

.comment-form-feed {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-form-feed textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 50px;
}

.comment-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-form-feed button {
    padding: 8px 18px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s;
}

.comment-form-feed button:hover {
    background-color: #0056b3;
}

.view-conversation-link {
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
}

.view-conversation-link:hover {
    text-decoration: underline;
}

.comment-login-prompt-feed {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

/* --- ¡NUEVO! Estilo para el mensaje de "Copiado" --- */
.copy-feedback {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745; /* Verde éxito */
    color: white;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
    pointer-events: none; /* Para que no interfiera con otros clics */
}

.copy-feedback.show {
    opacity: 1;
    transform: translate(-50%, -10px);
}

/* --- ¡NUEVO! Estilos para la Tarjeta de Fuente (Social Media) --- */

/* Ajustes a la tarjeta cuando se usa para mostrar la fuente */
.source-preview-card {
    margin-top: 1.5rem;
    background-color: #f8f9fa; /* Un fondo ligeramente diferente para distinguirla */
    border-style: dashed; /* Un borde punteado para indicar que es un enlace externo */
}

.source-preview-card:hover {
    border-color: #007bff;
    border-style: solid;
}

/* El enlace principal dentro de la tarjeta */
.source-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 1rem;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 1.1rem;
    transition: color 0.2s ease;
}

.source-social-link:hover {
    color: #0056b3;
}

/* El icono del logo de la red social */
.source-social-icon {
    width: 32px;
    height: 32px;
}

/* --- ¡NUEVO! Estilos para expandir/colapsar contenido en móvil --- */

/* Estos estilos solo se aplican en pantallas de hasta 768px de ancho */
@media (max-width: 768px) {
    .expandable-content {
        max-height: 240px; /* ¡AUMENTADO! Muestra unas 8-10 líneas antes de cortar. */
        overflow: hidden;
        position: relative;
        transition: max-height 0.5s ease-in-out;
    }

    /* Efecto de degradado para indicar que hay más texto */
    .expandable-content::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 50px;
        background: linear-gradient(to bottom, transparent, white);
        pointer-events: none; /* Para que no interfiera con el texto */
    }

    /* Estilo cuando el contenido está expandido */
    .expandable-content.expanded {
        max-height: 2000px; /* Una altura grande para asegurar que todo el contenido se vea */
    }

    .expandable-content.expanded::after {
        opacity: 0; /* Ocultamos el degradado cuando está expandido */
    }

    /* Estilo del botón "Ver más" */
    .expand-content-btn {
        display: block; /* Por defecto es un botón de bloque */
        width: fit-content;
        margin: 10px auto 0;
        padding: 6px 16px;
        background-color: transparent;
        border: 1px solid #007bff;
        color: #007bff;
        border-radius: 20px;
        cursor: pointer;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .expand-content-btn:hover {
        background-color: #007bff;
        color: white;
    }
}
