/* style.css - CÓDIGO COMPLETO Y FINAL */

/* --- Variables y Estilos Base --- */
:root {
    --color-fondo: #f4f4f9;
    --color-primario: #007bff;
    --color-secundario: #4CAF50; 
    --color-resaltado: #FFB347; 
    --color-texto: #333;
    --color-tabla-encabezado: #2c3e50;
    --color-wsp: #25D366; 
}

body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    font-size: 16px; 
}

.contenedor {
    max-width: 1000px; 
    margin: 10px auto; 
    padding: 15px; 
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* --- Header y Títulos --- */
.header {
    text-align: center;
    margin-bottom: 20px;
}
.header img {
    width: 80px; 
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--color-resaltado);
    margin-bottom: 10px;
    object-fit: cover;
}
h1 {
    font-size: 1.5em; 
    color: var(--color-tabla-encabezado);
    border-bottom: 3px solid var(--color-resaltado);
    padding-bottom: 8px;
}
h2 {
    font-size: 1.3em;
    color: var(--color-primario);
    margin-top: 20px;
}

/* --- ENLACE DE ADMINISTRACIÓN (DISCRETO) --- */
.info-link-admin {
    display: flex; 
    justify-content: flex-end; 
    align-items: center;
    font-size: 0.9em;
    padding-bottom: 10px;
    width: 100%;
}

.info-link-admin p {
    display: none; 
}

.admin-link {
    font-size: 0.9em;
    color: #cccccc; 
    text-decoration: none;
    transition: color 0.2s;
    font-weight: bold;
    white-space: nowrap; 
    position: relative;
    top: -5px; 
    right: 5px;
}

.admin-link:hover {
    color: var(--color-primario); 
    text-decoration: underline;
}

/* ------------------------------------------------------------------- */
/* --- RANKING BASADO EN TARJETAS (SECCIÓN CORREGIDA Y FINAL) --- */
/* ------------------------------------------------------------------- */

.table-responsive {
    overflow: visible; 
}

#tabla-ranking thead {
    display: none; 
}

#tabla-ranking {
    width: 100%; 
    border-collapse: separate;
    border-spacing: 0 10px; 
}

/* CRÍTICO 1: Asegura que la celda TD sea flex y se estire */
#tabla-ranking tbody td {
    border: none !important; 
    padding: 0 !important; 
    display: flex; 
    align-items: stretch;
    width: 100%; /* Asegura que ocupe todo el ancho de la TR */
}

#tabla-ranking tbody tr.ranking-card {
    display: flex; 
    align-items: stretch; 
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: white;
    overflow: hidden; 
    width: 100%; /* Asegura que la fila ocupe todo el ancho disponible */
}

#tabla-ranking tbody tr:first-child { 
    border: 2px solid var(--color-resaltado); 
}

.card-ranking-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px; 
    min-width: 70px;
    /* Eliminamos padding-right aquí */
    padding: 10px 0; 
    font-size: 1.6em; 
    font-weight: bold;
    color: white; 
    background-color: var(--color-primario); 
    border-right: 1px solid #eee;
}

#tabla-ranking tbody tr:first-child .card-ranking-number {
    background-color: var(--color-resaltado);
    color: var(--color-tabla-encabezado);
}

/* CRÍTICO 2: El contenedor de datos debe expandirse y apilar su contenido */
.card-data-container {
    display: flex; 
    flex-direction: column; 
    flex-grow: 1; /* CLAVE: Permite que este contenedor use todo el espacio restante */
    padding: 10px 25px 10px 25px; /* Ajustamos el padding para el espacio interno */
    line-height: 1.3;
}

.card-pareja-nombre {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--color-tabla-encabezado);
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-left: 0; /* Asegura el inicio pegado al borde izquierdo del contenedor */
}

.card-resultados-row {
    display: grid;
    /* Ajustamos el grid para mejor distribución en general */
    grid-template-columns: repeat(4, auto) 1fr; 
    gap: 15px; 
    font-size: 0.9em;
    text-align: center;
    align-items: center;
    padding-left: 0; 
}

.card-resultados-row > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 40px; 
}

.card-resultados-row > div:not(:last-child)::before {
    content: attr(data-label);
    font-weight: normal;
    color: #777;
    font-size: 0.8em; 
    margin-bottom: 2px;
}
.card-resultados-row > div:nth-child(1) { 
    font-weight: bold;
    color: var(--color-primario); 
}

