/* ==========================================================================
   Bootstrap Overrides - Mapping des variables Bootstrap vers le thème
   Chargé APRES bootstrap.min.css et APRES theme.css
   ========================================================================== */

/* --- Boutons : variables locales mappées vers le thème --- */
.btn {
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: 0.3rem;
    --bs-btn-font-size: 15px;
    --bs-btn-font-weight: 600;
    --bs-btn-border-radius: var(--theme-btn-border-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Espacement automatique icône + texte dans les boutons */
.btn > .bi,
.btn > .fa,
.btn > .fas,
.btn > .far,
.btn > .fal,
.btn > i[class*="bi-"],
.btn > i[class*="fa-"] {
    margin-right: 0.4em;
}

/* Icônes personnalisées (icon-*) dans les boutons */
.btn > i[class^="icon-"],
.btn > i[class*=" icon-"] {
    margin-right: 0.3em;
    font-size: 1.2em;
    margin-left: -0.2em;
    display: inline-flex;
    align-items: center;
}

/* Icônes SVG custom dans les boutons (inline ou img) */
.btn > .btn-icon,
.btn > svg.btn-icon {
    height: 1.4em;
    width: auto;
    margin-right: 0.4em;
    vertical-align: -0.25em;
    fill: currentColor;
    /* Amélioration du rendu SVG (antialiasing) */
    shape-rendering: geometricPrecision;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.btn-primary {
    --bs-btn-color: var(--theme-white-color);
    --bs-btn-bg: var(--theme-primary);
    --bs-btn-border-color: var(--theme-primary);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-link-hover-color);
    --bs-btn-hover-border-color: var(--theme-link-hover-color);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-link-hover-color);
    --bs-btn-active-border-color: var(--theme-link-hover-color);
    --bs-btn-disabled-color: var(--theme-white-color);
    --bs-btn-disabled-bg: var(--theme-primary);
    --bs-btn-disabled-border-color: var(--theme-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--theme-primary);
    --bs-btn-border-color: var(--theme-primary);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-primary);
    --bs-btn-hover-border-color: var(--theme-primary);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-primary);
    --bs-btn-active-border-color: var(--theme-primary);
    --bs-btn-disabled-color: var(--theme-primary);
    --bs-btn-disabled-border-color: var(--theme-primary);
}

.btn-secondary {
    --bs-btn-color: var(--theme-white-color);
    --bs-btn-bg: var(--theme-secondary);
    --bs-btn-border-color: var(--theme-secondary);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-text-dark);
    --bs-btn-hover-border-color: var(--theme-text-dark);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-text-dark);
    --bs-btn-active-border-color: var(--theme-text-dark);
}

.btn-outline-secondary {
    --bs-btn-color: var(--theme-secondary);
    --bs-btn-border-color: var(--theme-secondary);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-secondary);
    --bs-btn-hover-border-color: var(--theme-secondary);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-secondary);
    --bs-btn-active-border-color: var(--theme-secondary);
}

.btn-outline-text-light {
    --bs-btn-color: var(--theme-text-light);
    --bs-btn-border-color: var(--theme-text-light);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-text-light);
    --bs-btn-hover-border-color: var(--theme-text-light);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-text-light);
    --bs-btn-active-border-color: var(--theme-text-light);
    --bs-btn-disabled-color: var(--theme-text-light);
    --bs-btn-disabled-border-color: var(--theme-text-light);
}

.btn-outline-text-muted {
    --bs-btn-color: var(--theme-text-muted);
    --bs-btn-border-color: var(--theme-text-muted);
    --bs-btn-hover-color: var(--theme-white-color);
    --bs-btn-hover-bg: var(--theme-text-muted);
    --bs-btn-hover-border-color: var(--theme-text-muted);
    --bs-btn-active-color: var(--theme-white-color);
    --bs-btn-active-bg: var(--theme-text-muted);
    --bs-btn-active-border-color: var(--theme-text-muted);
    --bs-btn-disabled-color: var(--theme-text-muted);
    --bs-btn-disabled-border-color: var(--theme-text-muted);
}

.btn-outline-primary-light {
    --bs-btn-color: var(--theme-primary-light);
    --bs-btn-border-color: var(--theme-primary-light);
    --bs-btn-hover-color: var(--theme-text-dark);
    --bs-btn-hover-bg: var(--theme-primary-light);
    --bs-btn-hover-border-color: var(--theme-primary-light);
    --bs-btn-active-color: var(--theme-text-dark);
    --bs-btn-active-bg: var(--theme-primary-light);
    --bs-btn-active-border-color: var(--theme-primary-light);
    --bs-btn-disabled-color: var(--theme-primary-light);
    --bs-btn-disabled-border-color: var(--theme-primary-light);
}

/* --- Liens --- */
a {
    --bs-link-color-rgb: var(--theme-primary-rgb);
    --bs-link-hover-color-rgb: var(--theme-primary-rgb);
}

/* --- Texte --- */
.text-primary {
    color: var(--theme-primary) !important;
}

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

/* --- Backgrounds --- */
.bg-primary {
    background-color: var(--theme-primary) !important;
}

.bg-secondary {
    background-color: var(--theme-secondary) !important;
}

/* --- Bordures --- */
.border-primary {
    border-color: var(--theme-primary) !important;
}

.border-secondary {
    border-color: var(--theme-secondary) !important;
}

/* --- Texte muted : forcer l'utilisation de la variable thème --- */
.text-muted {
    color: var(--theme-text-muted) !important;
}

/* --- Typographie : small --- */
small, .small {
    font-size: calc(var(--own-font-size, 1em) * 0.8);
}

/* --- Formulaires : focus ring couleur primaire --- */
.form-control:focus,
.form-select:focus {
    border-color: var(--theme-primary-light);
    box-shadow: 0 0 0 0.25rem rgba(var(--theme-primary-rgb), 0.25);
}

.form-check-input:checked {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.form-check-input:focus {
    border-color: var(--theme-primary-light);
    box-shadow: 0 0 0 0.25rem rgba(var(--theme-primary-rgb), 0.25);
}

