body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    color: #333;
    overflow-x: hidden; /* Prevent horizontal scroll from touch swiping */
}

.header {
    background-color:   #f4f4f4;
    color: #333;
    padding: 5px 20px;
    text-align: center;
    border-bottom: 2px solid #777;
    position: sticky;
    top: 0;
    z-index: 100;
    display:_none;
}

.header h1 {
    margin: 0 0 10px 0;
    font-size: 2em;
}

.date-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    font-size: 1.1em;
}

.nav-date-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
	float:left;
}
.nav-date-btn:hover {
    background-color: #0056b3;
}
.nav-date-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.current-date-info {
    font-weight: bold;
	float:left;
	margin: 7px;
}

/* Scroll Buttons (global) */
.scroll-buttons-container {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.scroll-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 15px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.2em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background-color 0.3s ease;
}

.scroll-button:hover, .scroll-button:active {
    background-color: #0056b3;
}

/* Grid Container for Tiles */
#grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 300px)); 
    gap: 20px;
    padding: 20px;
    max-width: none;
    margin: 20px auto;
}

/* News Tile (Card) Styling */
.news-tile {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden; /* To contain floated/positioned children */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative; /* For absolutely positioned elements inside */
    display: flex;
    flex-direction: column;
    cursor: grab; /* Indicates interactive element */
}

/* Header within each tile */
.tile-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 0.9em;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    box-sizing: border-box;
}
.tile-header .tile-date {
    background-color: #007bff;
    padding: 3px 3px;
    border-radius: 3px;
    font-size: 0.7em;
    opacity: 0.7;
}
.tile-header .tile-category {
    background-color: #007bff;
    padding: 3px 8px;
    border-radius: 3px;
}


/* Image container for arrows */
.tile-image-container {
    position: relative;
    width: 100%;
    /* Use padding-bottom for aspect ratio, e.g., 56.25% for 16:9 */
    padding-bottom: 65%; /* Adjust as needed for image aspect ratio */
    overflow: hidden;
    background-color: #eee; /* Placeholder background */
    display: flex; /* For centering loading icon */
    justify-content: center;
    align-items: center;
}

.tile-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* or cover for cropping */
}

/* Navigation arrows inside the tile */
.tile-nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 1.5em;
    z-index: 10; /* Above image */
    border-radius: 5px;
    transition: background-color 0.2s ease;
}
.tile-nav-arrow:hover {
    background-color: rgba(0, 0, 0, 0.7);
}
.tile-nav-arrow.left { left: 5px; }
.tile-nav-arrow.right { right: 5px; }
.tile-nav-arrow:disabled {
    background-color: rgba(0, 0, 0, 0.2);
    cursor: not-allowed;
}

/* Title overlay below image */
.tile-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0));
    color: white;
    padding: 15px 10px 5px;
    font-size: 1.1em;
    font-weight: bold;
    box-sizing: border-box;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
    line-height: 1.3;
}

/* Footer within each tile */
.tile-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
    margin-top: auto; 
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
}

.tile-media-info {
    display: flex;
    align-items: center;
    gap: 5px;
}
.tile-media-info .favicon {
    height: 18px;
    width: 18px;
    object-fit: contain;
    vertical-align: middle;
}
.tile-media-info .media-title {
    font-size: 0.5em;
    color: #555;
    font-weight: bold;
}
/* Link at bottom-left (urlv) */
.tile-bottom-left-link {
    font-size: 1.2em;
    color: #c00; 
    text-decoration: none;
    margin-left: auto; 
}
.tile-bottom-left-link:hover {
    color: #e00;
}


/* Pagination dots */
.pagination-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin: 5px 0;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255,255,255,0.7);
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 5;
}
.dot {
    width: 8px;
    height: 8px;
    background-color: #777; 
    border-radius: 50%;
    transition: background-color 0.2s ease;
}
.dot.active {
    background-color: #007bff; 
    border: 1px solid #0056b3;
}

.dot.active-red {
    background-color: #dc3545; 
    border: 1px solid #c82333;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
    display: none;
}
.spinner.show {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    #grid-container {
        grid-template-columns: 1fr;
        padding: 10px;
        margin: 10px auto;
    }
    .scroll-buttons-container {
        right: 10px;
        top: auto;
        bottom: 10px;
        transform: translateY(0);
        flex-direction: row;
        width: calc(100% - 20px);
        justify-content: center;
    }
    .scroll-button {
        padding: 10px;
        font-size: 1em;
    }
}	

/* Efecto de cortina circular expandiéndose desde el centro */
.tile-loading-stela {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle,
        rgba(245, 240, 235, 0.9) 0%,
        rgba(160, 140, 120, 0.7) 30%,
        rgba(120, 105, 90, 0.5) 60%,
        rgba(100, 90, 80, 0.2) 80%,
        transparent 100%
    );
    opacity: 0;
    z-index: 20;
    border-radius: 50%;
    animation: stela-move 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    pointer-events: none;
    box-shadow: 0 0 40px rgba(0, 195, 255, 0.3);
}

@keyframes stela-move {
    0% { 
        width: 0;
        height: 0;
        opacity: 0;
    }
    20% {
        width: 60px;
        height: 60px;
        opacity: 0.8;
    }
    60% {
        width: 300%;
        height: 300%;
        opacity: 0.9;
    }
    100% { 
        width: 400%;
        height: 400%;
        opacity: 0;
    }
}

/* Desenfoque temporal de la imagen */
.tile-image.loading-blur {
    filter: blur(3px) brightness(1.1) saturate(1.2);
    transition: filter 0.6s ease-in-out;
}


/* iframe  youtube para mostrar urlv */
.tile-iframe-viewer {
    position: fixed;
    left: 0;
    top: 0px;
    /*transform: translateY(-50%);*/
    width: 100vw;
    height: 70vh;
    z-index: 9999;
    box-shadow: 0 4px 32px rgba(0,0,0,0.7);
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
}
@media (max-width: 768px) {
	.tile-iframe-viewer {
		height: 286px!important;
	}
}
.viewer-close-btn {
    position: absolute;
    top: 16px;
    right: 24px;
    z-index: 10001;
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.2em;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tile-iframe {
    width: 100%;
    height: 100%;
    border: none;
}