/*
 * cojep.css
 * Emplacement : public/assets/css/cojep.css
 * 
 * Styles spécifiques pour les pages de la Coupe Cojep
 * Préservation du design existant des tableaux avec améliorations mineures
 */

/* ===== STYLES POUR LA PAGE COUPE COJEP ===== */

/* Override du main-content pour les pages cojep */
body .main-content {
    min-height: auto !important;
    height: auto !important;
    max-height: none !important;
}

/* Override des conteneurs Materialize pour les pages cojep */
.container {
    height: auto !important;
    max-height: none !important;
}

.row {
    height: auto !important;
    max-height: none !important;
}

.col {
    height: auto !important;
    max-height: none !important;
}

/* Hero section pour la page Coupe Cojep */
.cojep-hero {
    background: linear-gradient(135deg, rgba(25, 118, 210, 0.9), rgba(66, 165, 245, 0.9)), 
                url('<?= base_url('assets/bandeaux/cojep-bg.jpg') ?>') no-repeat center center/cover;
    min-height: 400px;
}

/* Amélioration des cartes de sélection de tournoi */
.tournament-selector-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.tournament-selector-card:hover {
    box-shadow: var(--shadow-medium);
}

.tournament-selector-card .card-title {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.tournament-selector-card .card-title i {
    color: var(--primary-color);
}

/* Amélioration de la liste des tournois */
.tournament-list {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.tournament-list .collection-item {
    border-bottom: 1px solid var(--border-light) !important;
    transition: var(--transition);
    padding: 16px 20px !important;
}

.tournament-list .collection-item:hover {
    background: var(--bg-light) !important;
    padding-left: 25px !important;
}

.tournament-list .collection-item:last-child {
    border-bottom: none !important;
}

/* Badges pour les statuts de tournoi */
.tournament-status-badge {
    border-radius: 20px !important;
    font-size: 0.8rem !important;
    padding: 4px 12px !important;
    font-weight: 500 !important;
}

/* ===== STYLES POUR LA VUE DÉTAILLÉE DU TOURNOI ===== */

/* Container principal pour les tableaux - RESTAURÉ ET AMÉLIORÉ */
.bracket-tree-container {
    position: relative;
    overflow: visible; /* Pas de scroll */
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    margin-bottom: 30px;
    width: 100%;
    min-height: 1550px !important; /* Hauteur optimisée pour contenir le tableau */
    height: auto !important; /* Forcer la hauteur automatique */
    max-height: none !important; /* Supprimer toute limitation de hauteur */
    display: flex;
    justify-content: center; /* Centrer le contenu horizontalement */
    align-items: flex-start; /* Aligner le contenu en haut */
    padding-top: 50px; /* Marge en haut raisonnable */
}

/* Conteneur spécifique pour le tableau consolante (plus petit) */
#bracket-consol .bracket-tree-container {
    min-height: 840px !important; /* Hauteur parfaite pour le tableau consolante */
}

.bracket-tree {
    position: relative;
    min-width: 1000px;
    height: auto;
    padding: 20px 0 40px 0; /* 20px en haut, 40px en bas pour la marge */
    overflow: visible; /* Permettre le débordement horizontal */
    flex-shrink: 0; /* Empêcher la réduction de taille */
}

/* Niveaux de l'arbre - RESTAURÉ AVEC POSITIONNEMENT ABSOLU */
.tree-level {
    position: absolute !important;
    top: 0;
    left: 0; /* Position par défaut, sera surchargée par JavaScript */
    width: 200px;
    height: 100%;
    z-index: 2; /* S'assurer que les niveaux sont au-dessus des lignes de connexion */
}

.level-title {
    text-align: center;
    margin-bottom: 20px;
    padding: 10px;
    background: var(--bg-light);
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-light);
}

.round-title {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.round-date {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-top: 5px;
}

.matches-container {
    position: relative;
    height: 100%;
    padding-top: 20px;
    width: 100%;
    overflow: visible;
    /* Retour au positionnement absolu pour tous les matchs */
}

/* Cartes de match - PRÉSERVÉ avec améliorations mineures */
.match-card {
    background: white;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-small);
    padding: 15px;
    min-width: 180px;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
    margin: 0; /* Supprimer toute marge par défaut */
    position: relative; /* Position par défaut, sera surchargée par JavaScript */
}

