/**
 * @package     Joomla.Site
 * @subpackage  mod_news_ticker
 * 
 * News Ticker - Versión Ancho Completo
 */

:root {
    --ticker-primary: #c62828;
    --ticker-secondary: #2c3e50;
    --ticker-bg: #ffffff;
    --ticker-text: #333333;
    --ticker-border: #e0e0e0;
    --ticker-shadow: rgba(0, 0, 0, 0.1);
    --ticker-hover: #c62828;
}

/* Contenedor principal - ANCHO COMPLETO */
.news-ticker-container {
    background: var(--ticker-bg);
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 2px 8px var(--ticker-shadow);
    border: 1px solid var(--ticker-border);
    overflow: hidden;
    display: flex;
    align-items: center;
    width: 100%; /* Forzar ancho completo */
    box-sizing: border-box;
}

/* Sección del título - TAMAÑO FIJO */
.news-ticker-title-section {
    background: var(--ticker-primary);
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0; /* Evitar que se encoja */
    min-width: 160px; /* Ancho mínimo fijo */
}

.news-ticker-title-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-ticker-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    margin-left: 8px;
    font-weight: 600;
}

/* Sección del contenido - OCUPA EL RESTO */
.news-ticker-content-section {
    flex: 1; /* Ocupa todo el espacio disponible */
    padding: 0 20px;
    display: flex;
    align-items: center;
    overflow: hidden;
    position: relative;
    min-width: 0; /* Importante para flexbox */
    background: var(--ticker-bg);
    height: 100%;
}

/* Efectos de desvanecimiento en los bordes */
.news-ticker-content-section::before,
.news-ticker-content-section::after {
    content: '';
    position: absolute;
    top: 0;
    width: 40px;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.news-ticker-content-section::before {
    left: 0;
    background: linear-gradient(90deg, var(--ticker-bg), transparent);
}

.news-ticker-content-section::after {
    right: 0;
    background: linear-gradient(270deg, var(--ticker-bg), transparent);
}

/* Viewport del ticker */
.news-ticker-viewport {
    overflow: hidden;
    width: 100%;
}

/* Contenido del ticker */
.news-ticker-content {
    display: flex;
    align-items: center;
    gap: 30px;
    white-space: nowrap;
    animation: tickerScroll 25s linear infinite;
    padding: 12px 0;
    will-change: transform;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Items del ticker */
.news-ticker-item {
    color: var(--ticker-text);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
    padding: 4px 0;
    position: relative;
    line-height: 1.4;
}

.news-ticker-item:hover {
    color: var(--ticker-hover);
}

/* Línea decorativa en hover */
.news-ticker-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--ticker-hover);
    transition: width 0.2s ease;
}

.news-ticker-item:hover::after {
    width: 100%;
}

/* Separador */
.news-ticker-separator {
    color: var(--ticker-primary);
    font-size: 1.2rem;
    font-weight: bold;
    opacity: 0.3;
    display: inline-block;
    transform: scale(1.5);
}

/* Estado pausado */
.news-ticker-container.paused .news-ticker-content {
    animation-play-state: paused;
}

.news-ticker-container.paused .news-ticker-title-section {
    opacity: 0.9;
}

/* Tooltip mejorado */
.news-ticker-item[title] {
    position: relative;
    cursor: pointer;
}

.news-ticker-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ticker-secondary);
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border-left: 3px solid var(--ticker-primary);
    font-weight: normal;
    pointer-events: none;
}

.news-ticker-item[title]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--ticker-secondary);
    margin-bottom: 2px;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 992px) {
    .news-ticker-title-section {
        padding: 10px 20px;
        min-width: 140px;
        font-size: 0.9rem;
    }
    
    .news-ticker-item {
        font-size: 0.9rem;
    }
    
    .news-ticker-content {
        gap: 25px;
    }
}

@media (max-width: 768px) {
    .news-ticker-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .news-ticker-title-section {
        width: 100%;
        justify-content: center;
        padding: 10px 15px;
        min-width: auto;
    }
    
    .news-ticker-content-section {
        padding: 8px 15px;
    }
    
    .news-ticker-content {
        gap: 20px;
        animation-duration: 30s;
        padding: 8px 0;
    }
    
    .news-ticker-item {
        font-size: 0.85rem;
        max-width: 300px;
    }
    
    .news-ticker-item[title]:hover::after {
        white-space: normal;
        max-width: 250px;
    }
}

@media (max-width: 480px) {
    .news-ticker-title-section {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .news-ticker-title-icon {
        font-size: 1rem;
    }
    
    .news-ticker-content {
        gap: 15px;
        animation-duration: 25s;
    }
    
    .news-ticker-item {
        font-size: 0.8rem;
        max-width: 200px;
    }
    
    .news-ticker-separator {
        font-size: 1rem;
    }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
    :root {
        --ticker-primary: #ef5350;
        --ticker-secondary: #37474f;
        --ticker-bg: #263238;
        --ticker-text: #eceff1;
        --ticker-border: #455a64;
        --ticker-shadow: rgba(0, 0, 0, 0.5);
        --ticker-hover: #ef5350;
    }
    
    .news-ticker-item:hover {
        color: #ff8a80;
    }
    
    .news-ticker-item::after {
        background: #ef5350;
    }
}

/* Animación de entrada */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-ticker-container {
    animation: slideIn 0.3s ease-out;
}