* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background: #f1f3f4; /* Grigio chiaro come sfondo dell'app */
    background-attachment: fixed;
    min-height: 100vh;
    padding: 10px;
    font-size: 16px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); /* Standard Material 2dp/3dp elevation */
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #0061ff 0%, #86efac 100%);
    color: white;
    padding: 20px 30px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 97, 255, 0.25);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.header-text {
    flex: 1;
    text-align: left;
}

.header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header p {
    font-size: 14px;
    opacity: 0.95;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.15);
}

.header-logo {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: row;
        gap: 15px;
    }

    .header h1 {
        font-size: 22px;
    }

    .header p {
        font-size: 12px;
    }

    .header-logo {
        height: 50px;
    }
}

.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.tab {
    flex: 1;
    padding: 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    white-space: nowrap;
    min-width: 100px;
}

.tab:hover {
    background: #e8e8e8;
}

.tab.active {
    background: white;
    color: #0061ff;
    /* Rimuovere la riga inferiore pesante, usare un semplice border o colore più scuro */
    border-bottom: 3px solid #0061ff;
    font-weight: 700;
}

.tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); /* Ombra più leggera */
    border: none; /* Rimuovere border: 1px solid rgba(0, 97, 255, 0.1); */
    transition: all 0.3s;
}

.section:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.section h2 {
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
    font-size: 20px;
    font-weight: 700;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 600;
    font-size: 15px;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #fafafa;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0061ff;
    box-shadow: 0 0 0 4px rgba(0, 97, 255, 0.15);
    background: white;
    transform: translateY(-1px);
}

button {
    background: #0061ff; /* Colore primario piatto */
    color: white;
    border: none;
    padding: 13px 26px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 15px;
    box-shadow: 0 2px 5px rgba(0, 97, 255, 0.2); /* Ombra Material standard */
    position: relative;
    overflow: hidden;
}


button:hover {
    transform: translateY(-2px); /* Meno movimento */
    box-shadow: 0 4px 8px rgba(0, 97, 255, 0.4);
}

/* Conservare: button:active { transform: translateY(-1px); ... } */

.btn-secondary {
    background: #6c757d;
    margin-left: 10px;
}

.btn-danger {
    background: #dc3545;
}

.btn-success {
    background: #28a745;
}

