/**
 * Estilos para Noticias Corporativas - Almacenes El Rey
 * Version: 1.0.0
 */

/* ==========================================================================
   Variables de colores (basado en el tema de Almacenes El Rey)
   ========================================================================== */
:root {
    --rojo-rey: #e30613;
    --cafe-lealtad: #6b4423;
    --amarillo-ahorro: #ffcc02;
    --color-texto: #333;
    --color-gris: #666;
    --color-gris-claro: #f5f5f5;
    --color-borde: #e0e0e0;
}

/* ==========================================================================
   Estilos generales de noticias
   ========================================================================== */
.noticia-card {
    background: #fff;
    border-radius: 0.8rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.noticia-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.noticia-thumbnail {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
}

.noticia-content {
    padding: 1.5rem;
}

.noticia-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--color-gris);
}

.noticia-categoria {
    background: var(--rojo-rey);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.noticia-fecha {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.noticia-fecha::before {
    content: '📅';
}

.noticia-autor {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.noticia-autor::before {
    content: '✍️';
}

.noticia-titulo {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 1.5rem;
    color: var(--cafe-lealtad);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.noticia-titulo a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.noticia-titulo a:hover {
    color: var(--rojo-rey);
}

.noticia-excerpt {
    color: var(--color-texto);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.noticia-leer-mas {
    display: inline-block;
    background: var(--rojo-rey);
    color: #fff;
    padding: 0.5rem 1.5rem;
    border-radius: 0.4rem;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
}

.noticia-leer-mas:hover {
    background: var(--cafe-lealtad);
    transform: translateX(5px);
}

/* Badge de noticia destacada */
.badge-destacada {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--amarillo-ahorro);
    color: var(--cafe-lealtad);
    padding: 0.5rem 1rem;
    border-radius: 0.4rem;
    font-weight: bold;
    font-size: 0.875rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

/* ==========================================================================
   Grid de noticias
   ========================================================================== */
.noticias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .noticias-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Single noticia (detalle completo)
   ========================================================================== */
.single-noticia-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--color-borde);
}

.single-noticia-titulo {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2.5rem;
    color: var(--cafe-lealtad);
    margin-bottom: 1rem;
}

.single-noticia-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.single-noticia-thumbnail {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 0.8rem;
    margin: 0 auto 2rem;
    display: block;
}

.single-noticia-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--color-texto);
}

.single-noticia-content p {
    margin-bottom: 1.5rem;
}

.single-noticia-content h2,
.single-noticia-content h3 {
    color: var(--cafe-lealtad);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.single-noticia-footer {
    max-width: 800px;
    margin: 3rem auto 0;
    padding-top: 2rem;
    border-top: 2px solid var(--color-borde);
}

.noticia-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.noticia-tag {
    background: var(--color-gris-claro);
    color: var(--color-gris);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.noticia-tag:hover {
    background: var(--rojo-rey);
    color: #fff;
}

/* ==========================================================================
   Formulario de gestión de noticias (Frontend)
   ========================================================================== */
.noticias-gestion-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.noticia-form-card {
    background: #fff;
    padding: 2rem;
    border-radius: 0.8rem;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-borde);
}

.form-titulo {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    color: var(--cafe-lealtad);
    margin: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: bold;
    color: var(--cafe-lealtad);
    margin-bottom: 0.5rem;
}

.form-label .required {
    color: var(--rojo-rey);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--color-borde);
    border-radius: 0.4rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--rojo-rey);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

.form-textarea {
    min-height: 200px;
    resize: vertical;
}

.form-help {
    display: block;
    font-size: 0.875rem;
    color: var(--color-gris);
    margin-top: 0.25rem;
}

.form-error {
    display: block;
    color: var(--rojo-rey);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.4rem;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--rojo-rey);
    color: #fff;
}

.btn-primary:hover {
    background: var(--cafe-lealtad);
}

.btn-secondary {
    background: var(--color-gris);
    color: #fff;
}

.btn-secondary:hover {
    background: var(--cafe-lealtad);
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--rojo-rey);
    color: #fff;
}

.btn-danger:hover {
    background: #c10510;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ==========================================================================
   Tabla de mis noticias
   ========================================================================== */
.mis-noticias-tabla {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.mis-noticias-tabla th,
.mis-noticias-tabla td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--color-borde);
}

.mis-noticias-tabla th {
    background: var(--color-gris-claro);
    font-weight: bold;
    color: var(--cafe-lealtad);
}

.mis-noticias-tabla tr:hover {
    background: var(--color-gris-claro);
}

.estado-publicada {
    color: #28a745;
    font-weight: bold;
}

.estado-borrador {
    color: #ffc107;
    font-weight: bold;
}

.estado-pendiente {
    color: #17a2b8;
    font-weight: bold;
}

.acciones-noticia {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    min-width: auto;
}

/* ==========================================================================
   Mensajes de sistema
   ========================================================================== */
.mensaje {
    padding: 1rem 1.5rem;
    border-radius: 0.4rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
}

.mensaje-exito {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.mensaje-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.mensaje-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.mensaje-advertencia {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

/* ==========================================================================
   Filtros de archivo de noticias
   ========================================================================== */
.noticias-filtros-busqueda-wrapper {
    padding-top: 1.75rem; /* Compensa la altura del label del filtro de categorías */
}

/* ==========================================================================
   Paginación
   ========================================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-borde);
    border-radius: 0.4rem;
    text-decoration: none;
    color: var(--color-texto);
    transition: all 0.3s ease;
}

.pagination a:hover {
    background: var(--rojo-rey);
    color: #fff;
    border-color: var(--rojo-rey);
}

.pagination .current {
    background: var(--rojo-rey);
    color: #fff;
    border-color: var(--rojo-rey);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .single-noticia-titulo {
        font-size: 1.8rem;
    }
    
    .single-noticia-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mis-noticias-tabla {
        font-size: 0.875rem;
    }
    
    .mis-noticias-tabla th,
    .mis-noticias-tabla td {
        padding: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        text-align: center;
    }
}

/* ==========================================================================
   Utilidades
   ========================================================================== */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
}
