@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;500;700;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

:root {
    color-scheme: light only;
}

body {
    background: #ffffff !important;
    color: #333 !important;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    width: 100vw;
}

.header {
    background: #ffffff !important;
    color: #3a3171 !important;
    padding: 2vh 4vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 10;
    height: 12vh;
}

.header-logo img {
    height: 8vh;
    object-fit: contain;
}

.header-title {
    font-size: 4vh;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
    text-align: center;
    flex: 1;
}

.header-time {
    font-size: 4vh !important;
    font-weight: 500;
}

.main-content {
    flex: 1;
    padding: 2vh 2vw; /* Reducido para dar espacio a 3 tarjetas */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 88vh;
}

/* Category Title for Cycle */
.category-title {
    text-align: center;
    font-size: 5vh;
    font-weight: 800;
    color: #f37630 !important;
    margin-bottom: 2vh;
    text-transform: uppercase;
    animation: fadeIn 0.5s ease-in-out;
}

/* Match Grid */
.match-grid {
    display: grid;
    /* Forzar 3 tarjetas por fila siempre */
    grid-template-columns: repeat(3, 1fr);
    gap: 2vw;
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow-y: auto;
    padding-bottom: 2vh;
    align-content: start;
}

.match-card {
    background: #ffffff !important;
    border: 2px solid #d9dadd !important;
    border-radius: 16px;
    padding: 2vh 1.5vw;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    height: 100%;
}

.match-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background: linear-gradient(90deg, #3a3171, #78aa42) !important;
}

/* Live Badge (ahora dice el Set) */
.live-badge {
    position: absolute;
    top: 1.5vh;
    right: 1.5vw;
    background: #e63946 !important;
    color: #ffffff !important;
    padding: 0.5vh 1vw;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.8vh;
    display: flex;
    align-items: center;
    gap: 0.5vw;
    animation: pulse 2s infinite;
}
.live-badge .dot {
    width: 1.2vh;
    height: 1.2vh;
    background: #ffffff !important;
    border-radius: 50%;
}

.match-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5vh;
    font-size: 2vh;
    color: #666 !important;
    font-weight: 500;
}

.cancha-name {
    color: #78aa42 !important; /* Verde */
    font-weight: 800;
    text-transform: uppercase;
    font-size: 2.5vh;
}
.fase-name {
    font-weight: 700;
    color: #f37630 !important;
    font-size: 1.8vh;
    text-transform: uppercase;
}

.teams-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.team {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    text-align: center;
    width: 30%;
}

.team-logo {
    width: 12vh; /* Reducido para 3 columnas */
    height: 12vh;
    object-fit: contain;
    margin-bottom: 1vh;
    border-radius: 50%;
    background: #f0f2f5 !important;
    padding: 1vh;
    border: 2px solid #d9dadd !important;
}

.team-name {
    font-size: 2.5vh; /* Ajustado */
    font-weight: 700;
    color: #333 !important;
    width: 100%;
    /* Truco para forzar siempre 2 líneas de altura */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 6vh; /* Altura fija para 2 líneas */
    line-height: 3vh;
    word-wrap: break-word;
}

.score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40%;
}

.sets-won {
    font-size: 2.2vh;
    font-weight: 800;
    color: #ffffff !important;
    background: #3a3171 !important;
    padding: 0.5vh 1.5vw;
    border-radius: 20px;
    margin-bottom: 0.5vh;
    letter-spacing: 1px;
}

.main-score {
    font-size: 8vh; /* Puntos del set actual */
    font-weight: 800;
    color: #3a3171 !important; /* Morado */
    display: flex;
    align-items: center;
    gap: 1.5vw;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.05);
}

.score-separator {
    color: #d9dadd !important;
}

.sets-container {
    display: flex;
    gap: 0.8vw;
    margin-top: 0.5vh;
}

.set-score {
    background: #f0f2f5 !important;
    padding: 0.4vh 0.8vw;
    border-radius: 8px;
    font-size: 2vh;
    font-weight: 700;
    color: #666 !important;
    border: 2px solid #d9dadd !important;
}

.set-score.active-set {
    background: #f37630 !important; /* Naranja */
    color: #ffffff !important;
    border-color: #f37630 !important;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(5vh); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 1vh rgba(230, 57, 70, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}

.no-matches {
    text-align: center;
    font-size: 5vh;
    color: #666 !important;
    margin-top: 15vh;
    font-weight: 500;
}

/* --- LIVE TV REDESIGN --- */
.live-tv-body {
    position: relative;
    background: #000000 !important;
}

#video-bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: #000;
    overflow: hidden;
}

#video-bg-container iframe {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw; /* 16:9 ratio */
    min-height: 100vh;
    min-width: 177.77vh; /* 16:9 ratio */
    transform: translate(-50%, -50%);
    pointer-events: none;
    border: none;
}

.ui-overlay {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.translucent-header {
    background: linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0)) !important;
    box-shadow: none !important;
    border: none !important;
}

.overlay-content {
    width: 26vw; /* Ligeramente más ancho para darle respiro */
    padding-left: 3vw;
    padding-top: 2vh;
}

.match-grid-vertical {
    display: flex;
    flex-direction: column;
    gap: 2vh;
    height: 100%;
    overflow-y: hidden;
}

.match-grid-vertical .match-card {
    height: auto;
    padding: 2vh 1.5vw;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 16px;
}
.match-grid-vertical .team-logo {
    width: 7vh;
    height: 7vh;
    margin-bottom: 0.8vh;
}
.match-grid-vertical .team-name {
    font-size: 1.5vh;
    height: auto;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.match-grid-vertical .main-score {
    font-size: 4.5vh;
    gap: 1vw; /* Reduce el espacio entre puntos */
}
.match-grid-vertical .sets-won {
    font-size: 1.3vh;
    padding: 0.4vh 1vw;
    margin-bottom: 0.8vh;
    letter-spacing: 0.5px;
}
.match-grid-vertical .cancha-name {
    font-size: 1.8vh;
    margin-bottom: 0.3vh;
}
.match-grid-vertical .fase-name {
    font-size: 1.4vh;
}
.match-grid-vertical .sets-container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.5vw;
    margin-top: 1vh;
}
.match-grid-vertical .set-score {
    white-space: nowrap;
    padding: 0.3vh 0.6vw;
    font-size: 1.5vh;
}