/* Espacement supplémentaire pour les groupes de matchs */
.match-card.group-separator {
    margin-top: 15px; /* Espacement supplémentaire entre les groupes */
}

.match-card:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
}

.match-header {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 0.9rem;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
}

.team-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-radius: var(--border-radius-small);
    transition: var(--transition);
}

.team-container.winner {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
    font-weight: 600;
}

.team-container.loser {
    background: rgba(244, 67, 54, 0.05);
    opacity: 0.7;
}

.team-name {
    flex: 1;
    font-size: 0.9rem;
    padding: 0 8px;
    color: var(--text-dark);
}

.team-score {
    font-weight: 600;
    color: var(--primary-color);
    min-width: 25px;
    text-align: center;
    font-size: 1rem;
}

.vs {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 5px 0;
    font-weight: 500;
}

/* Lignes de connexion - AMÉLIORÉES */
.connection-lines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.connection-line {
    position: absolute;
    background: var(--primary-color);
    z-index: 1;
    opacity: 0.7;
}

.horizontal-line {
    height: 3px;
}

.vertical-line {
    width: 3px;
}

/* Vue mobile - PRÉSERVÉ avec améliorations */
.mobile-bracket-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.mobile-round-section {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.mobile-round-title {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 15px 20px;
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-round-title i {
    font-size: 1.2rem;
}

.mobile-round-date {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-left: auto;
}

.mobile-matches-container {
    padding: 20px;
}

.mobile-match-card {
    background: var(--bg-light);
    border-radius: var(--border-radius-small);
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.mobile-match-card:hover {
    background: white;
    box-shadow: var(--shadow-light);
}

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

/* Responsive pour les tableaux */
@media (max-width: 768px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-view {
        display: block;
    }
    
    .bracket-tree-container {
        padding: 10px;
        margin: 10px 0;
    }
    
    .match-card {
        min-width: 160px;
        padding: 12px;
    }
    
    .team-name {
        font-size: 0.8rem;
    }
    
    .match-header {
        font-size: 0.8rem;
    }
}

@media (min-width: 769px) {
    .desktop-view {
        display: block;
    }
    
    .mobile-view {
        display: none;
    }
}

/* ===== AMÉLIORATIONS GÉNÉRALES POUR L'INTÉGRATION ===== */

/* Titre de section pour les pages Cojep */
.cojep-section-title {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-dark);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.cojep-section-title i {
    color: var(--primary-color);
    font-size: 2rem;
}

/* Bouton de retour amélioré */
.cojep-back-button {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius-small);
    padding: 10px 20px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
    margin-bottom: 20px;
}

.cojep-back-button:hover {
    background: white;
    box-shadow: var(--shadow-light);
    color: var(--primary-color);
    text-decoration: none;
}

/* Indicateurs de statut */
.tournament-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.tournament-status.draft {
    background: rgba(158, 158, 158, 0.1);
    color: #9e9e9e;
}

.tournament-status.active {
    background: rgba(33, 150, 243, 0.1);
    color: #2196f3;
}

.tournament-status.completed {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
}

/* Animation pour les éléments qui apparaissent */
.cojep-fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.cojep-fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Amélioration des sélecteurs Materialize dans le contexte Cojep */
.cojep-select-wrapper .select-wrapper input.select-dropdown {
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-small);
    padding: 12px 16px;
    transition: var(--transition);
}

.cojep-select-wrapper .select-wrapper input.select-dropdown:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Messages d'état */
.cojep-info-message {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #1976d2;
    padding: 15px 20px;
    border-radius: var(--border-radius-small);
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cojep-info-message i {
    font-size: 1.2rem;
}

/* Assurer la compatibilité avec le thème général */
.cojep-container {
    background: var(--bg-lighter);
    min-height: calc(100vh - var(--nav-height));
    padding-top: 20px;
}

.cojep-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.cojep-card-content {
    padding: 24px;
}

.cojep-card-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cojep-card-title i {
    color: var(--primary-color);
}