/* =========================================================
   STYLES DU PORTAIL PUBLISHER [bgc_publisher_products]
   ========================================================= */

/* --- Formulaire Général --- */
.bgc-form label {
    font-weight: 600;
    color: #334155;
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.bgc-form input[type="text"],
.bgc-form input[type="number"],
.bgc-form input[type="date"],
.bgc-form textarea,
.bgc-form select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s;
}

.bgc-form input:focus,
.bgc-form textarea:focus,
.bgc-form select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.bgc-form-row { margin-bottom: 20px; }

/* --- Boutons --- */
.bgc-form .button-primary,
.bgc-form .button.button-primary {
    background: #0f172a;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: .2s;
    text-decoration: none;
    display: inline-block;
}
.bgc-form .button-primary:hover {
    background: #1e293b;
    transform: translateY(-1px);
}

/* --- Fieldsets & Sections --- */
.bgc-bulk-box {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    background: #fff;
}
.bgc-bulk-box legend {
    font-weight: 700;
    color: #1e293b;
    padding: 0 8px;
    font-size: 15px;
}


/* =========================================================
   AMÉLIORATION UI/UX (Langues, Territoires, Sleeves)
   ========================================================= */

/* --- 1. Game Language (Grille simple) --- */
.bgc-lang-grid-simple {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.bgc-lang-grid-simple .bgc-lang-card {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #f8fafc;
    overflow: hidden;
}
.bgc-lang-grid-simple .bgc-lang-head {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.bgc-lang-grid-simple .bgc-lang-head:hover {
    background: #f1f5f9;
}
/* Coche active (si supporté par le navigateur via :has) */
.bgc-lang-grid-simple .bgc-lang-head:has(input:checked) {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

/* --- 2. Distribution Rights (Langues & Territoires) --- */
.bgc-lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}
.bgc-lang-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    transition: all 0.2s;
}
.bgc-lang-head {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    background: #f8fafc;
    border-bottom: 1px solid transparent;
    border-radius: 8px;
}
.bgc-lang-card.is-active {
    border-color: #3b82f6;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.1);
}
.bgc-lang-card.is-active .bgc-lang-head {
    background: #eff6ff;
    border-bottom-color: #bfdbfe;
    border-radius: 8px 8px 0 0;
    color: #1e40af;
}

.bgc-territories {
    display: none; /* Caché par défaut, géré par JS */
    padding: 15px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 0 0 8px 8px;
}
.bgc-terr-item {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: #475569;
}
.bgc-terr-select-all {
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

/* --- 3. Sleeves Matcher (Nouveau) --- */
.bgc-sleeves-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}
.bgc-sleeve-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}
.bgc-sleeve-item:hover {
    border-color: #cbd5e1;
}
/* Si coché (via JS ou :has) */
.bgc-sleeve-item:has(input.bgc-sleeve-cb:checked) {
    background: #eff6ff;
    border-color: #3b82f6;
}
.bgc-sleeve-qty {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    display: none; /* Caché par défaut */
}


/* =========================================================
   CHAMPS SPÉCIFIQUES (Credits, Bulk)
   ========================================================= */

/* Credits (Repeater) */
.bgc-repeater-field { display: flex; gap: 8px; margin-bottom: 8px; }
.bgc-repeater-field input { flex-grow: 1; }
.bgc-remove-field {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    width: 32px;
    height: 36px; /* Hauteur input */
    border-radius: 6px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold;
}
.bgc-remove-field:hover { background: #fecaca; }
.bgc-add-field { 
    background: #f1f5f9; border: 1px solid #cbd5e1; color: #475569;
    padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.bgc-add-field:hover { background: #e2e8f0; color: #1e293b; }

/* Bulk Discounts */
.bgc-bulk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 15px;
}
.bgc-bulk-grid label {
    font-size: 12px;
    text-align: center;
    color: #64748b;
}
.bgc-bulk-grid input {
    text-align: center;
    font-weight: 700;
    color: #0f172a;
}


/* =========================================================
   UPLOADER D'IMAGES (Style corrigé)
   ========================================================= */

.bgc-image-uploader {
    position: relative;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
}

.bgc-image-uploader:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.bgc-image-uploader.has-image {
    border-style: solid;
    border-color: #10b981; /* Bordure verte si image */
    background: #fff;
}

.bgc-image-uploader-placeholder {
    text-align: center;
    color: #64748b;
    pointer-events: none; /* Laisse passer le clic */
    z-index: 2;
}

.bgc-image-uploader-placeholder .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    color: #94a3b8;
}

.bgc-image-preview {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 10px;
    box-sizing: border-box;
    z-index: 1;
    background: #fff;
}

/* Effet au survol quand image présente : on montre "Modifier" */
.bgc-image-uploader.has-image:hover .bgc-image-preview {
    opacity: 0.3;
}
.bgc-image-uploader.has-image .bgc-image-uploader-placeholder {
    opacity: 0;
}
.bgc-image-uploader.has-image:hover .bgc-image-uploader-placeholder {
    opacity: 1;
    color: #0f172a;
}


/* =========================================================
   ONGLETS & BADGES (Dashboard)
   ========================================================= */

.bgc-badge-counter {
    background: #ef4444;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 5px;
}

/* Modal de Stats */
.bgc-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6); /* Fond sombre moderne */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.bgc-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
}

