/* Tabler-custom Variables Tabler surchargées - Thème ROUGE #d63939 */
:root {
    --tblr-primary: #d63939;
    --tblr-primary-rgb: 214, 57, 57;
    --tblr-link-color: #d63939;
    --tblr-link-hover-color: #b52b2b;
    --tblr-font-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================================
   SURCHARGES DE THÈME TABLER (global)
   ============================================================ */

.bg-primary, .btn-primary, .badge.bg-primary {
    background-color: #d63939 !important;
}

.btn-primary {
    border-color: #d63939;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: #b52b2b;
    border-color: #b52b2b;
}

.text-primary {
    color: #d63939 !important;
}

.border-primary {
    border-color: #d63939 !important;
}

/* Navigation active en rouge */
.nav-link.active, .navbar-nav .active > .nav-link {
    color: #d63939;
}

/* Bottom Navigation - Bouton central en rouge */
.fixed-bottom .btn-primary {
    background-color: #d63939;
    border-color: #d63939;
    box-shadow: 0 4px 12px rgba(214, 57, 57, 0.4);
}

/* Formulaires focus en rouge */
.form-control:focus, .form-select:focus {
    border-color: #d63939;
    box-shadow: 0 0 0 0.25rem rgba(214, 57, 57, 0.25);
}

/* Optimisation tactile mobile */
.btn {
    min-height: 48px;
    touch-action: manipulation;
}

.form-control {
    font-size: 16px;
    min-height: 48px;
}

/* Header/navbar custom rouge subtil */
.navbar-brand-autodark {
    color: #d63939 !important;
}

/* Alertes adaptées (thème rouge) */
.alert-success {
    background-color: rgba(214, 57, 57, 0.1);
    border-color: rgba(214, 57, 57, 0.2);
    color: #d63939;
}

/* Status en ligne (thème rouge) */
.text-success {
    color: #d63939 !important;
}






/* ============================================================
   DETAIL PAGE (conservé ici car utilisé sur plusieurs pages)
   ============================================================ */

/* Mode édition vs lecture */
.detail-page-view-mode {
    border-bottom: 1px dashed transparent;
    transition: all 0.2s;
}

.detail-page-edit-mode {
    animation: detail-page-fadeIn 0.2s ease-in;
}

@keyframes detail-page-fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Boutons verrouillés (SIRET manquant) */
.detail-page-btn-locked {
    opacity: 0.45;
    cursor: not-allowed;
}

.detail-page-siret-lock-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 0.7rem;
    opacity: 0.8;
}

@media (max-width: 576px) {
    .detail-page-interest-btn { min-width: 60px !important; }
}

/* ============================================================
   TIMELINE VERTICALE MOBILE
   ============================================================ */

.timeline {
    position: relative;
    padding-left: 20px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e6e7e9;
}

.timeline-item {
    position: relative;
    padding-left: 30px;
}

.timeline-marker {
    position: absolute;
    left: -5px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1;
}

.timeline-content {
    flex: 1;
}

/* Cards tactiles */
.timeline .card {
    touch-action: pan-y;
}

/* ============================================================
   MODAL PLANNING
   ============================================================ */

/* Timeline équilibrée - 5 jours = 100% */
.rdv-timeline-balanced {
    display: flex;
    gap: 6px; /* Un peu moins que gap-2 (8px) */
}

.rdv-timeline-balanced .rdv-day {
    flex: 1 1 0;      /* Chaque jour prend 1 part égale */
    min-width: 0;     /* Permet le shrink */
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* Effet tactile mobile */
.rdv-timeline-balanced .rdv-day:active {
    transform: scale(0.96);
}

/* Jour actif */
.rdv-timeline-balanced .rdv-day.active {
    background-color: var(--tblr-primary) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(32, 107, 196, 0.3);
}

/* Jour inactif */
.rdv-timeline-balanced .rdv-day:not(.active) {
    background-color: #ffffff;
    color: #64748b;
}

/* Aujourd'hui - petit indicateur visuel */
.rdv-timeline-balanced .rdv-day.today:not(.active) {
    border: 2px solid var(--tblr-primary);
    color: var(--tblr-primary);
    background-color: #e7f1ff;
}

/* Numéro du jour */
.rdv-timeline-balanced .rdv-day-num {
    font-size: 1.35rem;
    line-height: 1;
    font-weight: 700;
}

/* Nom du jour (Lun, Mar...) */
.rdv-timeline-balanced .rdv-day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.8;
}

