/* ============================================
   FUTBOLMINUTE - RESPONSIVE CSS MEJORADO
   Diseño adaptativo para todos los dispositivos
   ============================================ */

/* ============================================
   TABLETS Y PANTALLAS MEDIANAS (768px - 1024px)
   ============================================ */

@media (max-width: 1024px) {
    :root {
        --spacing-xl: 1.5rem;
        --spacing-2xl: 2rem;
    }
    
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .nav-menu {
        gap: var(--spacing-xs);
        font-size: 0.875rem;
    }
    
    .player-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .match-controls {
        position: relative;
        top: 0;
        margin-bottom: var(--spacing-lg);
    }
    
    .timer-display {
        font-size: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .bench-container {
        left: -160px;
        width: 140px;
        padding: 0.75rem 0.5rem;
    }
}

/* ============================================
   MÓVILES Y TABLETS PEQUEÑAS (max-width: 768px)
   ============================================ */

@media (max-width: 768px) {
    :root {
        --spacing-md: 0.75rem;
        --spacing-lg: 1rem;
        --spacing-xl: 1.25rem;
        --spacing-2xl: 1.5rem;
    }
    
    body {
        font-size: 14px;
    }
    
    /* ============================================
       NAVEGACIÓN MÓVIL
       ============================================ */
    
    .navbar {
        padding: var(--spacing-sm) 0;
    }
    
    .navbar .container {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .nav-brand h1 {
        font-size: 1.25rem;
    }
    
    .nav-brand img {
        height: 35px;
    }
    
    .nav-menu {
        flex-direction: column;
        width: 100%;
        gap: 0;
        background: white;
        border-radius: var(--radius-md);
        overflow: hidden;
        box-shadow: var(--shadow-md);
    }
    
    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid var(--bg-tertiary);
    }
    
    .nav-menu li:last-child {
        border-bottom: none;
    }
    
    .nav-menu a {
        display: block;
        padding: var(--spacing-md);
        text-align: center;
        border-radius: 0;
    }
    
    /* ============================================
       CARDS Y LAYOUT
       ============================================ */
    
    .card {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }
    
    .card-header {
        padding-bottom: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }
    
    .card-header h2 {
        font-size: 1.25rem;
    }
    
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
    
    .flex-between > * {
        width: 100%;
    }
    
    /* ============================================
       PLAYER CARDS
       ============================================ */
    
    .player-list {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
    
    .player-card {
        padding: var(--spacing-md);
    }
    
    .player-photo {
        width: 100px;
        height: 100px;
    }
    
    .player-name {
        font-size: 1.125rem;
    }
    
    .player-stats {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .stat-item {
        font-size: 0.875rem;
    }
    
    .player-actions {
        flex-direction: column;
        gap: var(--spacing-xs);
    }
    
    .player-actions .btn {
        width: 100%;
    }
    
    /* ============================================
       MATCH CONTROLS
       ============================================ */
    
    .match-controls {
        padding: var(--spacing-md);
    }
    
    .timer-display {
        font-size: 2.5rem;
    }
    
    .control-buttons {
        flex-direction: column;
        width: 100%;
        gap: var(--spacing-sm);
    }
    
    .control-buttons button {
        width: 100%;
        min-width: auto;
    }
    
    /* ============================================
       SCOREBOARD
       ============================================ */
    
    .scoreboard-container {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.25rem;
    }
    
    .team-name {
        font-size: 0.875rem;
    }
    
    .score-display {
        font-size: 3rem;
    }
    
    .score-separator {
        font-size: 2rem;
        transform: rotate(90deg);
    }
    
    /* ============================================
       MATCH PLAYER LIST
       ============================================ */
    
    .match-player-item {
        flex-direction: column;
        text-align: center;
        padding: var(--spacing-md);
    }
    
    .match-player-photo {
        width: 70px;
        height: 70px;
    }
    
    .match-player-header {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .match-player-stats {
        justify-content: center;
        font-size: 0.8rem;
    }
    
    .match-player-actions {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }
    
    .action-btn {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 100px;
        padding: 0.625rem 0.875rem;
        font-size: 0.8rem;
    }
    
    /* ============================================
       FIELD VIEW
       ============================================ */
    
    .field-container {
        max-width: 100%;
        margin: var(--spacing-md) 0;
    }
    
    .field-player {
        width: 60px;
        height: 60px;
    }
    
    .field-player-circle {
        width: 60px;
        height: 60px;
        border-width: 3px;
    }
    
    .player-dorsal {
        font-size: 1.25rem;
    }
    
    .player-name-field {
        font-size: 0.6rem;
        max-width: 55px;
    }
    
    .player-bubble {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* BANQUILLO EN MÓVIL */
    .bench-container {
        position: relative;
        left: 0;
        width: 100%;
        margin-top: var(--spacing-md);
        max-height: none;
        display: flex;
        overflow-x: auto;
        overflow-y: visible;
        padding: var(--spacing-md);
    }
    
    .bench-title {
        display: none;
    }
    
    .bench-player {
        flex: 0 0 auto;
        width: auto;
        min-width: 140px;
        margin-right: var(--spacing-sm);
        margin-bottom: 0;
    }
    
    /* ============================================
       VIEW TOGGLE
       ============================================ */
    
    .view-toggle {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .view-toggle button {
        width: 100%;
        padding: var(--spacing-md);
    }
    
    /* ============================================
       TABLES
       ============================================ */
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }
    
    .table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: var(--spacing-sm);
    }
    
    /* ============================================
       FORMS
       ============================================ */
    
    .form-group label {
        font-size: 0.875rem;
    }
    
    .form-control {
        font-size: 1rem;
        padding: 0.75rem var(--spacing-sm);
    }
    
    /* ============================================
       BUTTONS
       ============================================ */
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .btn-block {
        width: 100%;
    }
    
    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    
    .flex.gap-1 {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .flex.gap-1 .btn {
        width: 100%;
    }
    
    /* ============================================
       TIMELINE
       ============================================ */
    
    .timeline-event {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-wrap: wrap;
    }
    
    .timeline-minute {
        font-size: 1rem;
        min-width: 50px;
        padding: 0.375rem 0.5rem;
    }
    
    .timeline-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
    
    .timeline-text {
        font-size: 0.875rem;
        flex-basis: 100%;
    }
    
    /* ============================================
       LOGIN
       ============================================ */
    
    .login-container {
        padding: var(--spacing-md);
    }
    
    .login-box {
        padding: var(--spacing-lg);
        margin: var(--spacing-md);
    }
    
    .login-box h2 {
        font-size: 1.5rem;
    }
    
    /* ============================================
       DASHBOARD STATS
       ============================================ */
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .stat-card {
        padding: var(--spacing-md);
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    /* ============================================
       RIVAL GOALS COUNTER
       ============================================ */
    
    .rival-goal-buttons {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .rival-goal-buttons .btn {
        width: 100%;
    }
    
    /* ============================================
       SUBSTITUTION MODAL
       ============================================ */
    
    .substitution-content {
        max-width: 95%;
        padding: var(--spacing-md);
    }
    
    .substitution-content h3 {
        font-size: 1.25rem;
    }
    
    .substitute-option {
        padding: var(--spacing-sm);
    }
    
    .substitute-photo {
        width: 50px;
        height: 50px;
    }
    
    .substitute-name {
        font-size: 0.875rem;
    }
    
    /* ============================================
       RESULT BANNER
       ============================================ */
    
    .result-banner {
        padding: 2rem var(--spacing-md);
    }
    
    .result-banner h1 {
        font-size: 2rem;
    }
    
    .score-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .team-shield {
        width: 100px;
        height: 100px;
    }
}

/* ============================================
   MÓVILES PEQUEÑOS (max-width: 480px)
   ============================================ */

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .nav-brand h1 {
        font-size: 1.125rem;
    }
    
    .nav-brand img {
        height: 30px;
    }
    
    .card {
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
    
    .card-header {
        padding-bottom: var(--spacing-sm);
        margin-bottom: var(--spacing-sm);
    }
    
    .card-header h2 {
        font-size: 1.125rem;
    }
    
    /* Match player item simplified */
    .match-player-item {
        padding: var(--spacing-sm);
    }
    
    .match-player-photo {
        width: 60px;
        height: 60px;
    }
    
    .match-player-stats {
        flex-wrap: wrap;
        font-size: 0.75rem;
    }
    
    .stat-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Timer display */
    .timer-display {
        font-size: 2rem;
    }
    
    /* Field player circles */
    .field-player {
        width: 50px;
        height: 50px;
    }
    
    .field-player-circle {
        width: 50px;
        height: 50px;
        border-width: 2px;
    }
    
    .player-dorsal {
        font-size: 1rem;
    }
    
    .player-name-field {
        font-size: 0.55rem;
        max-width: 45px;
    }
    
    .player-bubble {
        padding: 0.2rem 0.4rem;
        font-size: 0.65rem;
    }
    
    /* Tables in mobile */
    .table {
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: var(--spacing-xs);
    }
    
    /* Buttons smaller */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.85rem;
    }
    
    .btn-sm {
        padding: 0.4rem 0.7rem;
        font-size: 0.75rem;
    }
    
    /* Player card */
    .player-photo {
        width: 90px;
        height: 90px;
    }
    
    .player-name {
        font-size: 1rem;
    }
    
    .player-stats {
        font-size: 0.8rem;
    }
    
    /* Result banner */
    .result-banner {
        padding: 1.5rem var(--spacing-sm);
    }
    
    .result-banner h1 {
        font-size: 1.5rem;
    }
    
    .score-display {
        font-size: 2.5rem;
    }
    
    /* Timeline */
    .timeline-event {
        padding: var(--spacing-xs) var(--spacing-sm);
    }
    
    .timeline-minute {
        font-size: 0.875rem;
        min-width: 45px;
    }
    
    .timeline-icon {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
    }
}

/* ============================================
   LANDSCAPE MODE EN MÓVILES
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .field-canvas {
        padding-bottom: 100%;
    }
    
    .match-controls {
        padding: var(--spacing-sm);
    }
    
    .timer-display {
        font-size: 2rem;
    }
    
    .control-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .control-buttons button {
        flex: 1;
        min-width: 120px;
    }
    
    .bench-container {
        flex-direction: row;
        max-height: 200px;
    }
}

/* ============================================
   TABLETS EN LANDSCAPE (769px - 1024px)
   ============================================ */

@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .container {
        max-width: 90%;
    }
    
    .player-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   MEJORAS TÁCTILES (TOUCH DEVICES)
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Áreas táctiles más grandes */
    .btn {
        min-height: 48px;
        padding: 0.875rem 1.25rem;
    }
    
    .table td {
        min-height: 48px;
    }
    
    .form-control {
        min-height: 48px;
        font-size: 16px; /* Evitar zoom en iOS */
    }
    
    select.form-control {
        font-size: 16px;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
    }
    
    /* Mejoras para arrastrar en campo */
    .field-player {
        cursor: move;
        touch-action: none;
    }
    
    /* Botones de acción más grandes */
    .action-btn {
        min-height: 44px;
    }
    
    /* Nav menu items más grandes */
    .nav-menu a {
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ============================================
   DARK MODE SUPPORT (OPCIONAL)
   ============================================ */

@media (prefers-color-scheme: dark) {
    /* Puedes añadir estilos dark mode aquí si lo deseas en el futuro */
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .navbar,
    .footer,
    .btn,
    button,
    .match-controls,
    .view-toggle,
    .action-btn,
    .player-actions,
    .bench-container {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        page-break-inside: avoid;
        border: 1px solid #ddd;
    }
    
    .table {
        page-break-inside: auto;
    }
    
    .table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    
    .timeline-event {
        page-break-inside: avoid;
    }
    
    .player-card {
        page-break-inside: avoid;
    }
    
    body {
        background: white;
    }
    
    * {
        color-adjust: exact;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ============================================
   ACCESIBILIDAD - REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .btn {
        border: 3px solid currentColor;
    }
    
    .card {
        border: 2px solid #000;
    }
    
    .field-player-circle {
        border-width: 4px;
    }
    
    .timeline-event {
        border-left-width: 6px;
    }
}