.wsp-btn, #tabla-ranking button {
    background-color: var(--color-wsp);
    color: white !important;
    padding: 6px 8px;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-size: 0.8em; 
    cursor: pointer;
    transition: background-color 0.2s;
    display: block; 
    width: 100%;
    margin: 0;
}

/* --- Media Queries (Desktop) --- */
@media (min-width: 768px) {
    .card-resultados-row {
        gap: 30px; 
        /* 4 columnas de datos y el botón al final */
        grid-template-columns: 1fr 1fr 1fr 1fr 150px; 
        text-align: left;
    }
    .card-resultados-row > div {
        align-items: flex-start;
    }
    .card-resultados-row > div:last-child {
        text-align: right;
        align-items: flex-end;
    }
    .wsp-btn, #tabla-ranking button {
        width: auto; 
    }
}

/* --- Media Queries (Mobile) --- */
@media (max-width: 650px) {
    .card-ranking-number {
        width: 60px; 
        min-width: 60px; 
        font-size: 1.4em;
    }
    .card-data-container {
        padding: 10px; 
    }
    .card-resultados-row {
        /* Datos en 4 columnas */
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        margin-top: 5px;
        padding-bottom: 5px;
        border-bottom: 1px solid #eee;
    }
    .card-resultados-row > div:last-child {
        grid-column: 1 / -1; /* Botón ocupa todo el ancho */
        padding-top: 10px;
    }
}


/* --- ESTILOS DE MODAL (Historial) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.8); 
}
.modal-content {
    background-color: #fefefe;
    margin: 10% auto; 
    padding: 20px;
    width: 95%; 
    max-width: 650px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.close {
    color: #aaa;
    float: right;
    font-size: 30px;
    font-weight: bold;
}
/* Estilos adicionales para lista y tabla de pendientes... */


/* ============================================================= */
/* --- ESTILOS ESPECÍFICOS DE LOGIN Y ADMIN_EDIT --- */
/* ============================================================= */

