/* =========================================================
   AppliGel Maternelle — Thème Bootstrap 5
   ========================================================= */
:root {
    --mat-primary: #6C5CE7;
    --mat-primary-dark: #5646D4;
    --mat-primary-soft: #EEEBFF;
    --mat-coral: #FF7675;   --mat-coral-soft: #FFECEC;
    --mat-sun:   #F9B934;   --mat-sun-soft:   #FFF5DC;
    --mat-mint:  #20BF8F;   --mat-mint-soft:  #E1F8F0;
    --mat-sky:   #3D9BF5;   --mat-sky-soft:   #E3F1FF;
    --mat-pink:  #F368B0;   --mat-pink-soft:  #FDE8F3;
    --mat-bg: #F5F6FB;
    --mat-text: #2D3142;
    --mat-muted: #8A8FA3;
    --mat-border: #E8EAF3;
    --mat-sidebar-w: 260px;
    --mat-topbar-h: 64px;
    --mat-radius: 1rem;
    --mat-shadow: 0 4px 18px rgba(45, 49, 66, .06);

    /* Surcharge Bootstrap */
    --bs-primary: #6C5CE7;
    --bs-primary-rgb: 108, 92, 231;
    --bs-link-color: #6C5CE7;
    --bs-link-color-rgb: 108, 92, 231;
    --bs-link-hover-color: #5646D4;
    --bs-body-font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-bg: #F5F6FB;
    --bs-body-color: #2D3142;
    --bs-border-color: #E8EAF3;
    --bs-border-radius: .75rem;
    --bs-border-radius-lg: 1rem;
    --bs-success: #20BF8F;  --bs-success-rgb: 32, 191, 143;
    --bs-danger:  #FF6B6B;  --bs-danger-rgb: 255, 107, 107;
    --bs-warning: #F9B934;  --bs-warning-rgb: 249, 185, 52;
    --bs-info:    #3D9BF5;  --bs-info-rgb: 61, 155, 245;
}

body { background: var(--mat-bg); color: var(--mat-text); font-weight: 600; }
h1, h2, h3, h4, h5, h6, .fw-bold { font-weight: 800 !important; }
.text-muted { color: var(--mat-muted) !important; }

