/* ==============================================================================
   DANSE & FITNESS - GESTION D'ADHÉRENTS & COMPTABILITÉ
   Feuille de styles Vanilla CSS moderne, sobre et responsive
   ============================================================================== */

:root {
    /* Palette de couleurs */
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-primary-light: #eef2ff;
    --color-primary-text: #3730a3;

    --color-success: #10b981;
    --color-success-light: #ecfdf5;
    --color-success-text: #065f46;

    --color-warning: #f59e0b;
    --color-warning-light: #fffbeb;
    --color-warning-text: #92400e;

    --color-danger: #ef4444;
    --color-danger-light: #fef2f2;
    --color-danger-text: #991b1b;

    --color-info: #0ea5e9;
    --color-info-light: #f0f9ff;
    --color-info-text: #0369a1;

    /* Neutres */
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-subtle: #f1f5f9;
    --border-color: #e2e8f0;
    --border-color-focus: #818cf8;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    /* Badges groupes */
    --grp-prep-bg: #e0f2fe;
    --grp-prep-text: #0369a1;
    --grp-inter-bg: #ede9fe;
    --grp-inter-text: #6d28d9;
    --grp-avanc-bg: #fce7f3;
    --grp-avanc-text: #be185d;
    --grp-body-bg: #dcfce7;
    --grp-body-text: #15803d;
    --grp-boot-bg: #ffedd5;
    --grp-boot-text: #c2410c;

    /* Typographie */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Rayons et ombres */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset de base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ==============================================================================
   EN-TÊTE PRINCIPAL
   ============================================================================== */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.badge-saison {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary);
    background-color: var(--color-primary-light);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
}

/* Onglets de navigation */
.nav-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--bg-card-subtle);
    padding: 0.3rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-tab:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.6);
}