/* 1. Contenedor de la caja de Login (admin_login.html) */
.login-box {
    max-width: 400px;
    margin: 50px auto; 
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}
.login-box img {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
}
.login-box h1 {
    font-size: 1.4em;
    color: var(--color-tabla-encabezado);
    border-bottom: 2px solid var(--color-primario);
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.login-box input[type="text"],
.login-box input[type="password"] {
    width: 90%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box; 
    font-size: 1em;
}
.login-box button {
    width: 98%;
    padding: 12px;
    background-color: var(--color-primario);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.2s;
}
.login-box button:hover {
    background-color: #0056b3;
}
.admin-footer {
    margin-top: 20px;
    font-size: 0.9em;
}
.admin-footer a {
    color: var(--color-primario);
    text-decoration: none;
}
.admin-footer a:hover {
    text-decoration: underline;
}

/* 2. Ajustes para admin_edit.html (Formulario de Registro) */

/* [MODIFICADO] Regla más robusta para el logo en admin */
.admin-content .logo, 
.admin-content header img {
    width: 120px;       /* Ancho fijo */
    height: auto;       /* Altura automática */
    max-width: 100%;    /* Que no se salga en móviles */
    display: block;   
    margin: 0 auto 20px auto; /* Centrado */
}

.admin-registro-form {
    padding: 0; 
    background: none; 
    box-shadow: none;
}

.form-row-admin {
    display: flex;
    flex-wrap: wrap; 
    gap: 15px; 
    justify-content: space-between;
    align-items: flex-end; 
    padding: 20px;
    background-color: #ecf0f1; 
    border-radius: 8px;
    margin-top: 15px;
}

.form-group-admin {
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    min-width: 150px; 
}

.form-group-admin label {
    font-weight: bold;
    color: var(--color-texto);
    margin-bottom: 5px;
    font-size: 0.9em;
}

.form-group-admin select,
.form-group-admin input[type="date"],
.form-group-admin input[type="time"],
.form-group-admin input[type="text"] {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box; /* Asegura que el padding no rompa el layout */
}


.registro-btn {
    flex-grow: 1;
    min-width: 150px;
    background-color: var(--color-secundario); 
    color: white;
    padding: 12px;
    font-size: 1em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    align-self: flex-end; 
}
.registro-btn:hover {
    background-color: #388e3c;
}

/* Media Query para móvil: apilar elementos */
@media (max-width: 650px) {
    .form-group-admin, .registro-btn {
        flex-basis: 100%; 
    }
}

/* --- 3. Estilos de Navegación de Administración --- */
.admin-nav {
    display: flex;
    flex-wrap: wrap; /* Permite que los botones bajen en móvil */
    justify-content: center;
    gap: 10px; /* Reducir gap para móvil */
    margin-top: 15px;
    padding: 10px 0;
    border-top: 1px solid #ddd;
    border-bottom: 2px solid var(--color-primario);
    background-color: #f9f9f9;
}

.admin-nav button { /* CRÍTICO: CAMBIADO DE 'a' A 'button' */
    /* Reseteo de estilos de botón */
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit; /* Hereda la fuente del body */
    
    /* Estilos de apariencia */
    color: var(--color-tabla-encabezado);
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 0.9em; /* Ligeramente más pequeño */
}

.admin-nav button:hover, .admin-nav button.active { /* CRÍTICO: CAMBIADO DE 'a' A 'button' */
    background-color: var(--color-primario);
    color: white;
}

.admin-footer {
    margin-top: 40px; 
    text-align: center;
    font-size: 0.9em;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}
/* --- Estilos para Botones de WhatsApp Compactos (en Pendientes) --- */
.wsp-btn-compact {
    /* Apariencia de botón */
    background-color: #25D366; /* Verde de WhatsApp */
    color: white;
    border: none;
    border-radius: 5px;
    
    /* Tamaño y alineación */
    padding: 3px 8px; /* Padding más pequeño */
    font-size: 0.75em; /* Tamaño de fuente más pequeño */
    
    /* Esencial para que se vean compactos y en línea */
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    text-decoration: none; /* Quita el subrayado de link */
    white-space: nowrap; 
    
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
}

.wsp-btn-compact:hover {
    background-color: #128C7E; /* Verde más oscuro al pasar el ratón */
    transform: translateY(-1px); 
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}


/* ============================================================= */
/* --- [NUEVO] ESTILOS PARA AGENDA DE PARTIDOS (partidos.html) --- */
/* ============================================================= */

/* Enlace de navegación pública en el header */
.public-nav-link {
    font-size: 1em;
    color: var(--color-primario);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
}
.public-nav-link:hover {
    color: var(--color-secundario);
    text-decoration: underline;
}

/* Contenedor de un grupo de fecha */
.date-group {
    margin-top: 20px; /* Reducido el margen superior */
    text-align: center; /* Centrar la fecha */
}

/* Encabezado de la fecha */
.date-header {
    display: inline-block; /* Para que se ajuste al contenido y se pueda centrar */
    background-color: #e9ecef; /* Un gris más claro */
    color: var(--color-texto);
    padding: 8px 15px;
    border-radius: 20px; /* Bordes más redondeados */
    font-size: 1em;
    font-weight: bold;
    border: none; /* Quitamos el borde inferior */
}

/* Tarjeta para un partido individual - DISEÑO COMPACTO Y CENTRADO */
.match-schedule-card {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 10px; /* Bordes menos redondeados */
    padding: 15px; /* Reducido el padding general */
    margin-top: 15px;
    display: flex;
    flex-direction: column; /* Siempre en columna para diseño compacto */
    gap: 12px; /* Espacio reducido entre elementos */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    align-items: center; /* Centrar todo horizontalmente */
}

/* Contenedor de la información del partido (Jugadores y VS) */
.match-info {
    display: flex;
    flex-direction: row; /* Nombres uno al lado del otro */
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1em; /* Tamaño de fuente normal */
    color: var(--color-texto);
    width: 100%;
}

/* Contenedor de cada pareja */
.pareja-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1; /* Para que ocupen el mismo espacio */
    text-align: center;
}

/* Nombre de la pareja (Apellidos) */
.pareja-name {
    font-weight: normal; /* No negrita */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    white-space: nowrap; /* Evita que el nombre se rompa en dos líneas si es posible */
}

/* Insignia de Ranking - REDUCIDA */
.rank-badge {
    background-color: #FFD700;
    color: #333;
    font-size: 0.7em; /* Mucho más pequeño */
    font-weight: bold;
    padding: 2px 4px; /* Padding mínimo */
    border-radius: 4px; /* Bordes menos redondeados */
    border: 1px solid #e0c200;
    vertical-align: middle;
}

