/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
}

/* Tablettes */
@media (max-width: 992px) {
    .card-header h5 {
        font-size: 0.95rem;
    }
    
    .table-info {
        min-width: 80px;
        font-size: 0.85rem;
        padding: 0.25rem 0.5rem;
    }
    
    .match-info {
        font-size: 0.9rem;
    }
    
    .score {
        font-size: 1rem;
    }
}

/* Smartphones - Portrait */
@media (max-width: 768px) {
    body {
        padding: 0.3rem 0;
        font-size: 0.85rem;
    }

    .container {
        padding: 0 8px;
    }

    .card {
        margin-bottom: 0.5rem;
    }

    .card-header {
        padding: 0.4rem 0.6rem;
    }

    .card-header h5 {
        font-size: 0.9rem;
    }

    .card-body {
        padding: 0.4rem;
    }

    .match {
        padding: 0.4rem;
        margin-bottom: 0.3rem;
    }

    /* Passer en mode colonne sur mobile */
    .match .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .table-info {
        width: 100%;
        margin-bottom: 0.4rem;
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .round-name {
        display: block;
        margin-left: 0;
        margin-top: 0.2rem;
    }

    .match-info {
        margin-left: 0 !important;
        width: 100%;
    }

    .match-info .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .score {
        font-size: 0.95rem;
        margin: 0.3rem 0;
        display: block;
    }

    .race-to {
        display: block;
        margin: 0.2rem 0;
    }

    .duration {
        font-size: 0.75rem;
        margin-top: 0.3rem;
        display: block;
    }

    /* Next players - mode colonne */
    .next-players .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .next-players .table-info {
        width: 100%;
        margin-bottom: 0.4rem;
    }

    .next-players .ms-3 {
        margin-left: 0 !important;
        margin-top: 0.3rem;
        width: 100%;
    }

    /* Légende */
    .legend {
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    .legend-item {
        margin-bottom: 0.4rem;
    }

    .legend-color {
        width: 15px;
        height: 15px;
    }

    /* Timer header */
    .timer {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
        transition: color 0.3s ease, font-weight 0.3s ease;
    }

    #countdown {
        display: inline-block;
        min-width: 30px;
        text-align: center;
    }

    .card-header .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-header .timer {
        width: 100%;
        text-align: center;
        float: none;
    }

    /* Timeout et Timer messages */
    .timeout-active,
    .timer-active {
        display: block;
        margin-top: 0.3rem;
        font-size: 0.8rem;
    }

    /* Formulaire */
    .form-row {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 5px;
    }

    .form-row label {
        width: 100%;
    }

    .form-row select,
    .form-row input {
        width: 100% !important;
        min-width: auto !important;
    }

    .btn {
        width: 100%;
    }

    /* Lien Cuescore */
    .card-header a img {
        transform: scale(1.5) !important;
    }
}

/* Très petits écrans */
@media (max-width: 480px) {
    body {
        font-size: 0.8rem;
    }

    .card-header h5 {
        font-size: 0.85rem;
    }

    .table-info {
        font-size: 0.75rem;
        padding: 0.25rem 0.4rem;
    }

    .score {
        font-size: 0.9rem;
    }

    .match-info {
        font-size: 0.8rem;
    }

    .duration {
        font-size: 0.7rem;
    }

    .legend {
        font-size: 0.75rem;
    }
}

/* Mode paysage sur mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .match .d-flex {
        flex-direction: row;
        align-items: center !important;
    }

    .table-info {
        width: auto;
        margin-bottom: 0;
        margin-right: 0.5rem;
    }

    .match-info {
        margin-left: 0.5rem !important;
    }

    .match-info .d-flex {
        flex-direction: row;
        align-items: center !important;
    }

    .duration {
        margin-top: 0;
        display: inline;
    }

    .score {
        display: inline;
        margin: 0 0.3rem;
    }
}

/* Tablettes en portrait */
@media (min-width: 768px) and (max-width: 992px) {
    .container {
        padding: 0 20px;
    }

    .match .d-flex {
        flex-wrap: wrap;
    }

    .match-info .d-flex {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Impression */
@media print {
    body {
        background-color: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }

    .timer,
    .btn,
    form {
        display: none;
    }

    .match {
        break-inside: avoid;
    }
}

/* Classes utilitaires pour le responsive */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    /* Texte plus compact sur mobile */
    .text-truncate-mobile {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Meilleure gestion des noms longs */
.match-info {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Éviter que les tables disponibles prennent trop de place */
@media (max-width: 768px) {
    .available-table {
        font-size: 0.85rem;
        padding: 0.4rem;
    }
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #34495e;
    --accent-color: #3498db;
    --background-color: #f5f6fa;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --success-color: #2ecc71;
    --warning-color: #e74c3c;
}

body {
    background-color: var(--background-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 0.5rem 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    margin-bottom: 0.75rem;
    background: var(--card-background);
    animation: fadeIn 0.5s ease-in-out;
}

.card-header {
    background-color: var(--primary-color); 
    color: white;
    border-radius: 8px 8px 0 0 !important;
    padding: 0.5rem 1rem;
    min-height: auto;
}

.card-header h5 {
    margin: 0;
    font-size: 1rem;
}

.card-body {
    padding: 0.5rem;
}

.match {
    padding: 0.5rem;
    margin-bottom: 0.4rem;
    border-radius: 6px;
    background-color: var(--card-background);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.match:hover {
    transform: translateY(-2px);
}

.match:last-child {
    margin-bottom: 0;
}

.match.alert {
    background-color: rgba(231, 76, 60, 0.1);
    border-left: 4px solid var(--warning-color);
}

.table-info {
    background-color: var(--secondary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
    min-width: 100px;
    display: inline-block;
    text-align: center;
    font-size: 0.9rem;
}

.score {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
    margin: 0 0.5rem;
}

.duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.duration-warning {
    color: var(--warning-color);
    font-weight: 600;
}

.next-players {
    padding: 0.5rem;
    background-color: rgba(52, 152, 219, 0.1);
    border-left: 4px solid var(--accent-color);
    margin-bottom: 0.4rem;
    border-radius: 6px;
}

.next-players:last-child {
    margin-bottom: 0;
}

.available-table {
    padding: 0.5rem;
    margin-bottom: 0.4rem;
    background-color: rgba(46, 204, 113, 0.1);
    border-left: 4px solid var(--success-color);
    border-radius: 6px;
    font-weight: 500;
    color: var(--success-color);
}

.available-table:last-child {
    margin-bottom: 0;
}

.round-name {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-left: 0.4rem;
}

.timer {
    float: right;
    color: var(--text-secondary);
    font-size: 0.8rem;
    background-color: rgba(52, 152, 219, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
}

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

.race-to {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    margin-left: 0.5rem;
}
.match.alert-finishing {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;  /* couleur jaune/orange pour "bientôt terminé" */
}

.match.alert-overtime {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;  /* couleur rouge pour "hors délai" */
}

.legend {
    margin-top: 1rem;
    padding: 0.5rem;
    font-size: 0.9rem;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.3rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    border-radius: 4px;
}

.legend-finishing {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
}

.legend-overtime {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid #dc3545;
}            

/* Styles pour les formulaires */
.form-group {
margin-bottom: 1rem;
}

.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--text-primary);
}

.form-control,
.form-select {
width: 100%;
padding: 0.5rem;
font-size: 1rem;
border: 1px solid #ddd;
border-radius: 4px;
background-color: white;
transition: border-color 0.15s ease-in-out;
}

.form-control:focus,
.form-select:focus {
outline: none;
border-color: var(--accent-color);
box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.form-text {
display: block;
margin-top: 0.25rem;
font-size: 0.875rem;
}

.text-muted {
color: var(--text-secondary) !important;
}

/* Responsive pour formulaires */
@media (max-width: 768px) {
.form-label {
font-size: 0.9rem;
}

.form-control,
.form-select {
font-size: 0.9rem;
padding: 0.4rem;
}

.form-text {
font-size: 0.8rem;
}
}

/* Animation de clignotement pour timeout actif */
@keyframes blink-timeout {
0%, 49% {
    opacity: 1;
}
50%, 100% {
    opacity: 0.3;
}
}

.timeout-active {
animation: blink-timeout 1s infinite;
font-weight: bold;
color: #000; 
}

.timeout-finished {
font-weight: bold;
color: #fff; 
}

.timer-active {
animation: blink-timeout 1s infinite;
font-weight: bold;
color: #dc3545; 
}