.nav-tab.active {
    background-color: var(--bg-card);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.tab-counter {
    background-color: var(--color-primary-light);
    color: var(--color-primary-text);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
}

.tab-counter-warning {
    background-color: var(--color-warning-light);
    color: var(--color-warning-text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* ==============================================================================
   BOUTONS ET CONTRÔLES
   ============================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.btn-outline {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    background-color: var(--bg-card-subtle);
    border-color: #cbd5e1;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
}

.btn-icon {
    padding: 0.4rem;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-danger-outline {
    background-color: transparent;
    border-color: #fca5a5;
    color: var(--color-danger);
}

.btn-danger-outline:hover {
    background-color: var(--color-danger-light);
    border-color: var(--color-danger);
}

.btn-success {
    background-color: var(--color-success);
    color: #ffffff;
}

.icon-danger {
    background-color: var(--color-danger-light);
    color: var(--color-danger);
}

.alert-box {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    line-height: 1.4;
}

.alert-warning {
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-danger {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}


/* ==============================================================================
   CORPS PRINCIPAL ET VUES
   ============================================================================== */
.app-main {
    max-width: 1440px;
    margin: 1.5rem auto 3rem auto;
    padding: 0 1.5rem;
}

.view-panel {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==============================================================================
   CARTES KPI (INDICATEURS CLÉS)
   ============================================================================== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.kpi-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-blue {
    background-color: var(--color-info-light);
    color: var(--color-info);
}

.icon-purple {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
}

.icon-green {
    background-color: var(--color-success-light);
    color: var(--color-success);
}

.icon-amber {
    background-color: var(--color-warning-light);
    color: var(--color-warning);
}

.kpi-content {
    flex-grow: 1;
    min-width: 0;
}

.kpi-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.kpi-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    display: block;
}

.highlight-success {
    border-left: 4px solid var(--color-success);
}

.highlight-warning {
    border-left: 4px solid var(--color-warning);
}

/* ==============================================================================
   BARRE D'OUTILS ET RECHERCHE
   ============================================================================== */
.toolbar-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    flex-grow: 1;
    max-width: 380px;
}

.search-box svg {
    position: absolute;
    left: 0.85rem;
    color: var(--text-subtle);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 0.55rem 2rem 0.55rem 2.4rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background-color: var(--bg-card-subtle);
    color: var(--text-main);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--border-color-focus);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.clear-search-btn {
    position: absolute;
    right: 0.6rem;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-subtle);
    cursor: pointer;
    line-height: 1;
}

.filters-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-item label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-item select {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    font-family: var(--font-body);
    font-size: 0.825rem;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.filter-item select:focus {
    outline: none;
    border-color: var(--border-color-focus);
}

.toggle-famille-group {
    padding: 0.45rem 0.75rem;
    background-color: var(--bg-card-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--border-color);
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-main);
}

/* ==============================================================================
   TABLEAUX DE DONNÉES
   ============================================================================== */
.table-responsive-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.data-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Cellules adhérents */
.adherent-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.adherent-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background-color: var(--color-primary-light);
    color: var(--color-primary-text);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.adherent-info {
    display: flex;
    flex-direction: column;
}

.adherent-name {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.adherent-famille-tag {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Badges de groupes */
.badge-group {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.group-preparatoire {
    background-color: var(--grp-prep-bg);
    color: var(--grp-prep-text);
}

.group-intermediaire {
    background-color: var(--grp-inter-bg);
    color: var(--grp-inter-text);
}

.group-avance {
    background-color: var(--grp-avanc-bg);
    color: var(--grp-avanc-text);
}

.group-body_sculpt {
    background-color: var(--grp-body-bg);
    color: var(--grp-body-text);
}

.group-boot_camp {
    background-color: var(--grp-boot-bg);
    color: var(--grp-boot-text);
}

/* Badges financiers */
.badge-solde {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-solde-ok {
    background-color: var(--color-success-light);
    color: var(--color-success-text);
    border: 1px solid #a7f3d0;
}

.badge-solde-pending {
    background-color: var(--color-danger-light);
    color: var(--color-danger-text);
    border: 1px solid #fecaca;
}

.badge-solde-waiting {
    background-color: var(--color-warning-light);
    color: var(--color-warning-text);
    border: 1px solid #fde68a;
}

.badge-solde-surplus {
    background-color: var(--color-info-light);
    color: var(--color-info-text);
    border: 1px solid #bae6fd;
}

.reg-date-input {
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    font-size: 0.825rem;
    background-color: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
    cursor: pointer;
}

.reg-date-input:focus {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.reg-date-input:hover {
    border-color: var(--color-primary);
}

/* Badge Réduction Foyer / Famille */
.badge-foyer-discount {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    background-color: #ede9fe;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
    margin-left: 0.35rem;
}

.badge-discount-tag {
    font-size: 0.7rem;
    font-weight: 700;
    color: #6d28d9;
    background-color: #ede9fe;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    vertical-align: middle;
    margin-left: 0.35rem;
}

/* Badges pièces administratives */
.docs-badge-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.doc-pill {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    background-color: #fee2e2;
    color: #dc2626;
    border: 1.5px solid #f87171;
    position: relative;
    cursor: help;
    transition: var(--transition);
}

.doc-pill.valid {
    background-color: #dcfce7;
    color: #15803d;
    border: 1.5px solid #86efac;
    font-weight: 700;
}

.doc-pill.valid::after {
    content: '✓';
    position: absolute;
    top: -4px;
    right: -4px;
    background: #16a34a;
    color: #ffffff;
    font-size: 8px;
    font-weight: 900;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.doc-pill.invalid,
.doc-pill.missing {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1.5px solid #f87171;
    font-weight: 700;
}

.doc-pill.invalid::after,
.doc-pill.missing::after {
    content: '✕';
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc2626;
    color: #ffffff;
    font-size: 8px;
    font-weight: 900;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.doc-pill.expired {
    background-color: #fff1f2;
    color: #be123c;
    border: 2px dashed #e11d48;
    font-weight: 800;
    animation: pulse-border 2.5s infinite;
}

.doc-pill.expired::after {
    content: '!';
    position: absolute;
    top: -4px;
    right: -4px;
    background: #be123c;
    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #ffffff;
    box-shadow: 0 1px 3px rgba(190, 18, 60, 0.4);
}

@keyframes pulse-border {
    0%, 100% { border-color: #e11d48; }
    50% { border-color: #fb7185; }
}

/* Tooltip natif ou title */
.doc-pill:hover {
    transform: scale(1.18);
    z-index: 5;
}

/* Boutons d'actions du tableau */
.row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

/* Interrupteur Encaissement Toggle Switch */
.switch-encaisse {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
}

.switch-encaisse input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.switch-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.switch-slider::before {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    border-radius: var(--radius-full);
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch-encaisse input:checked+.switch-slider {
    background-color: var(--color-success);
}

.switch-encaisse input:checked+.switch-slider::before {
    transform: translateX(16px);
}

/* ==============================================================================
   DISPOSITION COMPTABILITÉ & TRÉSORERIE
   ============================================================================== */
.treso-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .treso-layout {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.card-header-title h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
}

/* Barre de progression mensuelle */
.progress-bar-container {
    width: 100%;
    min-width: 80px;
    height: 8px;
    background-color: #f1f5f9;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 0.25rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #059669);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* ==============================================================================
   VUE FAMILLES / FOYERS
   ============================================================================== */
.section-title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title-bar h2 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.familles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.famille-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.famille-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.famille-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.famille-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.famille-members-list {
    list-style: none;
    margin: 0.75rem 0;
    flex-grow: 1;
}

.famille-member-item {
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

.famille-member-item:last-child {
    border-bottom: none;
}

.famille-footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==============================================================================
   MODALES (FENÊTRES POP-UP)
   ============================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
    animation: fadeIn 0.2s ease-out;
}

.modal-dialog {
    background-color: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.modal-sm {
    max-width: 440px;
}

.modal-lg {
    max-width: 780px;
}

.modal-xl {
    max-width: 960px;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-title-group h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
    padding: 0.2rem;
}

.modal-close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Bannière de calcul dynamique en direct (Live Pricing) */
.dynamic-calculation-banner {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.banner-breakdown {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
}

.breakdown-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.breakdown-val {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.breakdown-op {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.1rem;
}

.banner-total {
    text-align: right;
    background-color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid #c7d2fe;
    box-shadow: var(--shadow-sm);
}

.total-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary-text);
}

.total-amount {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-primary);
}

/* Lignes et groupes de formulaires */
.form-section-title {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 1.25rem 0 0.75rem 0;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section-title:first-of-type {
    margin-top: 0;
}

.form-row {
    display: grid;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.form-row-2 {
    grid-template-columns: repeat(2, 1fr);
}

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-row-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 640px) {

    .form-row-2,
    .form-row-3,
    .form-row-4 {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group label {
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-group label.required::after {
    content: " *";
    color: var(--color-danger);
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="email"],
.batch-item-ref,
.batch-item-date,
.batch-item-montant,
.form-group select {
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background-color: #ffffff;
    color: var(--text-main);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-color-focus);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-with-button {
    display: flex;
    gap: 0.4rem;
}

.input-with-button select {
    flex-grow: 1;
}

.input-prefix-container {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix-container input {
    width: 100%;
    padding-right: 2rem;
}

.input-suffix {
    position: absolute;
    right: 0.75rem;
    font-weight: 600;
    color: var(--text-subtle);
    pointer-events: none;
}

/* Grille des pièces administratives */
.admin-checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.checkbox-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.825rem;
    font-weight: 500;
    transition: var(--transition);
}

.checkbox-tag:hover {
    background-color: #e2e8f0;
}

.checkbox-tag input[type="checkbox"]:checked+span {
    color: var(--color-primary-text);
    font-weight: 600;
}

.checkbox-card {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.825rem;
}

.checkbox-card strong {
    display: block;
    color: var(--text-main);
}

.checkbox-card span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Synthèse financière dans le modal de règlements */
.adherent-financial-summary-card {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.summary-metric {
    display: flex;
    flex-direction: column;
}

.summary-metric .metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.summary-metric .metric-val {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.highlight-solde {
    background-color: #ffffff;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Onglets d'ajout de paiement (Unique vs Multi-chèques) */
.payment-tabs-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.subtabs-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    flex-wrap: wrap;
}

.subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    background-color: transparent;
    font-family: var(--font-heading);
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.subtab-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-card-subtle);
}

.subtab-btn.active {
    background-color: var(--color-primary-light);
    color: var(--color-primary-text);
    border-color: #c7d2fe;
}

/* ==============================================================================
   TOAST NOTIFICATIONS
   ============================================================================== */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-width: 360px;
}

.toast {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--text-main);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.toast-success {
    border-left: 4px solid var(--color-success);
}

.toast.toast-error {
    border-left: 4px solid var(--color-danger);
}

.toast.toast-warning {
    border-left: 4px solid var(--color-warning);
}

.toast.toast-info {
    border-left: 4px solid var(--color-info);
}

/* ==============================================================================
   UTILITAIRES & ALIGNEMENTS
   ============================================================================== */
.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--color-success);
}

.text-danger {
    color: var(--color-danger);
}

.text-warning {
    color: var(--color-warning);
}

.text-primary {
    color: var(--color-primary);
}

.font-bold {
    font-weight: 700;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.mt-3 {
    margin-top: 0.75rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* ==============================================================================
   DOCUMENT FACTURE OFFICIELLE CASTELROC ACADEMY (FORMAT PAPIER / IMPRIMABLE)
   ============================================================================== */

/* Conteneur de prévisualisation dans la modale (aspect visionneuse de document) */
.facture-paper-preview {
    background-color: #475569;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: auto;
    border-radius: var(--radius-lg);
}

/* Feuille A4 blanche standard */
.castelroc-facture {
    background-color: #ffffff;
    width: 210mm;
    min-height: 297mm;
    padding: 22mm 20mm 20mm 20mm;
    box-sizing: border-box;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    font-family: Arial, Helvetica, sans-serif;
    color: #000000;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* En-tête : 3 colonnes (Émetteur gauche, Logo centre incliné, Client + Métas droite) */
.cr-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 26px;
    position: relative;
}

/* Bloc Émetteur gauche */
.cr-header-left {
    width: 38%;
}

.cr-assoc-name {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-size: 19px;
    font-weight: bold;
    font-style: italic;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    text-transform: uppercase;
    color: #000000;
}

.cr-assoc-line {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-style: italic;
    font-size: 15px;
    line-height: 1.35;
    color: #000000;
}

.cr-assoc-siret {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-style: italic;
    font-size: 14px;
    margin-top: 18px;
    color: #000000;
}

/* Bloc Centre : Logo avec cadre rouge incliné */
.cr-header-center {
    width: 24%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 4px;
}

.cr-logo-wrapper {
    display: inline-block;
    transform: rotate(-5.5deg);
}

.cr-logo-img {
    width: 120px;
    height: auto;
    max-height: 120px;
    display: block;
    object-fit: contain;
}

/* Bloc Droite : Client & Tableau N° Facture / Date */
.cr-header-right {
    width: 38%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cr-client-box {
    text-align: left;
    width: 235px;
    margin-bottom: 24px;
    font-size: 14.5px;
    line-height: 1.35;
    color: #000000;
}

.cr-client-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.cr-client-line {
    color: #000000;
}

/* Petit tableau N° facture / DATE */
.cr-meta-table {
    border-collapse: collapse;
    width: 220px;
    border: 2px solid #000000;
}

.cr-meta-table th {
    border: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    background-color: #ffffff;
    color: #000000;
}

.cr-meta-table td {
    border: 1.5px solid #000000;
    padding: 6px 8px;
    font-size: 13px;
    text-align: center;
    color: #000000;
    background-color: #ffffff;
}

/* Tableau comptable principal */
.cr-table-container {
    width: 100%;
    margin-top: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.cr-table {
    width: 100%;
    border-collapse: collapse;
    border: 2px solid #000000;
}

.cr-table thead th {
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
    border-left: 1.5px solid #000000;
    border-right: 1.5px solid #000000;
    padding: 6px 4px;
    font-size: 12.5px;
    font-weight: bold;
    text-align: center;
    background-color: #ffffff;
    color: #000000;
}

.cr-table th.col-ref,
.cr-table td.col-ref {
    width: 11%;
    text-align: center;
}

.cr-table th.col-desig,
.cr-table td.col-desig {
    width: 53%;
    text-align: left;
    padding-left: 10px;
}

.cr-table th.col-qte,
.cr-table td.col-qte {
    width: 10%;
    text-align: right;
    padding-right: 14px;
}

.cr-table th.col-pu,
.cr-table td.col-pu {
    width: 13%;
    text-align: right;
    padding-right: 14px;
}

.cr-table th.col-total,
.cr-table td.col-total {
    width: 13%;
    text-align: right;
    padding-right: 14px;
}

/* Cellules du corps : bordures verticales continues uniquement */
.cr-table tbody td {
    border-left: 1.5px solid #000000;
    border-right: 1.5px solid #000000;
    border-top: none;
    border-bottom: none;
    font-size: 13px;
    vertical-align: top;
    color: #000000;
    background-color: #ffffff;
}

/* Ligne titre de cours (ex: Inscription cours de BODY SCULPT) */
.cr-row-group-title td {
    padding-top: 14px;
    padding-bottom: 4px;
}

.cr-group-heading {
    font-size: 13px;
    color: #000000;
    font-weight: normal;
}

/* Ligne d'adhérent (REF, Nom, QTE, PU, TOTAL) */
.cr-row-item td {
    padding-top: 2px;
    padding-bottom: 6px;
    line-height: 1.3;
}

.cr-row-item td.col-ref {
    padding-top: 2px;
    font-size: 13px;
}

.cr-row-item td.col-desig {
    font-size: 13px;
}

/* Espaceur entre groupes */
.cr-row-space td {
    height: 16px;
}

/* Ligne d'extension verticale (filler) qui continue les colonnes jusqu'en bas */
.cr-row-filler td {
    height: 440px;
}

/* Bas de document : Total et mention légale */
.cr-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 4px;
    width: 100%;
}

.cr-tva-mention {
    font-family: "Times New Roman", Times, Georgia, serif;
    font-style: italic;
    font-size: 13px;
    padding-top: 6px;
    color: #000000;
}

.cr-total-wrapper {
    display: flex;
    width: 26%; /* Aligné sur 13% PU + 13% TOTAL */
    border: 2px solid #000000;
    box-sizing: border-box;
    background-color: #ffffff;
}

.cr-total-label {
    width: 50%;
    text-align: center;
    font-weight: bold;
    font-size: 13px;
    padding: 6px 0;
    border-right: 1.5px solid #000000;
    color: #000000;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.cr-total-value {
    width: 50%;
    text-align: right;
    font-weight: bold;
    font-size: 13px;
    padding: 6px 14px;
    color: #000000;
    white-space: nowrap;
}

/* ==============================================================================
   RÈGLES D'IMPRESSION A4 PROPRE & FIDÈLE
   ============================================================================== */
@media print {
    @page {
        size: A4 portrait;
        margin: 15mm 15mm 15mm 15mm;
    }

    body {
        background: #ffffff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body * {
        visibility: hidden;
    }

    #modal-facture,
    #facture-printable-area,
    .facture-paper-preview,
    .castelroc-facture,
    .castelroc-facture * {
        visibility: visible !important;
    }

    #modal-facture {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    .modal-dialog {
        box-shadow: none !important;
        border: none !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        animation: none !important;
    }

    .modal-body {
        padding: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    .modal-header,
    .modal-footer,
    .header-actions {
        display: none !important;
    }

    .facture-paper-preview {
        background: none !important;
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        overflow: visible !important;
    }

    .castelroc-facture {
        width: 100% !important;
        min-height: auto !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
        page-break-inside: avoid !important;
    }

    .cr-row-filler td {
        height: 480px !important;
    }
}

/* ==============================================================================
   BADGE UTILISATEUR & CONFORMITÉ RGPD
   ============================================================================== */
.user-header-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 5px;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

.user-avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #ec4899);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.user-fullname {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-ghost {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-ghost:hover {
    background: var(--bg-card-subtle);
    color: var(--color-danger);
    border-color: var(--border-color);
}

.btn-logout {
    color: var(--color-danger-text);
}

.btn-logout:hover {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Modal RGPD & Protection des données */
.icon-emerald {
    background: #ecfdf5;
    color: #10b981;
}

.rgpd-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--text-main);
    font-size: 13.5px;
    line-height: 1.6;
}

.rgpd-alert-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: #166534;
    font-size: 13px;
}

.rgpd-section {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.rgpd-section:last-of-type {
    border-bottom: none;
}

.rgpd-section h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.rgpd-section ul {
    padding-left: 20px;
    margin-top: 4px;
}

.rgpd-section li {
    margin-bottom: 4px;
}

.rgpd-export-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--color-primary-light);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 8px;
}

.rgpd-export-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rgpd-export-info strong {
    color: var(--color-primary-text);
    font-size: 14px;
}

.rgpd-export-info span {
    font-size: 12px;
    color: #4b5563;
}