/* Texto "vs" - REDUCIDO */
.vs-text {
    color: #888; /* Color más sutil */
    font-size: 0.9em;
    font-weight: normal; /* No negrita */
    margin: 0;
}

/* Información de Hora y Lugar - COMPACTA Y CENTRADA */
.time-location-info {
    display: flex;
    flex-direction: row; /* En una sola línea */
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 0.9em; /* Fuente más pequeña */
    color: #666;
    width: 100%;
    /* Eliminamos los badges de colores para un diseño más limpio */
}

/* Contenedor de acciones (Botones) - COMPACTO */
.card-actions {
    display: flex;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    justify-content: center;
    padding-top: 0; /* Eliminamos padding superior */
    border-top: none; /* Eliminamos línea divisoria */
}

/* Estilo Base de Botón Moderno - REDUCIDO */
.btn-modern {
    flex: 1; /* Ocupan el mismo ancho */
    max-width: 120px; /* Ancho máximo para que no se estiren demasiado */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 10px; /* Padding reducido */
    border: none;
    border-radius: 8px; /* Radio de borde reducido */
    font-size: 0.85em; /* Fuente más pequeña */
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.1s, box-shadow 0.1s;
    text-decoration: none;
}

.btn-modern:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.btn-invite {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 100%);
}

.btn-edit {
    background: linear-gradient(135deg, #FFB347 0%, #FF9800 100%);
}

/* --- Media Queries para Responsividad --- */

/* Pantallas muy pequeñas (ej. iPhone SE) */
@media (max-width: 400px) {
    .match-info {
        flex-direction: column; /* Nombres uno debajo del otro */
        gap: 5px;
    }
    .vs-text {
        margin: 2px 0;
    }
    .time-location-info {
        flex-direction: column; /* Hora y lugar uno debajo del otro */
        gap: 5px;
    }
}

/* Pantallas de escritorio (Ajustes mínimos, ya que el diseño es compacto por defecto) */
@media (min-width: 768px) {
    .match-schedule-card {
        padding: 20px; /* Un poco más de padding en escritorio */
    }
    .btn-modern {
        max-width: 140px; /* Botones ligeramente más anchos */
        font-size: 0.9em;
        padding: 10px 15px;
    }
}

/* --- MEJORAS VISUALES PARA ADMIN_PARTIDOS --- */

/* Contenedor de la tabla */
.admin-table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 20px;
    margin-top: 20px;
}

/* Estilo general de la tabla */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.admin-table thead th {
    background-color: var(--color-tabla-encabezado);
    color: white;
    padding: 15px;
    text-align: center; /* Centrar encabezados */
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
}

.admin-table tbody td {
    padding: 15px 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle; /* Centrar verticalmente */
    text-align: center;     /* Centrar contenido */
    color: #555;
}

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Estilo específico para la columna de Equipos (VS) */
.match-teams {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--color-texto);
}

.team-name {
    font-size: 1em;
}

.vs-badge {
    background-color: #eee;
    color: #777;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    margin: 4px 0;
}

/* Badges para Fecha y Hora */
.date-badge, .place-badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.9em;
    background-color: #f4f4f9;
    font-weight: 500;
}

/* Corrección específica para la etiqueta de Hora */
.time-badge {
    background-color: #e8f0fe !important; /* Fondo azul claro */
    color: #1967d2 !important;            /* Texto azul oscuro */
    font-weight: bold;
}


/* Botones de Acción (Editar / Eliminar) */
.acciones-cell {
    white-space: nowrap; /* Que no se rompan en dos líneas */
}

