/* ===== NOVEDADES SECTION STYLES ===== */
/* .news-hero is defined globally in style.css */

/* ===== CARD STYLES ===== */
.novedades-card,
.novedad-detalle-card,
.related-card,
.novedades-item {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    animation: fadeInUp 0.6s ease forwards;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; /* ADDED: Ensure cards have relative positioning */
}

.novedades-card:hover,
.novedades-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15) !important;
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15) !important;
}

.novedades-item {
    padding: 25px;
    border-left: 4px solid #1a5276;
}

/* ===== IMAGE CONTAINER STYLES ===== */
.card-img-top-container,
.card-img-top-container-detalle,
.card-img-top-container-related {
    position: relative;
    overflow: hidden;
}

.card-img-top-container { height: 200px; }
.card-img-top-container-detalle { height: 400px; }
.card-img-top-container-related { height: 180px; }

/* ===== IMAGE STYLES ===== */
.novedades-image,
.novedades-image-detalle,
.novedades-image-related,
.novedades-item img {
    transition: transform 0.3s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.novedades-card:hover .novedades-image,
.related-card:hover .novedades-image-related,
.novedades-item:hover img {
    transform: scale(1.05);
}

.novedad-detalle-card:hover .novedades-image-detalle {
    transform: scale(1.02);
}

.novedades-item img {
    border-radius: 5px;
    margin-bottom: 15px;
    max-height: 250px;
    object-fit: cover;
}

.novedad-content img,
.news-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}

/* ===== IMAGE OVERLAY STYLES ===== */
.image-overlay,
.image-overlay-detalle,
.image-overlay-related {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 50%, rgba(0,0,0,0.1));
    z-index: 3;
}

/* ===== DATE BADGE STYLES - FIXED POSITIONING ===== */
.date-badge,
.date-badge-detalle,
.related-date-badge {
    position: absolute;
    background: rgba(255,255,255,0.95);
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 10;
    border-radius: 8px;
    padding: 10px;
    min-width: 60px; /* ADDED: Consistent width */
}

/* CHANGED: Position to top-right to match your index.php */
.date-badge {
    top: 15px;
    right: 15px;
    left: auto;
}

.date-badge-detalle {
    top: 20px;
    right: 20px; /* CHANGED: from left to right */
    left: auto; /* ADDED: Ensure it doesn't stick to left */
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    z-index: 4;
}

.related-date-badge {
    top: 10px;
    right: 10px; /* CHANGED: from left to right */
    left: auto; /* ADDED: Ensure it doesn't stick to left */
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Date Text Styles - ENHANCED FOR RED COLOR */
.date-day,
.date-month,
.date-year {
    display: block;
    line-height: 1;
    margin-bottom: 2px;
}

.date-day {
    font-weight: bold;
    color: #dc2626 !important; /* FORCE RED COLOR */
}

.date-badge .date-day { 
    font-size: 1.5rem; 
    font-weight: 700 !important;
}
.date-badge-detalle .date-day { 
    font-size: 1.8rem; 
    font-weight: 700 !important;
}
.related-date-badge .date-day { 
    font-size: 1.2rem; 
    color: #CC0000;
    font-weight: 700 !important;
}

.date-month {
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* ADDED: Better spacing */
}

.date-badge .date-month { font-size: 0.8rem; }
.date-badge-detalle .date-month { font-size: 0.9rem; }
.related-date-badge .date-month { font-size: 0.7rem; }

.date-year {
    color: #666;
    font-weight: 500; /* ADDED: Slightly bolder */
}

.date-badge .date-year { font-size: 0.7rem; }
.date-badge-detalle .date-year { font-size: 0.8rem; }
.related-date-badge .date-year { font-size: 0.7rem; }

/* ===== CONTENT STYLES ===== */
.novedad-content,
.news-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.novedad-content p,
.news-content p {
    margin-bottom: 1.5rem;
}

.news-content strong,
.news-content b,
.novedad-content strong,
.novedad-content b {
    color: #1a5276;
    font-weight: 700;
}

/* General Novedades Styles */
.section {
    padding: 30px 0;
}

.section-title h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 30px;
    border-bottom: 2px solid #f39c12;
    padding-bottom: 10px;
}

.section-title h1 span {
    display: block;
    font-size: 1.1rem;
    color: #7f8c8d;
    font-weight: 400;
    margin-bottom: 5px;
}

