/* ====================== */
/* VARIABLES Y ESTILOS BASE */
/* ====================== */
:root {
    /* Colores */
    --color-primary: #ff001a;
    --color-primary-dark: #d91529;
    --yellow: #ffc107;
    --white: #fff;
    --gray: #6c757d;
    --gray-dark: #343a40;
    --light: #f8f9fa;
    
    /* Tipografía */
    --font-family-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-size-base: 14px;
}

/* ====================== */
/*  ESTRUCTURA PRINCIPAL  */
/* ====================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-family-sans-serif);
}

.main-content {
    flex: 1;
    padding-bottom: 2rem; /* Espacio antes del footer */
}

.site-footer {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: var(--white);
    width: 100%;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem 0;
}

.footer-section {
    margin-bottom: 1.5rem;
}

.footer-bottom {
    background: var(--gray-dark);
    padding: 1rem 0;
    text-align: center;
    margin-top: 2rem;
}

/* ====================== */
/* COMPONENTES DEL FOOTER */
/* ====================== */
.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 1.75rem;
    color: var(--yellow);
}

.footer-logo h3 {
    margin: 0;
    font-size: 1.25rem;
}

.footer-about-text {
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.5;
}

.footer-section h3 {
    color: var(--yellow);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 2.5rem;
    height: 2px;
    background: var(--yellow);
}

.footer-links,
.contact-info {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li,
.contact-info li {
    margin-bottom: 0.75rem;
}

.footer-links a,
.contact-info a {
    color: var(--white);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
    opacity: 0.9;
}

.footer-links a:hover,
.contact-info a:hover {
    color: var(--yellow);
    opacity: 1;
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-info i {
    color: var(--yellow);
    width: 1.25rem;
    text-align: center;
}

.social-icons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.social-icons a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-radius: 50%;
    transition: all 0.3s;
}

.social-icons a:hover {
    background: var(--yellow);
    color: var(--color-primary-dark);
    transform: translateY(-3px);
}

.newsletter {
    display: flex;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.newsletter input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 0.9rem;
}

.newsletter button {
    background: var(--yellow);
    color: var(--color-primary-dark);
    border: none;
    padding: 0 1rem;
    border-radius: 0 4px 4px 0;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.newsletter button:hover {
    background: var(--white);
}

.footer-bottom-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.footer-bottom p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.8;
}

.legal-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.legal-links a {
    font-size: 0.75rem;
    color: var(--white);
    text-decoration: none;
}

/* ====================== */
/* MEDIA QUERIES - RESPONSIVE */
/* ====================== */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 1.5rem 1rem 0;
    }
    
    .footer-section {
        text-align: center;
        margin-bottom: 1.25rem;
    }
    
    .footer-section h3 {
        margin-left: auto;
        margin-right: auto;
    }
    
    .footer-section h3::after {
        left: 50%;
        transform: translateX(-50%);
    }
    
    .footer-logo {
        justify-content: center;
    }
    
    .contact-info li {
        justify-content: center;
    }
    
    .newsletter {
        flex-direction: column;
    }
    
    .newsletter input,
    .newsletter button {
        width: 100%;
        border-radius: 4px;
    }
}