.action-btn {
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85em;
    font-weight: bold;
    color: white;
    margin: 0 2px;
    transition: transform 0.1s, box-shadow 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.edit-btn {
    background-color: #ff9800; /* Naranjo para editar */
}
.edit-btn:hover {
    background-color: #f57c00;
}

.delete-btn {
    background-color: #f44336; /* Rojo para eliminar */
}
.delete-btn:hover {
    background-color: #d32f2f;
}
/* --- Estilos para Agenda Pública --- */

/* Botón de Compartir WhatsApp */
.share-wsp-btn {
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 8px 15px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px; /* Separación en móvil */
    transition: background-color 0.2s;
    text-decoration: none;
}

.share-wsp-btn:hover {
    background-color: #128C7E;
}

/* Insignia de Ranking */
.rank-badge {
    background-color: #FFD700; /* Dorado */
    color: #333;
    font-size: 0.75em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    border: 1px solid #e0c200;
}

/* Ajustes responsive para el botón */
@media (min-width: 768px) {
    .share-wsp-btn {
        margin-top: 0;
        margin-left: auto; /* Empujar a la derecha en desktop */
    }
}

/* --- MENÚ ÚNICO CENTRALIZADO --- */

#admin-menu-container {
    background-color: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    border-bottom: 3px solid var(--color-primario);
}

.menu-btn {
    text-decoration: none;
    background-color: #f8f9fa;
    color: #555;
    padding: 10px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.menu-btn:hover {
    background-color: #e2e6ea;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: #333;
}

/* Estado Activo (Página actual) */
.menu-btn.active {
    background-color: var(--color-primario);
    color: white;
    border-color: var(--color-primario);
}

.menu-btn.logout-btn {
    background-color: #ffebee;
    color: #d32f2f;
    border-color: #ffcdd2;
    margin-left: 10px; /* Separar un poco el salir */
}

.menu-btn.logout-btn:hover {
    background-color: #d32f2f;
    color: white;
}

/* Ajuste para móviles */
@media (max-width: 600px) {
    #admin-menu-container {
        gap: 5px;
        padding: 10px;
    }
    .menu-btn {
        flex-grow: 1; /* Botones ocupan el ancho disponible */
        justify-content: center;
        font-size: 0.85em;
        padding: 8px;
    }
    .menu-btn.logout-btn {
        margin-left: 0;
        width: 100%;
    }
}
/* --- MEJORAS DE DISEÑO MÓVIL (TARJETAS Y BOTONES) --- */

/* Contenedor de acciones (Botones) */
.card-actions {
    display: flex;
    flex-direction: row; /* Lado a lado */
    gap: 12px;           /* Espacio entre botones */
    width: 100%;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0; /* Línea sutil separadora */
}

/* Estilo Base de Botón Moderno */
.btn-modern {
    flex: 1; /* Ambos botones ocupan el mismo ancho (50%) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    border-radius: 12px; /* Bordes redondeados modernos */
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.08); /* Sombra suave */
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

/* Efecto al presionar (Feedback táctil) */
.btn-modern:active {
    transform: scale(0.97);
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

/* Colores Específicos con Degradados Sutiles */
.btn-invite {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 100%); /* Verde */
}