/* Indicateur "RDV présents" - petit point sous le numéro */
.rdv-timeline-balanced .rdv-day.has-rdv::after {
    content: '';
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    margin: 3px auto 0;
    opacity: 0.6;
}

/* Weekend (optionnel si tu veux afficher Sam/Dim grisés) */
.rdv-timeline-balanced .rdv-day.weekend:not(.active) {
    opacity: 0.5;
}


/* Bottom-sheet avec scroll si contenu long */
#global-reschedule-form {
    max-height: 45vh;
    overflow-y: auto;
    border-radius: 12px 12px 0 0;
}



/* Assurer que les alertes sont visibles */
#global-reschedule-alert {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Quand le formulaire est ouvert, ajouter un padding en bas de la liste */
#rdv-list-container.global-reschedule-active {
    padding-bottom: 260px; /* hauteur approximative du formulaire + marge */
}

/* Ou mieux : utiliser une marge sur le dernier élément */
#rdv-list-container .card:last-child {
    margin-bottom: 0;
}



.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* ============================================================
   MODAL HISTORY
   ============================================================ */

.history-timeline {
    position: relative;
    padding-left: 40px;
}
.history-timeline::before {
    content: '';
    position: absolute;
    left: 17px;
    top: 6px;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--tblr-primary), #e9ecef);
    border-radius: 2px;
}

.history-timeline-item {
    position: relative;
    margin-bottom: 0;
    padding-bottom: 20px;
    padding-left: 20px;
}
.history-timeline-item:last-child {
    padding-bottom: 0;
}
.history-timeline-item:last-child::after {
    display: none;
}

.history-timeline-icon {
    position: absolute;
    left: -39px;
    top: 2px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
    flex-shrink: 0;
    z-index: 2;
    background-clip: padding-box;
}

.history-timeline-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    transition: box-shadow 0.15s;
}
.history-timeline-card:active {
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.history-timeline-action-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1a1a2e;
    line-height: 1.2;
}
.history-timeline-meta {
    font-size: 0.72rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.history-timeline-notes {
    font-size: 0.8rem;
    color: #495057;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #dee2e6;
    line-height: 1.4;
}
.history-timeline-canal-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    background: #f1f3f5;
    color: #495057;
}

.history-timeline-date-group {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #adb5bd;
    margin-bottom: 10px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-timeline-date-group::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #f0f0f0;
}

/* ============================================================
   MODAL RAPPEL
   ============================================================ */

.modal-rappel-type-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 60px;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    overflow: hidden;
}
.modal-rappel-type-btn:active {
    border-color: var(--rt-color);
    background: color-mix(in srgb, var(--rt-color) 8%, #fff);
}

.modal-rappel-type-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    font-size: 1rem;
}

.modal-rappel-type-label {
    flex: 1 1 0;
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a2e;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.btn-check:checked + .modal-rappel-type-btn {
    border-color: var(--rt-color);
    background: color-mix(in srgb, var(--rt-color) 10%, #fff);
    box-shadow: 0 2px 8px color-mix(in srgb, var(--rt-color) 25%, transparent);
}
.btn-check:checked + .modal-rappel-type-btn .modal-rappel-type-label {
    color: var(--rt-color);
}
.btn-check:checked + .modal-rappel-type-btn .modal-rappel-type-icon {
    background: color-mix(in srgb, var(--rt-color) 20%, #fff) !important;
}

.btn-check:focus-visible + .modal-rappel-type-btn {
    outline: 2px solid var(--rt-color);
    outline-offset: 2px;
}


/* ============================================
   WIZARD DEVIS - Dropdowns mobile
============================================ */

/* Conteneur du formulaire */
#composante-form select.form-select,
#composante-form input.form-control,
#composante-form textarea.form-control {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d9dbde;
    background-color: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Select avec flèche custom */
#composante-form select.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 36px;
}

/* Multiselect (finitions) */
#composante-form select[multiple] {
    background-image: none;
    padding-right: 12px;
    min-height: 120px;
}

/* Labels */
#composante-form .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
    display: block;
}

/* Groupes (CARACTERISTIQUES, etc.) */
#composante-form small.text-success {
    display: block;
    font-size: 11px !important;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e9ecef;
}