@media (max-width: 480px) {
    .legal-links {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-logo {
        flex-direction: column;
    }
    
    .footer-logo h3 {
        margin-top: 0.5rem;
    }
}

/* ====================== */
/* CSS RESPONSIVE GLOBAL - SOBREESCRITURA */
/* ====================== */

/* 1. RESET Y CONFIGURACIÓN BASE PARA RESPONSIVE */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* 2. CONTENEDORES PRINCIPALES RESPONSIVE */
.main-content,
.admin-content {
    width: 100%;
    padding: 1rem;
}

.container,
.form-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* 3. MEDIA QUERIES PARA TODOS LOS DISPOSITIVOS */

/* Dispositivos muy pequeños (móviles en portrait, menos de 576px) */
@media (max-width: 575.98px) {
    /* Ajustes generales */
    body {
        font-size: 14px;
        line-height: 1.4;
    }
    
    .main-content,
    .admin-content {
        padding: 0.5rem;
    }
    
    /* Header y títulos */
    .form-header h2,
    .page-title,
    .card-header h2,
    .modal-header h2 {
        font-size: 1.3rem !important;
        text-align: center;
    }
    
    .form-header p {
        font-size: 0.85rem !important;
    }
    
    /* Grids y layouts */
    .input-grid,
    .form-grid,
    .jugador-details,
    .detalles-grid,
    .profile-info-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Tablas */
    .table-responsive {
        font-size: 0.8rem;
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 0.5rem 0.3rem !important;
        font-size: 0.75rem;
    }
    
    /* Botones y acciones */
    .buttons,
    .form-actions,
    .modal-footer,
    .form-actions-split {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .btn,
    .btn-action,
    .btn-submit,
    .btn-back {
        width: 100% !important;
        justify-content: center;
        margin: 0.2rem 0 !important;
    }
    
    /* Formularios */
    .form-section,
    .profile-section,
    .card-body {
        padding: 1rem !important;
        margin: 0.5rem !important;
    }
    
    .input-group input,
    .input-group select,
    .input-group textarea {
        font-size: 16px !important; /* Evita zoom en iOS */
    }
    
    /* Firma canvas */
    .firma-canvas {
        width: 100% !important;
        max-width: 100% !important;
        height: 120px !important;
    }
    
    /* Modal responsive */
    .modal-content {
        width: 95% !important;
        margin: 5% auto !important;
        max-height: 90vh !important;
    }
    
    .modal-body {
        padding: 1rem !important;
        max-height: 70vh !important;
    }
}

/* Dispositivos pequeños (móviles en landscape, 576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .main-content,
    .admin-content {
        padding: 0.75rem;
    }
    
    .form-container {
        width: 95%;
    }
    
    .input-grid,
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }
    
    .buttons,
    .form-actions {
        flex-wrap: wrap;
    }
    
    .btn {
        min-width: 48%;
        margin: 0.2rem 0;
    }
}

/* Tablets (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .container,
    .form-container {
        width: 95%;
    }
    
    .input-grid,
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
    }
    
    /* Sidebar admin para tablets */
    .admin-sidebar {
        width: 70px;
    }
    
    .admin-sidebar .nav-item span,
    .admin-sidebar .user-info p,
    .admin-sidebar .user-info small {
        display: none;
    }
    
    .admin-sidebar .nav-item {
        justify-content: center;
        padding: 0.8rem;
    }
}

/* 4. COMPORTAMIENTOS ESPECÍFICOS POR COMPONENTE */

/* Header del perfil responsive */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}

/* Tabs responsive */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .tab-btn {
        border-bottom: 1px solid var(--gray-medium);
        border-left: 3px solid transparent;
        justify-content: flex-start;
    }
    
    .tab-btn.active {
        border-bottom-color: transparent;
        border-left-color: var(--color-primary);
    }
}

/* Cards y estadísticas responsive */
@media (max-width: 768px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .stats-container,
    .actions-grid {
        grid-template-columns: 1fr !important;
    }
}

/* 5. MEJORAS DE USABILIDAD Y ACCESIBILIDAD */

/* Prevenir desbordamiento horizontal */
img, canvas, video, svg {
    max-width: 100%;
    height: auto;
}

/* Mejorar legibilidad en móviles */
p, li, span, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Scroll suave y prevención de scroll horizontal */
body, .main-content, .admin-content, .modal-body {
    overflow-x: hidden;
}

/* Mejorar inputs en móviles */
input, select, textarea {
    font-size: 16px; /* Previene zoom en iOS */
    min-height: 44px; /* Tamaño mínimo táctil */
}