.novedades-item h3 {
    color: #1a5276;
    margin: 15px 0;
    font-weight: 700;
    font-size: 1.5rem;
}

.text-description {
    margin-bottom: 15px;
    color: #555;
}

.text-description b {
    color: #1a5276;
}

/* ===== SIDEBAR & CALENDAR STYLES ===== */
.sidebar-sticky {
    position: sticky;
    top: 100px;
}

.sidebar-sticky .card {
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.sidebar-sticky .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
}

.card-header {
    border-bottom: 2px solid rgba(255,255,255,0.2);
    border-radius: 0 !important;
}

.card-header h5 {
    font-weight: 600;
}

.card .btn {
    margin-top: auto;
    align-self: center;
    color: var(--secondary-color);
    font-weight: 600;
    border: none;
    border-radius: 25px;
    padding: 0.5rem 1.2rem;
    transition: all 0.3s ease;
}

.card .btn:hover {
    background: linear-gradient(45deg, #990000, #660000);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.card-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 !important;
    background: #f8f9fa;
}

/* Calendar Widget Styles */
/*
#calendar-container,
.calendar-widget-container,
.sidebar-sticky {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.calendar-widget-container {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.calendar-year-header .btn {
    transition: all 0.3s ease;
}

.calendar-year-header .btn:hover {
    background-color: #e9ecef !important;
}

.calendar-month-link {
    display: block;
    padding: 8px 15px;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.calendar-month-link:hover {
    background-color: #CC0000;
    color: white;
}

.calendar-month-link.sel {
    background-color: #CC0000;
    color: white;
}

.calendar-widget {
    margin-bottom: 25px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    position: relative;
    z-index: 100 !important;
}

.calendar-widget > span {
    display: block;
    background: #1a5276;
    color: white;
    padding: 12px 15px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.1rem;
    position: relative;
}

.calendar-widget > span:after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.calendar-widget > span.collapsed:after {
    content: '\f105';
}

.calendar-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.calendar-widget li {
    border-bottom: 1px solid #f0f0f0;
}

.calendar-widget li:last-child {
    border-bottom: none;
}

.calendar-widget a {
    display: block;
    padding: 10px 15px;
    color: #555;
    text-decoration: none;
    transition: background 0.3s;
    font-size: 0.95rem;
}

.calendar-widget a:hover, 
.calendar-widget a.sel {
    background: #f5f5f5;
    color: #1a5276;
    font-weight: 600;
}

.calendar-widget .collapse {
    position: relative;
    z-index: 99 !important;
}

/ Calendar Dropdown Styling 
.calendar-dropdown .dropdown-menu {
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
}

.calendar-year-header {
    font-weight: 600;
    color: #2c3e50;
    padding: 8px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.calendar-toggle {
    padding: 0.5rem 1rem;
    font-weight: 500;
}

.calendar-collapse {
    margin-top: 0.5rem;
}
*/

/* ===== CALENDAR WIDGET STYLES ===== */
#calendar-container .card {
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1) !important;
    border-radius: 8px !important;
    overflow: hidden;
}

.calendar-widget-container {
    background: white;
    padding: 0 !important;
    box-shadow: none !important;
}

/* Remove borders between years */
.calendar-widget-container hr {
    display: none !important;
}

/* Calendar widget styling */
.calendar-widget {
    margin-bottom: 0 !important;
    border: none !important;
    background: white;
    box-shadow: none !important;
    position: relative;
    z-index: 100 !important;
}

/* Year header styling - SQUARE DESIGN */
.calendar-year-header .btn {
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
    margin: 0 !important;
}

.calendar-year-header .btn:hover {
    background: #e9ecef !important;
}

/* Active/expanded year styling - RED BACKGROUND */
.calendar-year-header .btn[aria-expanded="true"] {
    background: #dc2626 !important; /* Red background */
    border-color: #dc2626 !important;
    border: 1px solid #dc2626 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
}

.calendar-year-header .btn[aria-expanded="true"] .fw-bold {
    color: white !important; /* White text */
    font-weight: 700 !important;
}

.calendar-year-header .btn[aria-expanded="true"] .fas {
    color: white !important; /* White chevron */
}

/* Month links styling */
.calendar-content {
    padding: 0.5rem 0 !important;
    background: #fff;
    border: 1px solid #dee2e6;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

.calendar-content .list-unstyled {
    margin: 0 !important;
}

.calendar-month-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #495057;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0 !important;
    margin: 0 !important;
    border-bottom: 1px solid #f8f9fa;
}

