/**
 * Styles personnalisés globaux pour l'application
 * Réutilisables sur toutes les pages du site
 */

/* ========================================
   TYPOGRAPHY - POPPINS
   ======================================== */
body,
.app,
input,
button,
select,
textarea,
.btn,
.form-control,
.dropdown-menu,
.modal,
.card,
h1, h2, h3, h4, h5, h6 {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   FORM CONTROLS
   ======================================== */
.form-check-input {
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.form-control {
    transition: opacity 0.3s ease-in-out;
}

.input-disabled {
    opacity: 0.6;
}

/* ========================================
   CARTES (CARDS)
   ======================================== */
.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-content-top {
    flex-grow: 1;
}

.card-actions-bottom {
    margin-top: auto;
}

/* Effet hover sur les cartes - DÉSACTIVÉ */
/*
.card:not(.card-no-hover) {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.card:hover:not(.card-no-hover) {
    transform: translateY(-5px);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15) !important;
}
*/

/* ========================================
   ÉTATS DISABLED
   ======================================== */
.image-disabled {
    filter: grayscale(100%);
    opacity: 0.5;
}

.badge-disabled {
    color: #6c757d !important;
}

/* ========================================
   CARD HEADERS PAR TYPE (SPA / CENTRE)
   ======================================== */
.card-header-custom {
    transition: background-color 0.3s ease-in-out;
}

.card-header-spa {
    background: var(--bs-cyan);
}

.card-header-centre {
    background: var(--primary-bg-color);
}

.card-header-disabled {
    background: #6c757d !important;
}

/* ========================================
   INPUT GROUPS PAR TYPE (SPA / CENTRE)
   ======================================== */
.input-group-spa .input-group-text {
    background-color: var(--bs-cyan);
    border-color: var(--bs-cyan);
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.input-group-centre .input-group-text {
    background-color: var(--primary-bg-color);
    border-color: var(--primary-bg-color);
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.input-group-disabled .input-group-text {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

/* ========================================
   BADGES PAR TYPE (SPA / CENTRE)
   ======================================== */
.badge-spa {
    background-color: white;
    color: var(--bs-cyan);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: color 0.3s ease-in-out;
}

.badge-centre {
    background-color: white;
    color: var(--primary-bg-color);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: color 0.3s ease-in-out;
}

.dark-mode .badge-spa {
    background-color: white !important;
    color: var(--bs-cyan) !important;
}
.dark-mode .badge-centre {
    background-color: white !important;
    color: var(--primary-bg-color) !important;
}
.dark-mode .card-header-spa .badge-spa:not(.badge-disabled) {
    color: var(--bs-cyan) !important;
}
.dark-mode .card-header-centre .badge-centre:not(.badge-disabled) {
    color: var(--primary-bg-color) !important;
}
.dark-mode .badge-disabled {
    color: #6c757d !important;
    background-color: rgba(255,255,255,0.3) !important;
}
.dark-mode .card-header-custom .card-title {
    color: white !important;
}
.dark-mode .card-header-custom.text-white {
    color: white !important;
}
.dark-mode .card-body .form-label {
    color: #dedefd;
}
.dark-mode .card-body .description-scroll {
    background: rgba(255,255,255,0.05) !important;
    color: #dedefd;
}

/* ========================================
   BOUTONS PAR TYPE (SPA / CENTRE)
   ======================================== */
.btn-centre {
    background-color: var(--primary-bg-color);
    border-color: var(--primary-bg-color);
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.btn-centre:hover {
    background-color: var(--primary-bg-color);
    border-color: var(--primary-bg-color);
    opacity: 0.9;
    color: white;
}

.btn-spa {
    background-color: var(--bs-cyan);
    border-color: var(--bs-cyan);
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.btn-spa:hover {
    background-color: var(--bs-cyan);
    border-color: var(--bs-cyan);
    opacity: 0.9;
    color: white;
}

.btn-disabled-custom {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
    transition: background-color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.btn-disabled-custom:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* ========================================
   SWITCHS PAR TYPE (SPA / CENTRE) - Custom Switch (Sash)
   ======================================== */
.switch-centre .custom-switch-input:checked {
    background-color: var(--primary-bg-color);
    border-color: var(--primary-bg-color);
}

.switch-spa .custom-switch-input:checked {
    background-color: var(--bs-cyan);
    border-color: var(--bs-cyan);
}

.switch-disabled .custom-switch-input:checked {
    background-color: #6c757d;
    border-color: #6c757d;
}

.switch-disabled .custom-switch-input {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ========================================
   ANIMATIONS - BOUTONS AVEC CHANGEMENTS
   ======================================== */
@keyframes pulse-button-centre {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(var(--primary-rgb), 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0);
    }
}

@keyframes pulse-button-spa {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 202, 240, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(13, 202, 240, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(13, 202, 240, 0);
    }
}

@keyframes pulse-button-disabled {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(108, 117, 125, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(108, 117, 125, 0);
    }
}

.btn-has-changes-centre {
    animation: pulse-button-centre 1.5s infinite;
}

.btn-has-changes-spa {
    animation: pulse-button-spa 1.5s infinite;
}

.btn-has-changes-disabled {
    animation: pulse-button-disabled 1.5s infinite;
}

/* ========================================
   MESSAGES / ALERTES
   ======================================== */
.alert-success-dynamic {
    margin-bottom: 1.5rem;
}

/* ========================================
   LOGOS & IMAGES
   ======================================== */
.logo-preview-container {
    border-radius: 8px;
    max-height: 200px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.logo-preview-dark {
    background-color: #333 !important;
}

.logo-preview-img {
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
}

.logo-placeholder-icon {
    font-size: 48px;
}

/* Fix pour les logos de la sidebar */
.side-header .header-brand-img.desktop-logo,
.side-header .header-brand-img.light-logo1 {
    height: 2.5rem !important;
    width: auto;
}

/* Fix pour les logos du header */
.logo-horizontal {
    width: fit-content !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Mini logos masqués par défaut */
.logo-horizontal .header-brand-img.desktop-logo-mini,
.logo-horizontal .header-brand-img.light-logo1-mini {
    display: none !important;
}

.logo-horizontal .header-brand-img.desktop-logo,
.logo-horizontal .header-brand-img.light-logo1 {
    height: auto !important;
    max-height: 100% !important;
    width: auto;
    max-width: 150px !important;
}

/* Sur desktop, permettre au logo d'être plus grand */
@media (min-width: 992px) {
    .logo-horizontal .header-brand-img.desktop-logo,
    .logo-horizontal .header-brand-img.light-logo1 {
        max-width: 200px !important;
    }
}

/* Sur tablette/mobile : logo réduit "P" à gauche du burger */
@media (max-width: 991px) {
    .logo-horizontal {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        display: flex !important;
        align-items: center;
    }

    /* Masquer les logos complets */
    .logo-horizontal .header-brand-img.desktop-logo,
    .logo-horizontal .header-brand-img.light-logo1 {
        display: none !important;
    }

    /* Afficher les logos réduits */
    .logo-horizontal .header-brand-img.light-logo1-mini {
        display: block !important;
        height: 2rem;
        width: auto;
    }

    /* Logo réduit dark mode (masqué par défaut en light mode) */
    .logo-horizontal .header-brand-img.desktop-logo-mini {
        display: none !important;
        height: 2rem;
        width: auto;
    }

    /* Dark mode : afficher le mini logo blanc, masquer le couleur */
    .dark-mode .logo-horizontal .header-brand-img.light-logo1-mini {
        display: none !important;
    }
    .dark-mode .logo-horizontal .header-brand-img.desktop-logo-mini {
        display: block !important;
    }
}

/* ========================================
   COMMON UI ELEMENTS
   ======================================== */

/* Toast notifications */
.toast-container {
    z-index: 9999 !important;
}

/* Tooltips */
.tooltip-inner {
    max-width: 500px !important;
    width: auto !important;
    text-align: left !important;
    padding: 12px 16px !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

/* Icon sizes */
.icon-lg {
    font-size: 1.2em;
}

.icon-xl {
    font-size: 20px;
}

/* Cursor utilities */
.cursor-pointer {
    cursor: pointer;
}

.badge-clickable {
    cursor: pointer;
}

/* ========================================
   RESPONSIVE - ADAPTATIONS
   ======================================== */
@media (max-width: 768px) {
    .logo-preview-img {
        max-height: 160px;
    }

    .logo-placeholder-icon {
        font-size: 36px;
    }
}


/* ========================================
   COMPOSANTS PARTAGÉS (dédupliqués)
   ======================================== */

/* --- QUILL EDITOR (composant partagé) --- */
.quill-editor-container {
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    max-height: 400px;
    padding: 0;
    transition: border-color 0.2s;
}
.quill-editor-container:focus-within {
    border-color: var(--primary, #6259ca);
}
.quill-editor-container .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid #e9edf4;
    background: #f8f9fa;
    padding: 8px 12px;
    flex-shrink: 0;
}
.quill-editor-container .ql-toolbar .ql-formats {
    margin-right: 8px;
}
.quill-editor-container .ql-toolbar button,
.quill-editor-container .ql-toolbar .ql-picker-label {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 6px;
    height: 28px;
    width: auto;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.quill-editor-container .ql-toolbar .ql-picker {
    height: 28px;
}
.quill-editor-container .ql-toolbar .ql-picker-label svg {
    vertical-align: middle;
}
.quill-editor-container .ql-toolbar .ql-header .ql-picker-label {
    padding-right: 18px;
}
.quill-editor-container .ql-toolbar button:hover,
.quill-editor-container .ql-toolbar .ql-picker-label:hover {
    background: var(--primary-01, rgba(98, 89, 202, 0.1));
    border-color: var(--primary, #6259ca);
}
.quill-editor-container .ql-toolbar button.ql-active,
.quill-editor-container .ql-toolbar .ql-picker-label.ql-active {
    background: var(--primary-01, rgba(98, 89, 202, 0.1));
    border-color: var(--primary, #6259ca);
    color: var(--primary, #6259ca);
}
.quill-editor-container .ql-toolbar .ql-stroke {
    stroke: #495057;
}
.quill-editor-container .ql-toolbar .ql-fill {
    fill: #495057;
}
.quill-editor-container .ql-toolbar button:hover .ql-stroke,
.quill-editor-container .ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--primary, #6259ca);
}
.quill-editor-container .ql-toolbar button:hover .ql-fill,
.quill-editor-container .ql-toolbar button.ql-active .ql-fill {
    fill: var(--primary, #6259ca);
}
.quill-editor-container .ql-container.ql-snow {
    border: none;
    font-size: 14px;
    flex: 1;
    overflow-y: auto;
}
.quill-editor-container .ql-editor {
    padding: 15px;
    line-height: 1.6;
    min-height: 120px;
}
.quill-editor-container .ql-editor.ql-blank::before {
    font-style: normal;
    color: #adb5bd;
}
/* Quill bubble editor */
.quill-bubble-container {
    background: #fff;
    border: 1px solid #e9edf4;
    border-radius: 5px;
}
.quill-bubble-container .ql-container {
    border: none;
    font-size: 14px;
}
.quill-bubble-container .ql-editor {
    min-height: 80px;
    padding: 12px 15px;
    line-height: 1.6;
}
.quill-bubble-container .ql-editor.ql-blank::before {
    left: 15px;
    font-style: normal;
    color: #adb5bd;
}
/* Dark mode Quill */
.dark-mode .quill-editor-container {
    border-color: rgba(255,255,255,0.1);
}
.dark-mode .quill-editor-container .ql-toolbar.ql-snow,
.dark-mode .ql-toolbar.ql-snow {
    background: #30304d !important;
    border-color: rgba(255,255,255,0.1) !important;
}
.dark-mode .ql-snow .ql-formats,
.dark-mode .quill-editor-container .ql-toolbar .ql-formats {
    background: transparent !important;
}
.dark-mode .quill-editor-container .ql-toolbar button,
.dark-mode .quill-editor-container .ql-toolbar .ql-picker-label {
    color: #dedefd;
}
.dark-mode .quill-editor-container .ql-toolbar .ql-stroke {
    stroke: #dedefd;
}
.dark-mode .quill-editor-container .ql-toolbar .ql-fill {
    fill: #dedefd;
}
.dark-mode .quill-editor-container .ql-toolbar .ql-picker-options {
    background: #2a2a4a;
    border-color: rgba(255,255,255,0.1);
}
.dark-mode .quill-editor-container .ql-toolbar .ql-picker-item {
    color: #dedefd;
}
.dark-mode .quill-editor-container .ql-container.ql-snow {
    border-color: rgba(255,255,255,0.1);
}
.dark-mode .quill-editor-container .ql-editor {
    color: #dedefd !important;
}
.dark-mode .quill-editor-container .ql-editor p,
.dark-mode .quill-editor-container .ql-editor span,
.dark-mode .quill-editor-container .ql-editor li,
.dark-mode .quill-editor-container .ql-editor h1,
.dark-mode .quill-editor-container .ql-editor h2,
.dark-mode .quill-editor-container .ql-editor h3 {
    color: #dedefd !important;
}
.dark-mode .quill-editor-container .ql-editor.ql-blank::before {
    color: rgba(255,255,255,0.35);
}
.dark-mode .quill-editor-container .ql-snow .ql-picker.ql-header .ql-picker-label::before,
.dark-mode .quill-editor-container .ql-snow .ql-picker.ql-header .ql-picker-item::before {
    color: #dedefd;
}
.dark-mode .quill-editor-container .ql-toolbar .ql-color-picker .ql-picker-label {
    background: transparent !important;
}
.dark-mode .quill-editor-container .ql-toolbar .ql-color-picker .ql-picker-label svg .ql-stroke {
    stroke: #dedefd !important;
}
.dark-mode .quill-bubble-container {
    background: #2a2a4a;
    border-color: rgba(255,255,255,0.1);
}
.dark-mode .quill-bubble-container .ql-editor {
    color: #dedefd;
}
.dark-mode .quill-bubble-container .ql-editor.ql-blank::before {
    color: rgba(255,255,255,0.35);
}
.dark-mode input[type="date"] {
    color-scheme: dark !important;
}

/* --- IMAGE LIBRARY --- */
.image-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
    padding: 5px;
}

.image-library-item {
    aspect-ratio: 16/9;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: all 0.2s;
    background: #f8f9fa;
    position: relative;
}

.image-source-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 0.6rem;
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* --- IMAGE SELECTOR (composant partagé) --- */
.image-selector {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: transparent;
}
.image-selector:hover {
    border-color: var(--primary-bg-color, #667eea);
    background: rgba(102, 126, 234, 0.05);
}
.image-selector img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 4px;
}
.image-selector .placeholder {
    color: #fff0;
    background: transparent;
    cursor: pointer;
}
.image-selector .placeholder i {
    font-size: 2.5rem !important;
    color: var(--primary-bg-color, #667eea);
    opacity: 0.6;
    cursor: pointer;
}
.image-selector .placeholder p {
    color: var(--primary-bg-color, #667eea);
    font-size: 0.8rem;
}
.image-selector:hover .placeholder i {
    opacity: 1;
}
.dark-mode .image-selector {
    border-color: rgba(255,255,255,0.15);
    background: #2a2a4a;
}
.dark-mode .image-selector:hover {
    background: #333360 !important;
    border-color: var(--primary-bg-color, #0162e8) !important;
}
.dark-mode .image-selector .placeholder i {
    color: var(--primary-bg-color, #0162e8) !important;
}
.dark-mode .image-selector .placeholder span,
.dark-mode .image-selector .placeholder p {
    color: var(--primary-bg-color, #0162e8) !important;
}

/* --- EMPTY STATE --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.dark-mode .empty-state {
    background: #2a2a4a;
    border-color: rgba(255,255,255,0.15);
}

/* --- DRAG & DROP --- */
.drag-handle {
    cursor: grab;
    color: #adb5bd;
    font-size: 1.2rem;
    padding: 0 8px;
}

.dark-mode .slider-drag-handle {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.1);
}

.sortable-ghost {
    opacity: 0.4;
}

.sortable-chosen {
    background-color: #f8f9fa;
}

.dark-mode .sortable-chosen {
    background-color: rgba(255,255,255,0.05);
}

/* --- BOUTONS ACTION --- */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- BADGES IMAGE --- */
.badge-centre {
    background-color: var(--primary-bg-color);
    color: white;
}

.badge-commune {
    background-color: #6c757d;
    color: white;
}