/* Unités (cm, %, gr) */
#composante-form small.text-muted {
    font-size: 11px;
    margin-top: 2px;
    display: block;
}

/* Champs requis */
#composante-form .text-danger {
    color: #d63939 !important;
    margin-left: 2px;
}

/* Focus states */
#composante-form select:focus,
#composante-form input:focus,
#composante-form textarea:focus {
    border-color: #206bc4;
    box-shadow: 0 0 0 3px rgba(32, 107, 196, 0.1);
    outline: none;
}

/* Mobile: full width pour tous les champs */
@media (max-width: 767.98px) {
    #composante-form .col-12,
    #composante-form .col-md-6 {
        width: 100% !important;
        padding-left: 0;
        padding-right: 0;
    }

    #composante-form .row.g-2 {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Bouton ajouter famille */
#btn-add-famille {
    border-style: dashed;
    padding: 12px;
    font-size: 14px;
}

/* Font Tabler Icons */
.ti {
    font-family: 'tabler-icons' !important;
    font-style: normal;
    font-variant: normal;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   BOUTON GHOST SECONDAIRE (adapté au thème rouge)
   ============================================================ */

.btn-ghost-secondary {
    --btn-bg: transparent;
    --btn-border-color: transparent;
    --btn-color: rgba(214, 57, 57, 0.7); /* Rouge avec transparence */
    --btn-hover-bg: rgba(214, 57, 57, 0.1);
    --btn-hover-border-color: transparent;
    --btn-active-bg: rgba(214, 57, 57, 0.2);
    --btn-active-border-color: transparent;
    --btn-disabled-color: rgba(214, 57, 57, 0.3);
    --btn-box-shadow: none;
    color: var(--btn-color);
    background-color: var(--btn-bg);
    border-color: var(--btn-border-color);
    transition: background-color 0.2s, color 0.2s;
}

.btn-ghost-secondary:hover,
.btn-ghost-secondary:focus {
    color: #d63939; /* Rouge plein au survol */
    background-color: var(--btn-hover-bg);
    border-color: var(--btn-hover-border-color);
}

.btn-ghost-secondary:active {
    color: #b52b2b; /* Rouge foncé au clic */
    background-color: var(--btn-active-bg);
    border-color: var(--btn-active-border-color);
}

.btn-ghost-secondary:disabled,
.btn-ghost-secondary.disabled {
    color: var(--btn-disabled-color);
    background-color: transparent;
    border-color: transparent;
}

/* ============================================================
   BOUTON GHOST SECONDAIRE (adapté au thème rouge)
   ============================================================ */
.base-card {
    transition: transform 0.2s;
    border-left: 4px solid transparent;
    cursor: pointer;
}

.base-card:active {
    transform: scale(0.98);
}

.rdv-card.Client { border-left-color: #74b816; } /* Vert */
.rdv-card.Prospect { border-left-color: #f59f00; } /* bleu */

.card-prospect { border-left: 4px solid #f59f00 !important; }
.card-client { border-left: 4px solid #74b816 !important; }

.brand-banner {
    background: #d63939;
    background: linear-gradient(135deg, #d63939 0%, #b32d2d 100%);
    border-radius: 1rem;
    padding: 1.5rem;
    color: white;
    overflow: hidden;
    position: relative;
}
.brand-banner::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('https://lh3.googleusercontent.com/aida-public/AB6AXuDHNh9jft_NMjQmx53wnQxzDw6N4_AF5NpNySD7mFbZgE1i9ImPH3Aa14pmf9bqR1qO5UpuLpVoNdsLUWSO1HSY63VyRWE_h6HGdiwCLru7axKv8t3V6AzgO2e4jmndNlJNcVehUEcqGDG-MVRKLTpD-jjE9J8xOZ9iSwgNzLhhnQ6eR9pZqiqYhvhgPYSl5Fm1uhGOGk3P8d2_rC1kNti_HTakf8WF31GJUwevqsV7SZ8U072prWIyQWvImBbOl-ladVrwpjuEeA');
    background-size: cover;
    background-position: center;
    opacity: 0.15;
    mix-blend-mode: overlay;
}

.card-appointment {
    border-left: 4px solid var(--tblr-azure);
}
.card-appointment.client {
    border-left-color: var(--tblr-lime);
}

.fab {
    position: fixed;
    right: 1.5rem;
    bottom: 4.5rem;
    z-index: 1020;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.fab_modal {
    bottom: 0.5rem;
}



.fab:active {
    transform: scale(0.9);
}


#clients-list {
    display: block !important;
    text-align: left !important;
    width: 100% !important;
}

/* 2. On force chaque lien/carte à se comporter comme un bloc plein écran */
#clients-list a.card {
    display: block !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    float: none !important; /* Au cas où il y aurait un vieux float */
}


/* Animation d'entrée pour le formulaire bottom-sheet */
#global-appointment-form {
    transition: transform 0.3s ease-out;
    transform: translateY(100%);
}

#global-appointment-form.show {
    transform: translateY(0);
}

/* Header sticky de la modal */
.rdv-modal-sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: var(--tblr-body-bg);
    /* Ombre légère pour séparer la timeline de la liste quand on scrolle */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}



/* Formulaire Bottom-Sheet optimisé */
#global-appointment-form {
    max-height: 60vh; /* Environ 60% de la hauteur de l'écran */
    overflow: hidden; /* On empêche le débordement du container principal */
    display: flex;
    flex-direction: column;
    border-radius: 20px 20px 0 0;
    transition: transform 0.3s ease-out;
    transform: translateY(100%);
}