.btn-edit {
    background: linear-gradient(135deg, #FFB347 0%, #FF9800 100%); /* Naranja */
    color: white;
}

/* Ajustes finos a la tarjeta en móvil */
@media (max-width: 600px) {
    .match-schedule-card {
        padding: 20px 15px; /* Menos padding lateral para ganar espacio */
    }
    
    .match-info {
        gap: 5px; /* Nombres más cerca del VS */
    }
    
    .vs-text {
        font-size: 0.8em;
        color: #bbb; /* VS más sutil */
        margin: 2px 0;
    }
    
    .time-location-info {
        background-color: #f9f9f9;
        padding: 8px;
        border-radius: 8px;
        width: 100%;
        box-sizing: border-box;
    }
}

/* --- CORRECCIÓN PARA ESCRITORIO (PC/TABLET) --- */
@media (min-width: 768px) {
    /* Hacemos que la tarjeta sea una fila horizontal */
    .match-schedule-card {
        flex-direction: row;
        align-items: center; /* Centrar verticalmente */
        justify-content: space-between; /* Espacio entre info y botones */
        padding: 15px 25px; /* Más espacio a los lados */
        gap: 20px;
    }
    
    /* Ajustamos la información del partido */
    .match-info {
        flex-direction: row;
        gap: 20px;
        margin-bottom: 0;
        flex-grow: 1; /* Ocupa el espacio disponible a la izquierda */
        justify-content: flex-start; /* Alinear a la izquierda */
    }
    
    .vs-text {
        margin: 0 10px;
    }
    
    /* Información de Hora y Lugar en línea */
    .time-location-info {
        flex-direction: row;
        gap: 15px;
        margin-top: 0;
        margin-right: 20px; /* Separar un poco de los botones */
        background-color: transparent; /* Quitar fondo gris de móvil */
        padding: 0;
    }

    /* --- CORRECCIÓN DE LOS BOTONES EN PC --- */
    .card-actions {
        width: auto;       /* Que NO ocupe el 100% */
        margin-top: 0;     /* Quitar margen superior de móvil */
        padding-top: 0;    /* Quitar padding superior */
        border-top: none;  /* Quitar la línea divisoria */
        flex-direction: row;
        gap: 10px;
        flex-shrink: 0;    /* Evitar que se aplasten */
    }

    .btn-modern {
        flex: none;        /* Quitar el 'flex: 1' que los estiraba */
        width: auto;       /* Ancho automático según contenido */
        min-width: 110px;  /* Un ancho mínimo decente */
        padding: 8px 15px; /* Un poco más compactos */
        font-size: 0.9em;
    }
}

/* --- ESTILOS CONTROLADOR MARCADOR (NUEVO DISEÑO) --- */

.top-bar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.match-title-control {
    font-weight: 900;
    color: var(--color-tabla-encabezado);
    text-transform: uppercase;
}

.preview-box {
    margin-bottom: 20px;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 5px;
    background: #222; /* Fondo oscuro para simular TV */
}

/* GRID PRINCIPAL: 2 Columnas */
.control-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* COLUMNA DE EQUIPO */
.team-column {
    background: #fdfdfd;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-1-col { border-top: 5px solid var(--color-primario); }
.team-2-col { border-top: 5px solid var(--color-resaltado); }

.team-name-display {
    text-align: center;
    font-size: 1em;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 30px;
}

/* BOTÓN SAQUE */
.btn-serve {
    width: 100%;
    padding: 8px;
    border-radius: 20px;
    border: 2px solid #ccc;
    background: white;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-serve.active {
    background: #ccff00; /* Amarillo Tenis */
    border-color: #99cc00;
    color: black;
    box-shadow: 0 0 10px rgba(204, 255, 0, 0.5);
}

/* GRUPO PUNTOS */
.points-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.btn-point-plus {
    width: 100%;
    padding: 20px;
    font-size: 1.4em;
    font-weight: bold;
    background: var(--color-primario); /* Azul para + */
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 0 #0056b3; /* Efecto 3D */
}

.btn-point-plus:active {
    transform: translateY(4px);
    box-shadow: none;
}

.btn-point-minus {
    width: 100%;
    padding: 8px;
    font-size: 0.9em;
    background: #ddd;
    color: #555;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* GAMES Y SETS ROW */
.games-sets-row {
    display: flex;
    justify-content: space-between;
    gap: 5px;
}

.control-box {
    flex: 1;
    background: #eee;
    padding: 5px;
    border-radius: 6px;
    text-align: center;
}

.control-box span {
    font-size: 0.7em;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #555;
}

.btn-pair {
    display: flex;
    gap: 2px;
}

.btn-pair button {
    flex: 1;
    padding: 8px 0;
    border: none;
    cursor: pointer;
    font-weight: bold;
}
.btn-pair button:first-child { background: #bbb; border-radius: 4px 0 0 4px; }
.btn-pair button:last-child { background: #ddd; border-radius: 0 4px 4px 0; }

/* ACCIONES FINALES */
.final-actions {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px dashed #ccc;
    padding-top: 10px;
}

.btn-finalize, .btn-wo, .btn-reset-team, .btn-global-reset {
    border: none;
    padding: 8px;
    border-radius: 5px;
    font-size: 0.85em;
    font-weight: bold;
    cursor: pointer;
    color: white;
}

.btn-finalize { background-color: #28a745; }
.btn-wo { background-color: #6f42c1; } /* Morado */
.btn-reset-team { background-color: #6c757d; }
.btn-global-reset { background-color: #dc3545; }

/* CONTROL DE SET ACTIVO */
.active-set-control {
    margin-top: 20px;
    background: #f0f0f0;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.set-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 5px;
}

.set-selector button {
    padding: 8px 15px;
    border: 1px solid #ccc;
    background: white;
    cursor: pointer;
    border-radius: 20px;
}

.set-selector button.active {
    background: #333;
    color: white;
    border-color: #000;
}

/* RESPONSIVE: En pantallas muy muy pequeñas, ajustar gap */
@media (max-width: 400px) {
    .control-panel-grid { gap: 5px; }
    .btn-point-plus { padding: 15px; font-size: 1.2em; }
}

/* --- MEJORAS RESPONSIVAS PARA EL CONTROLADOR --- */

/* 1. Ajuste general del contenedor del marcador */
#score-controller {
    max-width: 100%;
    overflow-x: hidden; /* Evita scroll horizontal */
}

/* 2. Nombres de Equipos: Fuente dinámica (clamp) */
.team-name-display {
    text-align: center;
    /* La fuente se ajustará entre 12px y 18px dependiendo del ancho */
    font-size: clamp(0.75rem, 2.5vw, 1.1rem); 
    margin: 0 0 10px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    height: auto;
    font-weight: 800;
    text-transform: uppercase;
    color: #333;
}

/* 3. Botón Gigante de Punto: Se adapta */
.btn-point-plus {
    width: 100%;
    /* Padding dinámico: menos en móvil, más en PC */
    padding: clamp(10px, 3vw, 20px); 
    font-size: clamp(1rem, 4vw, 1.4rem); /* Texto se achica en móvil */
    font-weight: 900;
    letter-spacing: 1px;
}

/* 4. Botones de Game y Set: Más compactos en móvil */
.btn-pair button {
    padding: clamp(5px, 2vw, 8px) 0;
    font-size: clamp(0.8rem, 3vw, 1rem);
}

.control-box span {
    font-size: 0.65em; /* Etiqueta pequeña (GAME/SETS) */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 5. Botones Finales (W.O, Finalizar, Reset) */
.final-actions {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Dos columnas para ahorrar espacio vertical */
    gap: 5px;
}
.btn-wo { grid-column: span 2; } /* W.O ocupa todo el ancho */
.btn-finalize { font-size: 0.75em; padding: 6px; }
.btn-reset-team { font-size: 0.75em; padding: 6px; }

/* --- MEDIA QUERY ESPECÍFICA PARA MÓVILES (<600px) --- */
@media (max-width: 600px) {
    .control-panel-grid {
        gap: 8px; /* Menos espacio entre columnas */
    }
    
    .team-column {
        padding: 8px; /* Menos relleno interno */
    }

    /* Botón de Saque más compacto */
    .btn-serve {
        padding: 5px;
        font-size: 0.8em;
    }

    /* Reducir altura del botón Menos Punto */
    .btn-point-minus {
        padding: 5px;
        font-size: 0.75em;
    }
    
    /* Ajustar el preview del marcador para que no se rompa */
    .preview-box {
        transform: scale(0.95); /* Encogerlo un poquito si es necesario */
        margin-bottom: 10px;
    }
}

/* --- CORRECCIONES PARA IPHONE / MÓVIL (FUERZA 2 COLUMNAS) --- */

@media (max-width: 768px) {
    /* 1. Forzar que siempre sean 2 columnas, NO apilar */
    .control-panel-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }

    /* 2. Reducir padding de las columnas */
    .team-column {
        padding: 8px 5px !important;
    }

    /* 3. Nombres de equipos más pequeños */
    .team-name-display {
        font-size: 0.85rem !important; /* Letra más chica */
        height: auto !important;
        white-space: normal !important; /* Permitir que baje a 2 líneas si es largo */
        line-height: 1.2;
        margin-bottom: 8px;
    }

    /* 4. Botón GIGANTE de punto un poco más chico */
    .btn-point-plus {
        padding: 15px 5px !important;
        font-size: 1.1rem !important;
    }

    /* 5. Botones de Game/Set más compactos */
    .control-box span {
        font-size: 0.6rem !important; /* Texto "GAME" más chico */
    }
    
    .btn-pair button {
        padding: 6px 0 !important;
        font-size: 0.8rem !important;
    }

    /* 6. Botones de acciones finales (W.O, Reset) más compactos */
    .final-actions {
        gap: 4px !important;
    }
    
    .btn-wo, .btn-finalize, .btn-reset-team {
        font-size: 0.7rem !important;
        padding: 5px 2px !important;
        white-space: nowrap; /* Que no se rompa el texto */
    }
    
    /* Ajuste para que los botones de abajo no se deformen */
    .final-actions .btn-finalize {
        background-color: #28a745;
        font-size: 0.65rem !important; /* Un poco más chico para que quepa "Finalizado" */
    }
}