/* ============================================================
   DESIGN SYSTEM (COMPONENTS) - JOLIBUT
   Atomes & Molécules réutilisables
   ============================================================ */

/* --- 1. BOUTONS (.cmp-btn) --- */
.cmp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 8px;
}
.cmp-btn:active { transform: scale(0.98); }
.cmp-btn--full { width: 100%; }

.cmp-btn--primary { background-color: var(--color-primary); color: #fff; }
.cmp-btn--success { background-color: var(--color-success); color: #fff; }
.cmp-btn--danger  { background-color: var(--color-danger);  color: #fff; }
.cmp-btn--neutral { background-color: #6c757d; color: #fff; }
.cmp-btn--light   { background-color: var(--color-light); color: var(--color-dark); border: 1px solid #ddd; }

/* --- 2. FORMULAIRES (.cmp-form, .cmp-input) --- */
.cmp-form-group { margin-bottom: 1rem; }
.cmp-form-label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: var(--color-dark); font-size: 0.9rem; }

.cmp-input-wrapper {
    position: relative;
    display: flex; align-items: center;
}
.cmp-input {
    width: 100%;
    padding: 12px;
    padding-left: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}
.cmp-input.has-icon { padding-left: 40px; }
.cmp-input:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px rgba(13,110,253,0.1); }

.cmp-input-icon {
    position: absolute; left: 10px;
    color: #adb5bd; pointer-events: none;
}

/* Widget Téléphone */
.cmp-phone-widget { position: relative; }
.cmp-phone-group { display: flex; }
.cmp-phone-trigger {
    display: flex; align-items: center; gap: 4px;
    padding: 0 12px;
    background: #f8f9fa; border: 1px solid #dee2e6;
    border-right: none; border-radius: 8px 0 0 8px;
    cursor: pointer; color: var(--color-dark); font-weight: 600;
}
.cmp-phone-input {
    border-radius: 0 8px 8px 0;
    flex-grow: 1;
}

/* --- 3. NAVIGATION TABS (.cmp-tabs) --- */
.cmp-tabs-nav {
    display: flex;
    background: #e9ecef;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 15px;
}
.cmp-tab-btn { 
    flex: 1; border: none; background: transparent; padding: 8px;
    border-radius: 8px; font-weight: 600; color: #6c757d; font-size: 0.9rem;
    transition: all 0.2s;
}
.cmp-tab-btn.active {
    background: #fff; color: var(--color-primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* --- 4. DASHBOARD CARDS (.cmp-dashboard-card) --- */
.cmp-dashboard-card {
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative; overflow: hidden;
    min-height: 140px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.cmp-dashboard-card:active { transform: scale(0.98); }

.cmp-card-icon { margin-bottom: 15px; position: relative; width: fit-content; }
.cmp-card-icon .material-icons { font-size: 36px; }

/* Variantes couleurs cartes */
.cmp-card--success .cmp-card-icon { color: var(--color-success); }
.cmp-card--warning .cmp-card-icon { color: var(--color-warning); }
.cmp-card--primary .cmp-card-icon { color: var(--color-primary); }
.cmp-card--info .cmp-card-icon    { color: #0dcaf0; }
.cmp-card--neutral .cmp-card-icon { color: #6c757d; }

.cmp-card-title { font-size: 1.1rem; font-weight: 700; color: var(--color-dark); line-height: 1.2; }
.cmp-card-desc { font-size: 0.8rem; color: #95a5a6; margin-top: 5px; display: block; }
.cmp-card-arrow { position: absolute; top: 15px; right: 15px; color: #e9ecef; }
.cmp-card-badge {
    position: absolute; top: -5px; right: -10px;
    background: var(--color-danger); color: white;
    font-size: 0.7rem; font-weight: bold; padding: 2px 6px;
    border-radius: 10px; border: 2px solid #fff;
}

/* --- 5. ITEM LISTS (.cmp-player-card, .cmp-match-card) --- */
.cmp-player-card, .cmp-match-card {
    background: #fff; border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03); border: 1px solid #f0f0f0;
    margin-bottom: 12px;
}

/* Player */
.cmp-player-card { padding: 12px; display: flex; align-items: center; }
.cmp-player-avatar {
    width: 40px; height: 40px; 
    /* Utilisation de la couleur primaire ou d'une couleur de repli si la variable n'est pas lue */
    background: var(--color-primary, #006AB3); 
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; margin-right: 15px; flex-shrink: 0;
}

.cmp-player-number {
    /* S'assurer que le numéro hérite de la couleur blanche de l'avatar */
    color: inherit; 
    font-weight: bold;
    font-size: 1rem;
}

.cmp-player-info { flex-grow: 1; min-width: 0; }
.cmp-player-name { font-size: 1rem; margin: 0; color: var(--color-dark); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-player-licence { font-size: 0.8rem; color: #999; }
.cmp-player-actions { display: flex; gap: 5px; }

/* Match */
.cmp-match-card { padding: 12px 16px; position: relative; cursor: pointer; transition: background 0.1s; }
.cmp-match-card:active { background: #fafafa; }
.cmp-match-header {
    display: flex; align-items: center; font-size: 0.85rem; color: #6c757d;
    margin-bottom: 10px; border-bottom: 1px solid #f8f9fa; padding-bottom: 6px;
}
.cmp-match-time { font-weight: 700; color: var(--color-dark); margin-right: 10px; }
.cmp-match-pitch { flex-grow: 1; display: flex; align-items: center; gap: 4px; }
.cmp-match-status { width: 8px; height: 8px; border-radius: 50%; }

.cmp-team-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cmp-team-name { flex-grow: 1; font-weight: 600; font-size: 0.95rem; color: #343a40; }
.cmp-team-logo { width: 24px; height: 24px; object-fit: contain; margin: 0 10px; }
.cmp-team-score { width: 30px; text-align: center; font-size: 1.1rem; background: #f8f9fa; border-radius: 6px; }
.cmp-match-action { position: absolute; top: 10px; right: 10px; color: var(--color-primary); opacity: 0.5; }

/* --- 6. UTILS BOUTONS ACTIONS (.btn-icon, .btn-action-stat) --- */
.btn-icon { background: none; border: none; padding: 5px; cursor: pointer; border-radius: 50%; }
.btn-icon:active { background: rgba(0,0,0,0.05); }

/* Boutons stats (Match Modal) */
.btn-action-stat {
    width: 36px; height: 36px; border-radius: 50%; border: 1px solid #ddd;
    display: flex; align-items: center; justify-content: center;
    background: white; color: #ccc; cursor: pointer; transition: all 0.2s;
    font-weight: bold; font-size: 0.9rem; position: relative;
}
.btn-action-stat.active-goal { background: var(--color-success); color: white; border-color: var(--color-success); }
.btn-action-stat.active-yellow { background: var(--color-warning); color: white; border-color: #e0a800; }
.btn-action-stat.active-red { background: var(--color-danger); color: white; border-color: #bd2130; }
.btn-action-stat.active-white { background: #fff; color: #333; border-color: #333; box-shadow: inset 0 0 0 2px #333; }

.goal-badge {
    position: absolute; top: -5px; right: -5px;
    background: var(--color-dark); color: white; font-size: 10px;
    width: 16px; height: 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

/* --- 7. SÉLECTEUR DE LANGUE (DROPDOWN) --- */
.cmp-lang-wrapper {
    display: flex; 
    justify-content: center; 
    margin-top: 16px; 
    padding-top: 20px; 
    border-top: 1px solid #f1f1f1;
}
.cmp-lang-dropdown {
    position: relative;
}
.cmp-lang-btn {
    display: flex; 
    align-items: center; 
    gap: 8px; 
    background: #fff; 
    border: 1px solid #dee2e6; 
    padding: 6px 14px; 
    border-radius: 50px; 
    cursor: pointer; 
    color: #495057; 
    font-size: 14px; 
    font-weight: 500; 
    transition: all 0.2s; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.cmp-lang-btn:hover { background: #f8f9fa; }

.cmp-lang-list {
    display: none; 
    position: absolute; 
    bottom: 100%; /* S'ouvre vers le haut */
    left: 50%; 
    transform: translateX(-50%); 
    margin-bottom: 8px; 
    background: #fff; 
    border: 1px solid #e9ecef; 
    border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); 
    min-width: 160px; 
    z-index: 1000; 
    overflow: hidden; 
    padding: 4px 0;
}
.cmp-lang-list.show { display: block; }

.cmp-lang-item {
    display: flex; 
    align-items: center; 
    gap: 10px; 
    padding: 10px 16px; 
    text-decoration: none; 
    font-size: 14px; 
    transition: background 0.2s;
}
.cmp-lang-item:hover { background-color: #f1f3f5; }
.cmp-lang-item.active { background-color: #f8f9fa; font-weight: 600; color: var(--color-primary, #006AB3); }
.cmp-lang-item:not(.active) { font-weight: 400; color: #495057; }

.cmp-lang-flag {
    width: 24px;  /* On s'aligne sur la taille native de l'API (24x18) */
    height: 18px;
    object-fit: cover; /* MAGIQUE : Empêche la déformation, remplit tout le rectangle */
    object-position: center; /* Centre l'image avant de rogner si besoin */
    border-radius: 2px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: block; /* Évite les mini-marges fantômes sous les images en HTML */
}

/* ============================================================
   3. MOBILE DATE SELECTOR (.mobile-date-selector)
   ============================================================ */
.mobile-date-selector select {
    /* Taille de police à 16px minimum pour bloquer le zoom auto sur Safari iOS */
    font-size: 16px !important; 
    padding: 6px 4px;
    cursor: pointer;
    background-color: var(--app-surface);
}

.mobile-date-selector .form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 106, 179, 0.25);
}

.mobile-date-selector .is-invalid {
    border-color: var(--app-accent) !important;
    background-color: #ffe6e6 !important;
    color: var(--app-accent);
}

/* ============================================================
   4. MAILLOT GRID SELECTOR (Briques de nombres)
   ============================================================ */
.maillot-brick {
    width: 52px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 12px;
    border: 2px solid #e9ecef;
    background: #ffffff;
    color: var(--app-primary, #006AB3);
    cursor: pointer;
    transition: all 0.1s ease;
    /* JOLIBUT: On force le overflow hidden sur le parent par sécurité, même si la solution gradient n'en a pas besoin */
    overflow: hidden; 
}

/* État désactivé (numéro pris) - CORRECTION DÉBORDEMENT BARRE */
.maillot-brick:disabled {
    background-color: #f8f9fa !important;
    color: #adb5bd !important; /* JOLIBUT: Texte encore plus estompé pour la lisibilité */
    border-color: #e9ecef !important;
    cursor: not-allowed !important;
    pointer-events: none;
    box-shadow: none !important;
    transform: none !important;

    /* CORRECTION JOLIBUT: On utilise un dégradé au lieu d'un élément ::after */
    /* Cela dessine une ligne parfaite de 2px à 135° à l'intérieur du carré */
    background-image: linear-gradient(135deg, transparent 48%, #ced4da 48%, #ced4da 52%, transparent 52%) !important;
}

/* JOLIBUT: On supprime l'ancien code ::after qui posait problème */
.maillot-brick:disabled::after {
    content: none !important;
}

.active-brick {
    background: var(--app-primary, #006AB3) !important;
    color: #fff !important;
    border-color: var(--app-primary, #006AB3) !important;
    transform: scale(1.1);
}

/* JOLIBUT : Pavés de date plus compacts pour éviter le scroll */
#date_grid_container .maillot-brick {
    width: 40px !important;   /* Réduction de 52px à 42px */
    height: 30px !important;
    font-size: 0.95rem !important;
    border-radius: 10px !important;
}

/* Ajustement spécifique pour les briques d'année (plus larges par nature) */
#date_grid_container .maillot-brick[style*="width:70px"] {
    width: 60px !important;   /* Réduction de 70px à 60px */
}

/* Réduction des marges entre sections dans le sélecteur de date */
#date_grid_container .mb-4 {
    margin-bottom: 1.25rem !important;
}

/* Feedback visuel lors de la mise à jour d'une carte */
.highlight-update {
    background-color: rgba(25, 135, 84, 0.1); /* Vert léger (success) */
    transition: background-color 0.5s ease;
    border-radius: 0 0 12px 12px;
}

/* Style pour carte complète */
.player-card-mobile.border-success {
    border-left-width: 6px !important;
}


/* ============================================================
   COMPOSANT PASSWORD V2 (Jolibut)
   ============================================================ */
.cmp-v2-container {
    display: flex;
    align-items: center;
    gap: 10px; /* Espace entre l'input et le bouton */
    width: 100%;
}

.cmp-v2-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.cmp-v2-input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #bdc3c7;
    font-size: 20px;
    pointer-events: none;
}

.cmp-v2-input {
    width: 100%;
    height: 45px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    padding: 0 12px;
    transition: all 0.2s ease;
}

.cmp-v2-input.has-icon {
    padding-left: 40px;
}

.cmp-v2-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.cmp-v2-toggle {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cmp-v2-toggle:hover {
    background-color: #f8f9fa;
    border-color: #ccc;
}

.cmp-v2-toggle .material-icons {
    color: #bdc3c7;
    font-size: 22px;
}

/* État actif du bouton (œil ouvert) */
.cmp-v2-toggle.active {
    border-color: var(--color-primary);
}

.cmp-v2-toggle.active .material-icons {
    color: var(--color-primary);
}

/* ============================================================
   BOUTON GOOGLE CONNECT
   ============================================================ */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 16px;
    margin-bottom: 1rem; /* Remplace la classe mb-3 */
    border-radius: 10px;
    background-color: #ffffff;
    color: #3c4043;
    font-weight: 500;
    font-family: 'Google Sans', Roboto, Arial, sans-serif;
    border: 1px solid #dadce0; /* Bordure standard Google */
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    font-size: 1rem;
}

.btn-google:hover, 
.btn-google:focus {
    background-color: #f8f9fa;
    color: #3c4043;
    outline: none;
}

.btn-google:hover {

    box-shadow: 0 1px 3px 1px rgba(60,64,67,0.15), 0 2px 6px 2px rgba(60,64,67,0.15);

}

.btn-google:active {
    background-color: #f1f3f4;
    box-shadow: none;
    transform: scale(0.99);
}

.btn-google img {
    width: 20px;
    height: 20px;
    margin-right: 12px;
}