/* Variables CSS */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --text-color: #333;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --border-color: #dee2e6;
    --hover-overlay-bg: rgba(0, 0, 0, 0.7);
    --youtube-color: #FF0000;
    --instagram-text-color: #262626;
}

/* Base y tipografía */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    margin-top: 75px;
    font-weight: 600;
}

/* Contenedor principal de noticias */
.news-container {
    margin: 20px auto;
    padding: 0 15px;
}

/* Grid de noticias */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); /* Adjusted for better responsiveness */
    gap: 5px;
    justify-content: center;
}

/* Estilos de cada post de noticia (outer container for carousel) */
.news-post {
    border: 1px solid #8899A6;
    border-radius: 2px;
    overflow: hidden; /* Important for carousel boundaries */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    display: flex; /* Flex container for carousel and controls */
    flex-direction: column;
    box-sizing: border-box;
    height: 260px; /* Fixed height for the entire news post */
    width: 330px;
    max-width: 330px;
    min-width: 330px;
    position: relative; /* For absolute positioning of dots and counter */
}

.news-post:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* --- NEW: Story Carousel Styles --- */
.news-story-carousel {
    display: flex;
    overflow-x: scroll; /* Enable horizontal scrolling */
    scroll-snap-type: x mandatory; /* Snap to full items */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    height: 100%; /* Fill the entire height of the news-post */
    width: 100%;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar for Webkit browsers (Chrome, Safari) */
.news-story-carousel::-webkit-scrollbar {
    display: none;
}

.news-story-item {
    flex-shrink: 0; /* Prevent items from shrinking */
    width: 100%; /* Each item takes full width of the carousel */
    height: 100%; /* Each item takes full height of the carousel */
    scroll-snap-align: start; /* Snap to the start of each item */
    display: flex; /* Use flexbox for inner layout */
    flex-direction: column; /* Stack contents vertically */
    box-sizing: border-box;
    /* Styles below apply to each item within the carousel,
       retaining the original article's inner layout */
}

/* --- Story Controls (Dots and Counter) --- */
.story-dots-container {
    position: absolute;
    bottom: 5px; /* Position above footer if needed, adjust as desired */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 15; /* Ensure dots are above the content */
}

.story-dot {
    width: 6px; /* Size of the dot */
    height: 6px;
    background-color: blue;
    border-radius: 50%; /* Make it round */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.story-dot.active-dot {
    background-color: red; 
}

.story-counter {
    position: absolute;
    top: 1px; 
    right: 1px;
    background-color: rgba(0, 0, 0, 0.7); 
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    z-index: 1; 
    opacity: 0.7;
}

.story-date {
    position: absolute;
    top: 1px; 
    left: 1px;
    background-color: rgba(0, 0, 0, 0.7); 
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    z-index: 1; 
    opacity: 0.5;
}

/* --- Original Styles (Adjusted for carousel structure if necessary) --- */
/* The key is that .news-story-item now replaces the role of .news-post
   for its internal layout, inheriting its dimensions. */

.post-image-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    /* These heights were originally for the entire news-post.
       Now they define the image area within the 260px slide.
       Retaining the original values to preserve the visual overlap effect. */
    max-height: 260px;
    min-height: 260px;
    height: 260px;
    margin-bottom: -310px; /* This negative margin causes text to overlap the image */
    overflow: hidden; /* Ensure image doesn't spill out */
}

.post-image {
    width: auto;
    height: 100%;
    object-fit: contain; /* Keeps image aspect ratio, fits within bounds */
    display: block;
    transition: transform 0.3s ease-in-out;
    object-position: top;
}

.image-zoom-link:hover .post-image {
    transform: none;
}

.post-image-overlay {
    position: absolute;
    bottom: 21px;
    left: 0;
    right: 0;
    background: var(--hover-overlay-bg);
    color: white;
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    min-height: 20%;
}

.post-image-wrapper:hover .post-image-overlay {
    opacity: 2;
    visibility: visible;
    z-index:11;
}

.post-image-overlay .post-title {
    margin: 0;
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
}

.post-image-overlay .post-title a {
    color: inherit;
    text-decoration: none;
}

.post-image-overlay .post-title a:hover {
    text-decoration: underline;
}

.post-meta-text {
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--instagram-text-color);
    padding: 3px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    margin-top: auto; /* Pushes content to the bottom of its flex container (news-story-item) */
    background: wheat;
    z-index: 1;
    opacity: 0.79;
    border-radius: 2px;
    margin-left: 30px;
    margin-right: 30px;
}
.post-meta-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 5px;
    background-color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    color: var(--secondary-color);
    letter-spacing: 0.5px;
    z-index: 0;
    height: 20px;
}