/* =========================================================
   STYLES DU PORTAIL PUBLISHER (Mise à jour v2.0)
   ========================================================= */

/* --- WRAPPER --- */
.bgc-wrap { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
    font-family: sans-serif; 
    color: #333; 
}

/* --- MENU DE NAVIGATION --- */
.bgc-quick { 
    display: flex; 
    gap: 10px; 
    overflow-x: auto; 
    padding-bottom: 10px; 
    margin-bottom: 25px; 
    border-bottom: 1px solid #eee; 
}
.bgc-q-item { 
    display: flex; align-items: center; gap: 8px; padding: 10px 16px; 
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; 
    text-decoration: none; color: #475569; font-weight: 600; font-size: 14px; 
    white-space: nowrap; transition: all 0.2s;
}
.bgc-q-item:hover { 
    background: #fff; border-color: #cbd5e1; color: #1e293b; 
    transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
}
.bgc-q-item.is-active { 
    background: #fff; border-color: #0f172a; color: #0f172a; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
}
.bgc-q-item .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* --- BOÎTES (SECTIONS) --- */
.bgc-section-box, .bgc-box { 
    background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; 
    padding: 25px; margin-bottom: 30px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); 
    position: relative; 
}
.bgc-section-title, .bgc-box-header { 
    font-size: 1.1em; font-weight: 700; text-transform: uppercase; 
    letter-spacing: 0.5px; margin: 0 0 20px 0; padding-bottom: 10px; 
    border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: 10px; 
}