/* On crée un container interne pour le scroll */
.global-app-form-content {
    overflow-y: auto;
    padding: 0 1.25rem 1.25rem 1.25rem;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* On fixe le header du formulaire pour qu'il ne disparaisse pas au scroll */
.global-app-form-header {
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
    padding: 1.25rem 1.25rem 0.5rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 1rem;
}

#global-appointment-form.show {
    transform: translateY(0);
}


/* Bordures d'intérêt accentuées */
.prospect-card-hot { border-left: 5px solid #d63939 !important; }
.prospect-card-warm { border-left: 5px solid #f59e0b !important; }
.prospect-card-cold { border-left: 5px solid #4facfe !important; }

/* Ombre douce et effet de pression */
.card-premium {
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    border-radius: 1rem !important;
}
.card-premium:active {
    transform: scale(0.97);
    background-color: #f8f9fa;
}

/* Style pour les boutons d'action rapide */
.btn-action-ghost {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #e6e8eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d63939;
    background: transparent;
    transition: all 0.2s;
}
.btn-action-ghost:hover {
    background-color: #f2f4f7;
}

/* Barre de rappel compacte */
.reminder-banner {
    background-color: #d63939;
    color: white;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(214, 57, 57, 0.2);
}
#prospects-list::after {
    content: '';
    display: block;
    height: 100px; /* Ajuste selon la hauteur de ton FAB + nav */
}

/* ============================================================
   GLOBAL SHEET — Bottom sheet sticky (header/body/footer)
   ============================================================ */

/* ============================================================
   BOTTOM SHEET — Overlay partiel, fond scrollable
   ============================================================ */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1060;

    /* Hauteur partielle : la liste derrière reste visible */
    max-height: 45vh;
    display: flex;
    flex-direction: column;

    background: #fff;
    border-top: 1px solid var(--tblr-border-color);
    border-radius: 1rem 1rem 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);

    /* Animation slide-up */
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-sheet.show {
    transform: translateY(0);
}

/* Header : toujours visible */
.bottom-sheet__header {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--tblr-border-color);
    border-radius: 1rem 1rem 0 0;
    background: #fff;
}

/* Body : scrollable INTERNE */
.bottom-sheet__body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem;
}

/* Footer : toujours visible */
.bottom-sheet__footer {
    flex-shrink: 0;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--tblr-border-color);
    background: #fff;
}

/* Quand le sheet est ouvert, on ajoute du padding au conteneur de liste
   pour que le dernier RDV ne soit pas caché derrière le sheet */
#rdv-list-container.has-bottom-sheet {
    padding-bottom: 50vh;
    transition: padding-bottom 0.3s ease;
}


.global-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--tblr-border-color);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border-radius: 1rem 1rem 0 0;
    z-index: 1060;
}

.global-sheet__header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--tblr-border-color);
    flex-shrink: 0;
}

.global-sheet__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1.25rem;
}

.global-sheet__footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--tblr-border-color);
    background: #fff;
    flex-shrink: 0;
}

/* Empêche le scroll du body quand le sheet est ouvert */
body.global-sheet-open {
    overflow: hidden;
}