.post-meta-footer div {
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.footer-medio {
    max-width: 200px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: -15px; /* Adjust if needed due to new layout */
}

.footer-tema {
    max-width: 200px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top:    0px;
}

.footer-fecha {
    max-width: 100px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.6rem;
    color: black;
    margin-top: 20px;
}

.no-results {
    text-align: center;
    padding: 40px;
    font-size: 1.2rem;
    color: var(--secondary-color);
    grid-column: 1 / -1;
}

.pagination-nav {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    padding-bottom: 30px;
}

.pagination-list {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-item:not(:last-child) {
    margin-right: 15px;
}

.pagination-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.2s ease-in-out;
    font-weight: 500;
}

.pagination-link:hover {
    background-color: darken(var(--primary-color), 10%);
    color: white;
    text-decoration: none;
}

.pagination-link i {
    margin: 0 5px;
}

#imageModal .modal-dialog {
    max-width: 90%;
    height: 90vh;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal .modal-content {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

#imageModal #imgMoodal {
    max-width: 100%;
    max-height: 100%;
    height: auto;
    width: auto;
    display: block;
    object-fit: contain;
    background-color: rgba(0, 0, 0, 0.8);
    border-radius: 8px;
    padding: 5px;
}

.floatright{
   float:right;
}
.floatleft{
   float:left;
}

.post::first-letter {
    text-transform: uppercase;
}

.post-title::first-letter {
    text-transform: uppercase;
}

.video-container {
    z-index:99;
    /* Position relative to .news-story-item */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: black; /* Background for the video container */
    display: flex;
    justify-content: center;
    align-items: center;
}
.video-container iframe {
    width: 100%;
    height: 100%;
}
.video-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10; /* Ensure button is above iframe */
    background-color: red;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
	z-index:99;
}


.main-footer {
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
    padding: 0 0;
	}	

.main-header {
    background-color: white;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 5px 0;
}

.logo {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--text-dark);
    text-decoration: none;
}

.favico{
    margin-right: 5px;
    max-height: 20px;
    margin-top: 9px;

}

.chkSelected {
    color: #28a745;
    transform: scale(1.2);
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

table,
thead,
tbody,
tfoot,
tr,
td,
th {
  border: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
  text-align: left!important;
}

.modal-body, .modal-header, .modal-footer  {
  border: none !important;
  border-width: 0 !important;
  border-style: none !important;
  border-color: transparent !important;
}

th {
text-align: center;
background: aliceblue;
}

/* Media Queries para responsividad */
/* Pantallas muy pequeñas (ej. móviles en vertical) */

@media (max-width: 575.98px) {
    .news-grid {
        grid-template-columns: 1fr;
    }
    .news-post {
        margin: 0 auto;
        max-width: 100%!important;
        min-width: 100%!important;

    }
    .post-header-instagram {
        flex-wrap: wrap; /* Permite que los elementos de la cabecera se envuelvan */
        padding: 8px 12px; /* Reducir padding en móviles */
    }
    .post-source-info {
        flex-grow: 1; /* Permite que la info del medio ocupe el espacio */
    }
    .post-video-link-instagram {
        margin-left: 10px; /* Mantiene un espacio claro */
    }

    .news-container {
        margin: 0px auto;
        padding: 0px 0px;
    }

  	.post-meta-text {
    	font-size: 1rem!important; /* Tamaño para PC */
  	}
}

#murosModal table tbody tr:hover {
	background-color: rgba(0, 123, 255, 0.1);
	cursor: pointer;
}
#murosModal table tbody tr.active-row {
	background-color: rgba(0, 123, 255, 0.2);
}
#murosModal table tbody tr.active-row {
	background-color: rgba(0, 123, 255, 0.2);
}


#scrollButtonDown {
	top: 75%;
	right: 20px;
	width: 50%;
	height: 100%;
	background-color: #007BFF;
	color: white;
	border: none;
	cursor: pointer;
	justify-content: center;
	align-items: center;
	font-size: 24px;
	z-index: 99;
	opacity: 0.5;
	float: right;		
}


#scrollButtonDown:hover {
   background-color: #0056b3;
}	
#scrollButtonUp {
top: 75%;
right: 20px;
width: 50%;
height: 100%;
background-color: #FF007B;
color: white;
border: none;
cursor: pointer;
justify-content: centexr;
align-items: center;
font-size: 24px;
z-index: 99;
opacity: 0.5;	
}

#scrollButtonUp:hover {
	background-color: #b3005f;
}	
    
.scroll-button-left, .scroll-button-right {
	position: absolute;
    top: 118px;
    height: 238px;
    transform: translateY(-50%);
    width: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0.4;
}

.scroll-button-left {
    left: 0px;
}

.scroll-button-right {
    right: 0px;
}

.scroll-button-left i, .scroll-button-right i {
    color: white;
    font-size: 20px;
}

.input-container {
	position: relative;
	display: inline-flex;
	align-items: center;
	width: 100%;
	max-width: 300px;
}
#q {
	padding-left: 30px; /* Espacio para el botón */
	width: 100%;
}
.clear-btn {
	position: absolute;
	left: 8px;
	background: none;
	border: none;
	cursor: pointer;
	color: #999;
	font-size: 16px;
	display: none; /* Oculto por defecto */
}
.clear-btn:hover {
	color: #333;
}
        