/* Couleurs spécifiques */
.bgc-box.blue, .bgc-section-blue { border-top: 4px solid #3b82f6 !important; } 
.bgc-box.blue .bgc-box-header, .bgc-section-blue .bgc-section-title { color: #1e40af !important; }

.bgc-box.purple, .bgc-section-purple { border-top: 4px solid #8b5cf6 !important; } 
.bgc-box.purple .bgc-box-header, .bgc-section-purple .bgc-section-title { color: #7c3aed !important; }

.bgc-box.green, .bgc-section-green { 
    border-top: 4px solid #10b981 !important; background: #f0fdf4 !important; border-color: #bbf7d0 !important; 
} 
.bgc-box.green .bgc-box-header, .bgc-section-green .bgc-section-title { 
    color: #166534 !important; border-bottom-color: #bbf7d0 !important; 
}

.bgc-box.orange, .bgc-section-orange { border-top: 4px solid #f59e0b !important; } 
.bgc-box.orange .bgc-box-header, .bgc-section-orange .bgc-section-title { color: #92400e !important; }

/* --- FORMULAIRES --- */
.bgc-field, .bgc-form-row { margin-bottom: 20px; }
.bgc-label, .bgc-form-row label { 
    font-weight: 600; color: #475569; display: block; margin-bottom: 6px; font-size: 14px; 
}
.bgc-input, .bgc-select, .bgc-textarea, 
.bgc-form input[type="text"], .bgc-form input[type="number"], .bgc-form input[type="date"], 
.bgc-form textarea, .bgc-form select { 
    width: 100%; border: 1px solid #cbd5e1; border-radius: 6px; padding: 10px 12px; 
    font-size: 14px; box-sizing: border-box; background: #fff; transition: all 0.2s; 
}
.bgc-input:focus, .bgc-form input:focus, .bgc-form textarea:focus, .bgc-form select:focus { 
    border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); outline: none; 
}
.bgc-help-text { 
    font-size: 12px; color: #64748b; margin-top: 4px; display: block; font-style: italic; 
}
.bgc-repeater-field { display: flex; gap: 5px; margin-bottom: 5px; }

/* --- GRILLES --- */
.bgc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.bgc-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.bgc-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media(max-width:768px) { 
    .bgc-grid-2, .bgc-grid-3, .bgc-grid-4 { grid-template-columns: 1fr !important; } 
}

/* --- TOOLTIPS (CORRECTIF FINAL) --- */
.bgc-tooltip { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center;
    margin-left: 6px; 
    vertical-align: middle; 
    position: relative; 
    cursor: help; 
    width: 16px; 
    height: 16px;
    background-color: #e2e8f0; /* Gris clair par défaut */
    border-radius: 50%;
    transition: all 0.2s ease;
}

/* Icône point d'interrogation */
.bgc-tooltip .dashicons { 
    font-size: 12px; 
    width: 12px; 
    height: 12px; 
    line-height: 1;
    color: #64748b; /* Gris moyen */
}

/* Changement de couleur au survol du rond */
.bgc-tooltip:hover {
    background-color: #cbd5e1;
}

/* LA BULLE (Contenu) */
.bgc-tooltip:hover::after {
    content: attr(data-tip); 
    position: absolute; 
    bottom: 130%; /* Place la bulle au-dessus */
    left: 50%; 
    transform: translateX(-50%);
    
    /* DESIGN DE LA BULLE */
    background-color: #1e293b !important; /* Fond NOIR/BLEUIT */
    color: #ffffff !important;             /* Texte BLANC PUR (Forcé) */
    
    padding: 8px 12px; 
    border-radius: 6px; 
    font-size: 12px; 
    font-weight: 500;
    line-height: 1.4;
    text-align: center; 
    white-space: normal; /* Permet le retour à la ligne */
    width: max-content;  /* Largeur adaptée au contenu */
    max-width: 250px;    /* Largeur max pour éviter les lignes trop longues */
    
    z-index: 99999;      /* Toujours au-dessus */
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.2);
    opacity: 0; 
    pointer-events: none; /* La souris passe au travers */
    animation: bgcTooltipFadeIn 0.2s forwards; /* Animation d'apparition */
}

/* LA PETITE FLÈCHE (Triangle) */
.bgc-tooltip:hover::before {
    content: ''; 
    position: absolute; 
    bottom: 90%; /* Juste sous la bulle */
    left: 50%; 
    margin-left: -5px; 
    border-width: 5px; 
    border-style: solid; 
    border-color: #1e293b transparent transparent transparent; /* Triangle Noir vers le bas */
    z-index: 99999;
    opacity: 0; 
    animation: bgcTooltipFadeIn 0.2s forwards;
}

@keyframes bgcTooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
/* =========================================================
   SECTION B2B STRATEGY (Territoires & Bulk)
   ========================================================= */

/* --- Grille des Territoires --- */
.bgc-territory-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.bgc-lang-card {
    background: #fff;
    border: 1px solid #fed7aa; /* Bordure Orange pâle */
    border-radius: 6px;
    overflow: hidden;
    min-width: 160px;
    flex: 1;
}

.bgc-lang-head {
    padding: 10px 12px;
    background: #fff7ed; /* Fond Orange très pâle */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
    color: #9a3412;
    transition: background 0.2s;
}

.bgc-lang-head:hover {
    background: #ffedd5;
}

.bgc-lang-head input[type="checkbox"] {
    margin-right: 8px;
}

.bgc-lang-head .dashicons {
    font-size: 16px;
    color: #d97706;
    transition: transform 0.2s;
}

/* Rotation de la flèche quand ouvert (si géré par JS class 'open') */
.bgc-lang-head .dashicons.open {
    transform: rotate(180deg);
}

.bgc-territories {
    display: none; /* Caché par défaut (Le JS l'ouvre) */
    padding: 12px;
    border-top: 1px solid #fed7aa;
    background: #fff;
}

.bgc-territories label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    font-weight: normal;
}

/* Style spécial pour "Select All" */
.bgc-terr-select-all {
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 8px;
    margin-bottom: 8px !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
}


/* --- Grille des Bulk Discounts (Remises) --- */
.bgc-bulk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); /* Colonnes auto-adaptatives */
    gap: 15px;
    margin-bottom: 15px;
}

.bgc-bulk-item {
    text-align: center;
    background: #f9fafb;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.bgc-bulk-item span {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.bgc-bulk-item input {
    width: 100% !important;
    text-align: center;
    font-weight: 600;
    padding: 6px !important;
    height: auto !important;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

/* --- Zone Clearance (Déstockage) --- */
.bgc-clearance-area {
    background: #fffbeb;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #fcd34d;
    margin-top: 25px;
}