.btn-warning {
    background: #ffc107;
    color: #333;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.player-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.player-card:hover {
    border-color: #0061ff;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 97, 255, 0.2);
    background: linear-gradient(135deg, #ffffff 0%, #e3f2fd 100%);
}

.player-card.selected {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-color: #2196f3;
    box-shadow: 0 6px 15px rgba(33, 150, 243, 0.3);
}

.player-card.selected::before {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: #2196f3;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}

.player-card {
    position: relative;
}

.player-card label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.player-card input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: #0061ff; /* Primary color base */
    color: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Ombra pulita */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(0,0,0,0.25); /* Updated shadow for Material Design */
}

.stat-card h3 {
    font-size: 32px;
    margin-bottom: 8px;
    font-weight: 700;
    position: relative;
    z-index: 1;
}

.stat-card p {
    font-size: 13px;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.match-timer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 2px solid #0061ff;
}

.timer-display {
    font-size: 56px;
    font-weight: 800;
    background: linear-gradient(135deg, #0061ff 0%, #60efff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 10px rgba(0, 97, 255, 0.3);
    transition: all 0.3s ease;
}

.timer-display.recovery {
    background: linear-gradient(135deg, #dc3545 0%, #fc5c65 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: pulse-timer 1s infinite;
}

@keyframes pulse-timer {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
    letter-spacing: 5px;
}

.timer-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

/* Collapsible Sections */
.collapsible-section {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.collapsible-section:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    cursor: pointer;
    user-select: none;
    font-weight: 600;
    font-size: 16px;
    color: #333;
    transition: background 0.2s ease;
}

.collapsible-header:hover {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
}

.collapsible-header:active {
    background: linear-gradient(135deg, #dee2e6, #ced4da);
}

.collapse-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
    color: #666;
}

.collapse-icon.rotated {
    transform: rotate(-180deg);
}

.collapsible-content {
    padding: 20px;
    background: #ffffff;
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
}

.collapsible-content.collapsed {
    max-height: 0;
    padding: 0 20px;
}

.lineup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.lineup-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
}

.lineup-section h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.field-players {
    background: #28a745;
    color: white;
}

.bench-players {
    background: #6c757d;
    color: white;
}

.player-list {
    list-style: none;
    padding: 0;
}

.player-list li {
    padding: 8px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.substitution-btn {
    background: #ffc107;
    color: #333;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 3px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

th, td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

tr:hover {
    background: #f8f9fa;
}

.quick-time {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.quick-time button {
    padding: 8px;
    font-size: 12px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    animation: fadeIn 0.3s;
}

/* Fix z-index per modali sovrapposte */
#matchFormationModal {
    z-index: 10000;
}

#playerSelectionModal {
    z-index: 10001; /* Deve stare sopra matchFormationModal */
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h2 {
    color: #333;
    font-size: 20px;
}

.modal-footer {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.attendance-quick {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.attendance-quick button {
    flex: 1;
}

.convocation-template {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
}

.copy-btn {
    background: #17a2b8;
}

/* Form Aggiungi Giocatore */
.add-player-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-input-name {
    width: 100%;
}

.player-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.player-input-number,
.player-input-role {
    width: 100%;
}

.btn-add-player {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
}

/* Widget Dashboard */
.widget-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 4px solid #0061ff;
    transition: all 0.3s ease;
}

.widget-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.widget-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.widget-card h3 {
    font-size: 16px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-card p {
    font-size: 18px;
    color: #333;
    font-weight: 600;
    margin-bottom: 15px;
}

.quick-action-btn {
    padding: 15px 20px;
    font-size: 15px;
    font-weight: 600;
}

/* Desktop: layout orizzontale classico */
@media (min-width: 769px) {
    .add-player-form {
        flex-direction: column;
        align-items: stretch;
    }

    .player-input-name {
        flex: 1;
    }

    .player-input-row {
        display: flex;
        gap: 10px;
    }

    .btn-add-player {
        width: auto;
        white-space: nowrap;
        padding: 13px 26px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    .header h1 {
        font-size: 20px;
    }

    .header p {
        font-size: 12px;
    }

    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        min-width: 120px;
        padding: 12px;
        font-size: 13px;
    }

    /* Miglior touch target per mobile (min 44x44px) */
    button {
        min-height: 44px;
        font-size: 15px;
    }

    input, select, textarea {
        min-height: 44px;
        font-size: 16px; /* Previene zoom su iOS */
    }

    .tab-content {
        padding: 15px;
    }

    .section {
        padding: 15px;
    }

    .lineup-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .timer-display {
        font-size: 52px; /* Aumentato per migliore leggibilità */
    }

    .timer-controls {
        flex-direction: column;
        gap: 8px;
    }

    .timer-controls button {
        width: 100%;
        min-height: 48px;
        font-size: 15px;
    }

    /* Riordino pulsanti formazione partita su mobile: Conferma prima */
    .match-formation-buttons {
        flex-direction: column;
    }

    .match-formation-buttons button:nth-child(1) {
        order: 2; /* Carica Ultima → secondo */
    }

    .match-formation-buttons button:nth-child(2) {
        order: 3; /* Carica Salvata → terzo */
    }

    .match-formation-buttons button:nth-child(3) {
        order: 1; /* Conferma Formazione → PRIMO */
    }

    .match-formation-buttons button:nth-child(4) {
        order: 4; /* Salva Libreria → quarto */
    }

    .match-formation-buttons button:nth-child(5) {
        order: 5; /* Reset → quinto */
    }

    .players-grid {
        grid-template-columns: 1fr;
    }

    /* Migliorare leggibilità titoli su mobile */
    h3, h4 {
        font-size: 16px; /* Leggermente più grande per migliore leggibilità su schermi piccoli */
    }

    .player-card {
        padding: 12px;
    }

    /* Toast su mobile */
    .toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }

    /* Save indicator su mobile */
    .save-indicator {
        top: 10px;
        right: 10px;
        left: auto;
        font-size: 14px;
    }

    /* Modal su mobile */
    .modal-content {
        width: 95%;
        padding: 20px;
        max-height: 90vh;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px 4px;
    }

    /* Fix grid partita su mobile - passaggio a singola colonna */
    #match .section > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .timer-display {
        font-size: 48px;
    }

    .match-timer {
        padding: 15px;
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease-out;
    z-index: 10000;
    max-width: 350px;
    min-width: 200px;
}

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-out;
}

.toast-success {
    background: #00b09b;
}

.toast-error {
    background: #eb3b5a;
}

.toast-info {
    background: #4b7bec;
}

.toast-warning {
    background: #fdcb6e;
}

.toast-icon {
    font-size: 20px;
}

/* Save Indicator */
.save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 9999;
    pointer-events: none;
}

.save-indicator.active {
    opacity: 1;
}

.save-indicator.saved {
    background: #00b09b;
    color: white;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Lavagna tattica */
.player-token {
    transition: all 0.2s ease;
}

.player-token:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 97, 255, 0.5) !important;
}

/* ========================================
   FORMAZIONI MODERNE - Card Giocatori
   ======================================== */

/* Placeholder per posizioni vuote */
.position-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 60px;
    opacity: 0.4;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.position-placeholder:hover {
    opacity: 0.7;
}

.placeholder-circle {
    width: 48px;
    height: 48px;
    border: 2px dashed white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

/* Card giocatore sul campo */
.player-card-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.player-card-field .player-photo-wrapper {
    position: relative;
    width: 80px;
    height: 128px;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.player-card-field .player-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-card-field .player-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #757575, #9e9e9e);
    color: white;
    font-size: 32px;
    font-weight: bold;
}

.player-card-field .player-role-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Legacy support per vecchio badge numero */
.player-card-field .player-number-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: #0061ff;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid white;
}

.player-card-field .player-name-label {
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 8px;
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card giocatore in panchina */
.player-card-bench {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.player-card-bench:hover {
    transform: translateY(-4px);
}

.player-card-bench .player-photo-wrapper {
    position: relative;
    width: 80px;
    height: 128px;
    border-radius: 10px;
    overflow: hidden;
    border: 3px solid #ddd;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.player-card-bench .player-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-card-bench .player-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #757575, #9e9e9e);
    color: white;
    font-size: 32px;
    font-weight: bold;
}

.player-card-bench .player-role-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Legacy support per vecchio badge numero */
.player-card-bench .player-number-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #757575;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

.player-card-bench .player-name-label {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Stato infortunato */
.player-card-bench.injured .player-photo-wrapper {
    border-color: #f44336;
}

.player-card-bench.injured .injury-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #f44336;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid white;
}

/* Foto placeholder (iniziali) */
.player-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: bold;
    font-size: 18px;
}

/* Card nella modal di selezione */
.player-selection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.player-selection-card:hover {
    border-color: #0061ff;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 97, 255, 0.2);
}

.player-selection-card .player-photo-wrapper {
    position: relative;
    width: 80px;
    height: 128px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.player-selection-card .player-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-selection-card .player-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 32px;
    font-weight: bold;
}

.player-selection-card .player-role-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Legacy support per vecchio badge numero */
.player-selection-card .player-number-badge {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #0061ff;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}

.player-selection-card .player-name-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.player-selection-card .player-role-label {
    font-size: 10px;
    color: #666;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Campo tattico formazioni */
.tactical-field-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    background: #2a7e4a;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.tactical-field-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.9;
}

.tactical-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 16px;
}

/* Responsive: mobile ottimizzato per sfruttare altezza schermo */
@media (max-width: 768px) {
    .tactical-field-container {
        max-width: 100%;
        aspect-ratio: 9/16; /* Molto più verticale su mobile */
        margin: 0 auto 20px;
    }

    .tactical-grid {
        gap: 6px;
        padding: 12px;
    }
}

/* Tablet e schermi medi */
@media (min-width: 769px) and (max-width: 1024px) {
    .tactical-field-container {
        aspect-ratio: 1/2; /* Intermedio tra mobile e desktop */
    }
}

@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
    }

    .tabs, button, .toast, .save-indicator {
        display: none !important;
    }

    .tab-content {
        display: block !important;
    }
}