.calendar-month-link:hover {
    background-color: #CC0000;
    color: white;
}

.calendar-month-link.sel {
    background-color: #CC0000;
    color: white;
}

.calendar-month-link:last-child {
    border-bottom: none !important;
}

/* First year item - add top border */
.calendar-widget:first-child .calendar-year-header .btn {
    border-top: 1px solid #dee2e6 !important;
}

/* Last year item styling */
.calendar-widget:last-child .calendar-content {
    border-bottom: none !important;
}

/* Ensure smooth transitions */
.calendar-toggle {
    transition: all 0.3s ease !important;
}

/* Card header and footer styling */
#calendar-container .card-header {
    border-bottom: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 0 !important;
}

#calendar-container .card-footer {
    border-top: 1px solid rgba(0,0,0,0.1) !important;
    border-radius: 0 !important;
}

/* ===== SOCIAL SHARE STYLES ===== */
.social-share i {
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.social-share a {
    transition: transform 0.2s ease;
    display: inline-block;
}

.social-share a:hover i,
.social-share a:hover {
    transform: scale(1.2);
}

/* ===== BACK BUTTON STYLES ===== */
.back-to-news {
    transition: all 0.3s ease;
    border-radius: 25px;
}

.back-to-news:hover {
    transform: translateX(-3px);
}

/* ===== SPACING UTILITIES ===== */
.space-section { margin: 3rem 0; }
.space-large { margin-bottom: 3rem; }
.space-medium { margin-bottom: 2rem; }
.space-small { margin-bottom: 1rem; }
.padding-large { padding: 3rem; }
.padding-medium { padding: 2rem; }

.readable-content {
    line-height: 1.8;
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
}

.section-divider {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

/* ===== PAGINATION STYLES ===== */
.pagination {
    gap: 4px;
}

.page-item {
    margin: 0 2px;
}

.page-link {
    border-radius: 5px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    color: #CC0000;
}

.page-item.active .page-link {
    background-color: #CC0000;
    border-color: #CC0000;
    color: white;
}

.page-item.disabled .page-link {
    color: #6c757d;
    pointer-events: none;
    background-color: #fff;
    border-color: #dee2e6;
}

.page-link:hover {
    background-color: #e9ecef;
    border-color: #dee2e6;
    color: #990000;
}

/* ===== BREADCRUMB STYLES ===== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item a {
    color: #6c757d;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: #CC0000;
}

.breadcrumb-item.active {
    color: #495057;
}

.back-to-news-breadcrumb {
    transition: all 0.2s ease;
}

.back-to-news-breadcrumb:hover {
    color: #CC0000 !important;
    transform: translateX(-2px);
}

.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}

hr {
    margin: 30px 0;
    border-top: 1px solid #e0e0e0;
}

/* ===== IMAGE LOADING STATES ===== */
.image-loading-placeholder {
    background: #f8f9fa;
    transition: opacity 0.3s ease;
}

.novedades-image-detalle.loaded,
.novedades-image-related.loaded {
    opacity: 1 !important;
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-icon {
    color: #1a5276;
    font-size: 2rem;
}

/* ===== Z-INDEX FIXES ===== */
.navbar-light.bg-light {
    position: relative;
    z-index: 2000 !important;
}

.navbar-nav.ms-auto {
    position: relative;
    z-index: 2001 !important;
}

.navbar-nav .form-select {
    position: relative;
    z-index: 2002 !important;
}

.col-md-10 { position: relative; z-index: 1; }
.col-md-2 { position: relative; z-index: 50; }

.navbar,
.navbar-collapse {
    overflow: visible !important;
}

.dropdown-menu {
    z-index: 2003 !important;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fadeInDown {
    animation: fadeInDown 0.8s ease;
}

.animation-delay2 { animation-delay: 0.2s; }

.related-card:nth-child(1) { animation-delay: 0.1s; }
.related-card:nth-child(2) { animation-delay: 0.2s; }
.related-card:nth-child(3) { animation-delay: 0.3s; }

/* ===== FIX FLEX-GROW-1 WHITESPACE ISSUE ===== */
.card-text.text-muted.mb-3.flex-grow-1 {
    margin-bottom: 0.5rem !important; /* Reduce from mb-3 (1rem) to mb-2 (0.5rem) */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-text.text-muted.mb-3.flex-grow-1 p {
    margin-bottom: 0 !important;
    flex-grow: 1;
}

/* Alternative: Remove mb-3 entirely */
.card-text.text-muted.flex-grow-1 {
    margin-bottom: 0.25rem !important;
}

.card-text.text-muted.flex-grow-1 p {
    margin-bottom: 0 !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1199.98px) {
    .novedad-detalle-section,
    .novedades-section {
        padding: 2rem 0;
    }
    
    .bg-light.py-5 {
        padding: 2rem 0 !important;
    }
    
    .wrapper-container {
        max-width: 1140px;
    }
    
    .novedades-item {
        padding: 30px;
    }
}

@media (max-width: 991.98px) {
    .card-img-top-container { height: 180px; }
    .card-img-top-container-detalle { height: 350px; }
    
    .card-title-detalle {
        font-size: 1.8rem;
    }
    
    .sidebar-sticky {
        position: relative;
        top: 0;
    }
    
    .sidebar-sticky .card {
        margin-top: 2rem;
    }
    
    .section-title h1 {
        font-size: 1.8rem;
    }
    
    .calendar-widget {
        margin-top: 30px;
    }
    
    .novedades-item {
        padding: 15px;
    }
    
    .novedades-item h3 {
        font-size: 1.3rem;
    }
    
    .navbar-nav .form-select {
        z-index: 2002 !important;
    }
    
    .calendar-widget {
        z-index: 100 !important;
    }
    
    .calendar-year-header .btn {
        padding: 0.875rem 1.25rem;
    }
    
    .calendar-month-link {
        padding: 0.625rem 1.25rem;
    }
}

@media (max-width: 767.98px) {
    .novedad-detalle-section,
    .novedades-section {
        padding: 1.5rem 0;
    }
    
    .bg-light.py-5 {
        padding: 1.5rem 0 !important;
    }
    
    .card-img-top-container { height: 160px; }
    .card-img-top-container-detalle { height: 250px; }
    
    .card-title-detalle { font-size: 1.6rem; }
    .novedad-content { font-size: 1rem; }
    
    .novedad-actions {
        flex-direction: column;
        gap: 1rem;
    }
    
    .social-share {
        align-self: flex-start;
        text-align: center;
    }
    
    .date-badge {
        top: 10px;
        right: 10px; /* CHANGED: from left to right */
        left: auto; /* ADDED */
        padding: 8px;
    }
    
    .date-badge-detalle {
        top: 10px;
        right: 10px; /* CHANGED: from left to right */
        left: auto; /* ADDED */
        padding: 8px;
    }
    
    .date-badge .date-day { font-size: 1.2rem; }
    .date-badge-detalle .date-day { font-size: 1.4rem; }

    .date-badge-detalle {
        padding: 10px;
        min-width: 70px;
    }
    
    .date-badge-detalle .date-day { font-size: 1.5rem; }
    .date-badge-detalle .date-month { font-size: 0.8rem; }
    .date-badge-detalle .date-year { font-size: 0.7rem; }
    
    .card-img-top-container-detalle { height: 300px; }
    .news-content { font-size: 1rem; line-height: 1.7; }
    
    .d-flex.justify-content-between.align-items-start.mb-4,
    .mt-5.pt-4.border-top .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .social-share {
        align-self: flex-start;
    }
    
    .calendar-year-header .btn {
        padding: 0.75rem 1rem;
    }
    
    .calendar-month-link {
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 575.98px) {
    .card-img-top-container-detalle { height: 200px; }
    
    .date-badge-detalle {
        top: 10px;
        right: 10px; /* CHANGED: from left to right */
        left: auto; /* ADDED */
        padding: 6px;
    }
    
    .date-badge-detalle .date-day { font-size: 1.2rem; }
    .date-badge-detalle .date-month { font-size: 0.7rem; }
    .date-badge-detalle .date-year { font-size: 0.6rem; }
    
    .card-title-detalle { font-size: 1.4rem; }
    .section-title h1 { font-size: 1.6rem; }
    .section-title h1 span { font-size: 1rem; }
    
    .novedades-item {
        padding: 12px;
        margin-bottom: 30px;
    }
    
    .novedades-item h3 { font-size: 1.2rem; }
    
    .col-md-10, .col-md-2 {
        padding: 0 10px;
    }
    
    .wrapper-container {
        padding: 0 10px;
    }
}