/* Botones táctiles */
button, .btn, [role="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* 6. COMPORTAMIENTOS ESPECIALES PARA IOS */

@supports (-webkit-touch-callout: none) {
    /* iOS específico */
    input, textarea {
        font-size: 16px !important; /* Fuerza tamaño de fuente para evitar zoom */
    }
}

/* 7. MEJORAS PARA ORIENTACIÓN */

/* Landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 80vh;
        margin: 2% auto;
    }
    
    .modal-body {
        max-height: 60vh;
    }
    
    .form-container {
        margin: 0.5rem auto;
    }
}

/* 8. COMPORTAMIENTOS DE NAVEGACIÓN MÓVIL */

/* Prevenir gestos no deseados en navegadores móviles */
body {
    touch-action: pan-y pinch-zoom;
}

/* Mejorar scroll en móviles */
.modal-body, .table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* 9. AJUSTES PARA DARK MODE (opcional pero recomendado) */

@media (prefers-color-scheme: dark) {
    /* Mantener tus colores pero ajustar contraste */
    .form-container,
    .card,
    .modal-content {
        background-color: var(--white);
    }
}

/* 10. ANIMACIONES Y TRANSICIONES OPTIMIZADAS */

/* Transiciones suaves pero optimizadas */
@media (prefers-reduced-motion: no-preference) {
    .form-container,
    .card,
    .modal-content {
        transition: transform 0.3s ease, opacity 0.3s ease;
    }
}

/* 11. ESTADOS DE CARGA Y MEJORAS DE RENDIMIENTO */

/* Mejorar rendimiento en dispositivos móviles */
.form-container,
.card,
.modal-content {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 12. CORRECCIONES ESPECÍFICAS PARA COMPONENTES CRÍTICOS */

/* Firmas digitales en móviles */
@media (max-width: 768px) {
    .signature-fields-container {
        flex-direction: column;
    }
    
    .team-signatures {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .signature-field-equipo {
        max-width: 100% !important;
    }
}

/* Admin sidebar en móviles */
@media (max-width: 991.98px) {
    .admin-container {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        position: static;
        transform: none;
    }
    
    .sidebar-toggle {
        display: block;
    }
}

/* 13. MEJORAS DE TIPOGRAFÍA RESPONSIVE */

h1 { font-size: clamp(1.5rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 4vw, 2rem); }
h3 { font-size: clamp(1.1rem, 3.5vw, 1.5rem); }
h4 { font-size: clamp(1rem, 3vw, 1.3rem); }

/* 14. UTILIDADES RESPONSIVE FINALES */

/* Ocultar/mostrar elementos según dispositivo */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Asegurar que los textos no se salgan */
.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .text-truncate-mobile {
        max-width: 100%;
    }
}

/* ====================== */
/* FIN CSS RESPONSIVE GLOBAL */
/* ====================== */

/* ====================== */
/* CSS RESPONSIVE GLOBAL MEJORADO */
/* ====================== */

/* 1. RESET Y CONFIGURACIÓN BASE PARA RESPONSIVE */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* 2. MEJORAS ESPECÍFICAS PARA HEADER EN MÓVILES */
@media (max-width: 768px) {
    /* Header top - asegurar que se vea el color rojo */
    .header-top {
        padding: 8px 4%;
        background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)) !important;
    }
    
    /* Mostrar botones de usuario en móvil */
    .user-actions {
        display: flex !important;
        gap: 8px;
        flex-direction: column;
        align-items: flex-end;
    }
    
    .login-btn, .register-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    /* Ajustar logo para móviles */
    .logo-container {
        gap: 10px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    /* Menú móvil mejorado */
    .mobile-menu-toggle {
        width: 25px;
        height: 18px;
    }
    
    .main-nav.active {
        max-height: 100vh !important;
        overflow-y: auto;
    }
    
    .nav-link {
        padding: 15px 0;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    /* Asegurar que el header se mantenga visible */
    .main-header {
        position: sticky;
        top: 0;
        z-index: 1000;
    }
}

/* 3. MEJORAS ESPECÍFICAS PARA PÁGINAS DE LOGIN/FORMULARIOS */
@media (max-width: 575.98px) {
    /* Ajustes para caja de sesión en móviles */
    .caja-sesion {
        width: 95% !important;
        max-width: 350px;
        margin: 10px auto;
    }
    
    .encabezado-tarjeta {
        padding: 15px;
    }
    
    .encabezado-tarjeta h1 {
        font-size: 1.2rem;
    }
    
    .cuerpo-tarjeta {
        padding: 15px;
    }
    
    .entrada-formulario {
        width: 90%;
        font-size: 16px;
        padding: 12px 12px 12px 40px;
    }
    
    .boton {
        padding: 12px;
        font-size: 1rem;
    }
    
    /* Mejorar usabilidad en formularios */
    input, select, textarea {
        font-size: 16px !important; /* Previene zoom en iOS */
        min-height: 44px; /* Tamaño mínimo táctil */
    }
}

/* 4. MEJORAS PARA CONTENIDO PRINCIPAL */
@media (max-width: 768px) {
    .content {
        width: 95% !important;
        margin: 10px auto;
        padding: 15px;
        border-radius: 6px;
    }
    
    h1, h2, h3 {
        text-align: center;
        word-wrap: break-word;
    }
    
    /* Mejorar cajas de deporte */
    .deporte-box {
        padding: 12px;
        margin: 8px auto;
    }
    
    .deporte-box .btn {
        padding: 10px 15px;
        width: 100%;
        text-align: center;
    }
    
    /* Ajustar navegación */
    nav {
        padding: 10px;
    }
    
    nav a {
        margin: 8px;
        font-size: 16px;
        display: inline-block;
    }
}

/* 5. MEJORAS ESPECÍFICAS PARA FOOTER */
@media (max-width: 480px) {
    .footer-container {
        padding: 1rem 0.8rem 0;
    }
    
    .footer-section {
        margin-bottom: 1.2rem;
    }
    
    .footer-logo {
        flex-direction: row;
        justify-content: center;
    }
    
    .footer-logo h3 {
        margin-top: 0;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    .legal-links {
        flex-direction: row;
        gap: 0.8rem;
    }
}

/* 6. COMPORTAMIENTOS ESPECIALES PARA IOS */
@supports (-webkit-touch-callout: none) {
    /* iOS específico */
    input, textarea, select {
        font-size: 16px !important; /* Fuerza tamaño de fuente para evitar zoom */
    }
    
    /* Mejorar scroll en iOS */
    .main-content, .admin-content, .modal-body {
        -webkit-overflow-scrolling: touch;
    }
}

/* 7. MEJORAS PARA ORIENTACIÓN LANDSCAPE */
@media (max-height: 500px) and (orientation: landscape) {
    .caja-sesion {
        margin: 5px auto;
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .header-top {
        padding: 5px 4%;
    }
    
    .content {
        margin: 5px auto;
        padding: 10px;
    }
    
    .modal-content {
        max-height: 90vh;
        margin: 1% auto;
    }
}

/* 8. PREVENCIÓN DE DESBORDAMIENTO HORIZONTAL */
img, canvas, video, svg, iframe {
    max-width: 100%;
    height: auto;
}

/* 9. MEJORAS DE USABILIDAD TÁCTIL */
button, .btn, [role="button"], .nav-link, .mobile-menu-toggle {
    min-height: 44px;
    min-width: 44px;
    cursor: pointer;
}

/* 10. MEJORAS DE TIPOGRAFÍA RESPONSIVE */
h1 { 
    font-size: clamp(1.5rem, 5vw, 2.5rem); 
    line-height: 1.2;
}
h2 { 
    font-size: clamp(1.3rem, 4vw, 2rem); 
    line-height: 1.3;
}
h3 { 
    font-size: clamp(1.1rem, 3.5vw, 1.5rem); 
    line-height: 1.3;
}

/* 11. UTILIDADES RESPONSIVE FINALES */
/* Ocultar/mostrar elementos según dispositivo */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Asegurar que los textos no se salgan */
.text-truncate-mobile {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .text-truncate-mobile {
        max-width: 100%;
    }
}

/* 12. PREVENIR SCROLL HORIZONTAL */
body, .main-content, .admin-content, .modal-body, .main-nav {
    overflow-x: hidden;
    width: 100%;
}

/* 13. MEJORAS ESPECÍFICAS PARA BOTONES EN MÓVIL */
@media (max-width: 768px) {
    .btn, .boton, .login-btn, .register-btn {
        touch-action: manipulation; /* Mejora la respuesta táctil */
    }
    
    /* Evitar hover en dispositivos táctiles */
    @media (hover: none) {
        .btn:hover, .boton:hover, .login-btn:hover, .register-btn:hover {
            background-color: inherit;
            transform: none;
        }
    }
}

/* 14. MEJORAS DE RENDIMIENTO PARA MÓVILES */
@media (max-width: 768px) {
    .main-header, .content, .footer-container {
        transform: translateZ(0);
        backface-visibility: hidden;
    }
}

/* 15. CORRECCIONES ESPECÍFICAS PARA PROBLEMAS COMUNES */
/* Prevenir zoom no deseado en iOS */
@media (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* Mejorar contraste en móviles */
@media (max-width: 768px) {
    .nav-link, .footer-links a, .contact-info a {
        opacity: 1;
    }
}

/* Asegurar que los gradientes se muestren correctamente */
.header-top, .site-footer, nav {
    background-attachment: scroll !important;
}

/* ====================== */
/* FIN CSS RESPONSIVE GLOBAL MEJORADO */
/* ====================== */