/* ---------- Boutons ---------- */
.btn { font-weight: 700; border-radius: .75rem; }
.btn-primary {
    --bs-btn-bg: var(--mat-primary); --bs-btn-border-color: var(--mat-primary);
    --bs-btn-hover-bg: var(--mat-primary-dark); --bs-btn-hover-border-color: var(--mat-primary-dark);
    --bs-btn-active-bg: #4A3BC4; --bs-btn-active-border-color: #4A3BC4;
    --bs-btn-disabled-bg: var(--mat-primary); --bs-btn-disabled-border-color: var(--mat-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--mat-primary); --bs-btn-border-color: var(--mat-primary);
    --bs-btn-hover-bg: var(--mat-primary); --bs-btn-hover-border-color: var(--mat-primary);
    --bs-btn-active-bg: var(--mat-primary); --bs-btn-active-border-color: var(--mat-primary);
}
.btn-soft { background: var(--mat-primary-soft); color: var(--mat-primary); border: 0; }
.btn-soft:hover { background: var(--mat-primary); color: #fff; }
.btn-icon {
    width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
    border-radius: .75rem; font-size: 1.25rem; color: var(--mat-text); background: transparent; border: 0;
}
.btn-icon:hover { background: var(--mat-primary-soft); color: var(--mat-primary); }
.btn-icon.btn-sm { width: 32px; height: 32px; font-size: 1rem; }

/* ---------- Formulaires ---------- */
.form-control, .form-select { border-radius: .75rem; border-color: var(--mat-border); padding: .6rem .9rem; font-weight: 600; }
.form-control:focus, .form-select:focus { border-color: var(--mat-primary); box-shadow: 0 0 0 .2rem rgba(108, 92, 231, .15); }
.form-label { font-weight: 700; font-size: .9rem; margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--mat-primary); border-color: var(--mat-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem rgba(108, 92, 231, .15); border-color: var(--mat-primary); }
.input-inline { border: 1px solid transparent; background: transparent; border-radius: .5rem; padding: .3rem .5rem; width: 100%; font-weight: 600; }
.input-inline:hover { border-color: var(--mat-border); background: #fff; }
.input-inline:focus { outline: 0; border-color: var(--mat-primary); background: #fff; }

/* ---------- Topbar ---------- */
.app-topbar {
    position: sticky; top: 0; z-index: 1030; height: var(--mat-topbar-h);
    display: flex; align-items: center; gap: .5rem; padding: 0 1rem;
    background: rgba(245, 246, 251, .85); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topbar-brand { display: flex; align-items: center; gap: .5rem; color: var(--mat-text); text-decoration: none; }
.topbar-brand img { height: 36px; width: 36px; object-fit: contain; border-radius: .5rem; background: #fff; }
.chip-annee {
    align-items: center; gap: .4rem; padding: .4rem .8rem; border-radius: 2rem;
    background: var(--mat-primary-soft); color: var(--mat-primary); font-size: .85rem; font-weight: 700;
}
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; background: #fff; border-radius: 2rem; padding: .25rem .75rem .25rem .25rem; box-shadow: var(--mat-shadow); }
.btn-user::after { margin-left: .25rem; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--mat-primary), var(--mat-pink)); color: #fff; font-size: .8rem; font-weight: 800;
}
.dropdown-menu { border: 0; border-radius: var(--mat-radius); padding: .5rem; }
.dropdown-item { border-radius: .5rem; font-weight: 600; }

/* ---------- Sidebar ---------- */
.app-sidebar.offcanvas-lg { background-color: #fff !important; width: var(--mat-sidebar-w); display: flex; flex-direction: column; border-right: 0 !important; }
.sidebar-brand { display: flex; align-items: center; padding: 1.1rem 1.25rem; min-height: var(--mat-topbar-h); }
.sidebar-brand img { height: 42px; width: 42px; object-fit: contain; border-radius: .75rem; background: var(--mat-bg); padding: 3px; }
.sidebar-brand b { display: block; color: var(--mat-text); line-height: 1.1; }
.sidebar-brand small { color: var(--mat-primary); font-weight: 700; font-size: .8rem; }
.app-sidebar .offcanvas-body { display: block !important; flex: 1; overflow-y: auto !important; padding: .5rem .9rem !important; }
.side-nav { display: flex; flex-direction: column; gap: .25rem; }
.side-link {
    display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: .9rem;
    color: var(--mat-text); text-decoration: none; font-weight: 700; transition: background .15s;
}
.side-link:hover { background: var(--mat-bg); color: var(--mat-text); }
.side-link.active { background: var(--mat-primary-soft); color: var(--mat-primary); }
.side-link.disabled { opacity: .55; cursor: default; }
.side-link.disabled:hover { background: transparent; }
.side-icon { width: 36px; height: 36px; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.badge-soon { margin-left: auto; font-size: .65rem; padding: .15rem .45rem; border-radius: 1rem; background: var(--mat-bg); color: var(--mat-muted); font-weight: 700; }
.sidebar-foot { padding: .9rem; border-top: 1px solid var(--mat-border); }

@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1035; box-shadow: 2px 0 20px rgba(45, 49, 66, .04); }
    .app-topbar, .app-main { margin-left: var(--mat-sidebar-w); }
}

/* ---------- Bulles couleur ---------- */
.bubble-violet { background: var(--mat-primary-soft); color: var(--mat-primary); }
.bubble-coral  { background: var(--mat-coral-soft);   color: var(--mat-coral); }
.bubble-sun    { background: var(--mat-sun-soft);     color: #D99A0F; }
.bubble-mint   { background: var(--mat-mint-soft);    color: var(--mat-mint); }
.bubble-sky    { background: var(--mat-sky-soft);     color: var(--mat-sky); }
.bubble-pink   { background: var(--mat-pink-soft);    color: var(--mat-pink); }

/* ---------- Contenu ---------- */
.app-main { min-height: calc(100vh - var(--mat-topbar-h)); display: flex; flex-direction: column; }
.app-content { flex: 1; padding: .5rem 1rem 1.5rem; width: 100%; max-width: 1280px; }
@media (min-width: 992px) { .app-content { padding: .75rem 2rem 2rem; } }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head p { margin: 0; color: var(--mat-muted); font-size: .9rem; }

.card-mat { background: #fff; border: 0; border-radius: var(--mat-radius); box-shadow: var(--mat-shadow); }
.card-mat > .card-header { background: transparent; border-bottom: 1px solid var(--mat-border); padding: 1rem 1.25rem; font-weight: 800; display: flex; align-items: center; gap: .5rem; }
.card-mat > .card-body { padding: 1.25rem; }

.stat-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; }
.stat-card .side-icon { width: 52px; height: 52px; font-size: 1.5rem; border-radius: 1rem; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { color: var(--mat-muted); font-size: .85rem; }

.hero-mat {
    position: relative; overflow: hidden; border-radius: 1.25rem; padding: 1.75rem; color: #fff;
    background: linear-gradient(120deg, var(--mat-primary) 0%, #8E7CF8 55%, var(--mat-pink) 100%);
}
.hero-mat > * { position: relative; z-index: 1; }
.hero-mat h1 { font-size: 1.6rem; }
.hero-mat p { opacity: .9; margin: 0; }
.hero-mat::before, .hero-mat::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero-mat::before { width: 220px; height: 220px; right: -60px; top: -80px; }
.hero-mat::after { width: 120px; height: 120px; right: 120px; bottom: -60px; background: rgba(249, 185, 52, .35); }

.shortcut { display: flex; align-items: center; gap: .9rem; padding: 1rem 1.1rem; color: var(--mat-text); text-decoration: none; transition: transform .15s; }
.shortcut:hover { transform: translateY(-2px); color: var(--mat-text); }
.shortcut.disabled { opacity: .55; pointer-events: none; }

/* ---------- Tableaux ---------- */
.table-mat { margin: 0; }
.table-mat > :not(caption) > * > * { padding: .7rem 1rem; border-bottom-color: var(--mat-border); vertical-align: middle; }
.table-mat thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mat-muted); font-weight: 800; background: #FAFAFD; }
.drag-handle { cursor: grab; color: var(--mat-muted); }
.sortable-ghost { opacity: .4; background: var(--mat-primary-soft) !important; }

/* ---------- Onglets ---------- */
.nav-pills-mat { gap: .4rem; background: #fff; padding: .35rem; border-radius: 1rem; box-shadow: var(--mat-shadow); display: inline-flex; flex-wrap: wrap; }
.nav-pills-mat .nav-link { border-radius: .75rem; color: var(--mat-muted); font-weight: 700; padding: .5rem 1rem; }
.nav-pills-mat .nav-link.active { background: var(--mat-primary); color: #fff; }
.nav-pills-mat .nav-link { white-space: nowrap; }
@media (max-width: 575.98px) {
    .nav-pills-mat { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .2rem; }
    .nav-pills-mat .nav-link { flex: 1 0 auto; padding: .5rem .7rem; font-size: .85rem; }
    .nav-pills-mat .nav-link .bi { display: none; }
}

/* ---------- Images catégories ---------- */
.cat-img { width: 48px; height: 48px; border-radius: .75rem; object-fit: cover; background: var(--mat-bg); flex-shrink: 0; }
.cat-img-empty { width: 48px; height: 48px; border-radius: .75rem; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }

.cat-img.sm, .cat-img-empty.sm { width: 32px; height: 32px; border-radius: .6rem; font-size: .9rem; }
.cat-row { display: flex; align-items: center; gap: .9rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--mat-border); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .cat-nom { flex: 1; min-width: 0; }
.cat-group-head { display: flex; align-items: center; gap: .75rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--mat-border); }
.check-list { max-height: 55vh; overflow-y: auto; }
.check-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .75rem; border-radius: .6rem; cursor: pointer; margin: 0; }
.check-item:hover { background: var(--mat-bg); }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--mat-muted); }
.empty-state i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }
.img-picker { position: relative; width: 96px; height: 96px; border-radius: 1rem; border: 2px dashed var(--mat-border); display: flex; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; color: var(--mat-muted); background: var(--mat-bg); }
.img-picker:hover { border-color: var(--mat-primary); color: var(--mat-primary); }
.img-picker img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.img-picker input { display: none; }

/* ---------- Modals / Toasts ---------- */
.modal-content { border: 0; border-radius: 1.25rem; }
.modal-header, .modal-footer { border-color: var(--mat-border); }
.toast { border: 0; border-radius: .9rem; box-shadow: 0 8px 24px rgba(45, 49, 66, .15); }

/* ---------- Footer ---------- */
.app-footer { display: flex; justify-content: space-between; padding: 1rem 2rem; color: var(--mat-muted); font-size: .8rem; }

/* ---------- Bottom nav mobile ---------- */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex; justify-content: space-around;
    background: #fff; box-shadow: 0 -4px 18px rgba(45, 49, 66, .08); padding: .4rem 0 calc(.4rem + env(safe-area-inset-bottom));
}
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; color: var(--mat-muted); text-decoration: none; font-size: .7rem; font-weight: 700; }
.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--mat-primary); }
.bottom-nav a.disabled { opacity: .4; }
@media (max-width: 991.98px) { .app-main { padding-bottom: 70px; } }

/* ---------- Connexion ---------- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(135deg, #EEEBFF 0%, #FDE8F3 50%, #FFF5DC 100%); position: relative; overflow: hidden; }
.login-page .blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 420px; background: #fff; border-radius: 1.5rem; padding: 2rem; box-shadow: 0 20px 50px rgba(108, 92, 231, .15); }
.login-logo { width: 72px; height: 72px; border-radius: 1.25rem; display: inline-flex; align-items: center; justify-content: center; font-size: 2rem; color: #fff; background: linear-gradient(135deg, var(--mat-primary), var(--mat-pink)); }
.login-card .form-control { padding: .75rem 1rem; }
.login-card .input-group-text { background: var(--mat-bg); border-color: var(--mat-border); border-radius: .75rem 0 0 .75rem; color: var(--mat-muted); }