/* ============================================================
   UMI Friendly Themes - palettes conviviales pour la plateforme
   Loaded after app.min.css to override default + existing themes
   ============================================================ */

/* ---------- BASE TOKENS (apply to all themes) ---------- */
:root {
    --umi-radius: 8px;
}

body {
    background-color: #F5F8FC !important;
}

.card {
    border: 1px solid #E5EBF1;
    border-radius: var(--umi-radius);
    box-shadow: 0 1px 2px rgba(15, 42, 71, 0.04);
}

.table > thead {
    background-color: rgba(46, 134, 193, 0.06);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.25) !important;
}

/* ---------- THEME : default = Bleu UMI doux ---------- */
:root,
[data-theme-mode=default] {
    --bs-primary: #2E86C1 !important;
    --bs-primary-rgb: 46, 134, 193 !important;
    --bs-success: #27AE60 !important; --bs-success-rgb: 39, 174, 96 !important;
    --bs-danger:  #E74C3C !important; --bs-danger-rgb:  231, 76, 60 !important;
    --bs-warning: #F5B041 !important; --bs-warning-rgb: 245, 176, 65 !important;
    --bs-info:    #5DADE2 !important; --bs-info-rgb:    93, 173, 226 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #1F4E79, #0F2A47) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #1F4E79, #0F2A47) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #1F4E79, #0F2A47) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #1F4E79, #0F2A47) fixed !important;
}

/* ---------- THEME : teal (menthe friendly) ---------- */
[data-theme-mode=teal] {
    --bs-primary: #14B8A6 !important; --bs-primary-rgb: 20, 184, 166 !important;
    --bs-success: #22C55E !important; --bs-success-rgb: 34, 197, 94 !important;
    --bs-danger:  #F43F5E !important; --bs-danger-rgb:  244, 63, 94 !important;
    --bs-warning: #F59E0B !important; --bs-warning-rgb: 245, 158, 11 !important;
    --bs-info:    #38BDF8 !important; --bs-info-rgb:    56, 189, 248 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #0F766E, #0A1832) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #0F766E, #0A1832) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #0F766E, #0A1832) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #0F766E, #0A1832) fixed !important;
}

/* ---------- THEME : orange (ambre doux) ---------- */
[data-theme-mode=orange] {
    --bs-primary: #F59E0B !important; --bs-primary-rgb: 245, 158, 11 !important;
    --bs-success: #10B981 !important; --bs-success-rgb: 16, 185, 129 !important;
    --bs-danger:  #EF4444 !important; --bs-danger-rgb:  239, 68, 68 !important;
    --bs-warning: #FBBF24 !important; --bs-warning-rgb: 251, 191, 36 !important;
    --bs-info:    #38BDF8 !important; --bs-info-rgb:    56, 189, 248 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #B45309, #0A1832) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #B45309, #0A1832) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #B45309, #0A1832) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #B45309, #0A1832) fixed !important;
}

/* ---------- THEME : purple (lavande chaleureuse) ---------- */
[data-theme-mode=purple] {
    --bs-primary: #8B5CF6 !important; --bs-primary-rgb: 139, 92, 246 !important;
    --bs-success: #34D399 !important; --bs-success-rgb: 52, 211, 153 !important;
    --bs-danger:  #FB7185 !important; --bs-danger-rgb:  251, 113, 133 !important;
    --bs-warning: #FBBF24 !important; --bs-warning-rgb: 251, 191, 36 !important;
    --bs-info:    #93C5FD !important; --bs-info-rgb:    147, 197, 253 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #6D28D9, #1E1B4B) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #6D28D9, #1E1B4B) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #6D28D9, #1E1B4B) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #6D28D9, #1E1B4B) fixed !important;
}

/* ---------- THEME : green (vert tendre) ---------- */
[data-theme-mode=green] {
    --bs-primary: #16A34A !important; --bs-primary-rgb: 22, 163, 74 !important;
    --bs-success: #4ADE80 !important; --bs-success-rgb: 74, 222, 128 !important;
    --bs-danger:  #F87171 !important; --bs-danger-rgb:  248, 113, 113 !important;
    --bs-warning: #FBBF24 !important; --bs-warning-rgb: 251, 191, 36 !important;
    --bs-info:    #06B6D4 !important; --bs-info-rgb:    6, 182, 212 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #166534, #0A1832) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #166534, #0A1832) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #166534, #0A1832) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #166534, #0A1832) fixed !important;
}

/* ---------- THEME : red (corail doux, pas agressif) ---------- */
[data-theme-mode=red] {
    --bs-primary: #EF4444 !important; --bs-primary-rgb: 239, 68, 68 !important;
    --bs-success: #22C55E !important; --bs-success-rgb: 34, 197, 94 !important;
    --bs-danger:  #DC2626 !important; --bs-danger-rgb:  220, 38, 38 !important;
    --bs-warning: #F59E0B !important; --bs-warning-rgb: 245, 158, 11 !important;
    --bs-info:    #2E86C1 !important; --bs-info-rgb:    46, 134, 193 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #991B1B, #0A1832) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #991B1B, #0A1832) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #991B1B, #0A1832) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #991B1B, #0A1832) fixed !important;
}

/* ---------- NEW THEME : indigo (indigo + ambre) ---------- */
[data-theme-mode=indigo] {
    --bs-primary: #4F46E5 !important; --bs-primary-rgb: 79, 70, 229 !important;
    --bs-success: #10B981 !important; --bs-success-rgb: 16, 185, 129 !important;
    --bs-danger:  #EF4444 !important; --bs-danger-rgb:  239, 68, 68 !important;
    --bs-warning: #F59E0B !important; --bs-warning-rgb: 245, 158, 11 !important;
    --bs-info:    #06B6D4 !important; --bs-info-rgb:    6, 182, 212 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #312E81, #0A1832) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #312E81, #0A1832) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #312E81, #0A1832) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #312E81, #0A1832) fixed !important;
}

/* ---------- NEW THEME : coral (pêche / corail) ---------- */
[data-theme-mode=coral] {
    --bs-primary: #FB7185 !important; --bs-primary-rgb: 251, 113, 133 !important;
    --bs-success: #34D399 !important; --bs-success-rgb: 52, 211, 153 !important;
    --bs-danger:  #E11D48 !important; --bs-danger-rgb:  225, 29, 72 !important;
    --bs-warning: #FDBA74 !important; --bs-warning-rgb: 253, 186, 116 !important;
    --bs-info:    #38BDF8 !important; --bs-info-rgb:    56, 189, 248 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #9F1239, #1E1B4B) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #9F1239, #1E1B4B) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #9F1239, #1E1B4B) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #9F1239, #1E1B4B) fixed !important;
}

/* ---------- NEW THEME : slate (gris-bleu, sobre & convivial) ---------- */
[data-theme-mode=slate] {
    --bs-primary: #64748B !important; --bs-primary-rgb: 100, 116, 139 !important;
    --bs-success: #22C55E !important; --bs-success-rgb: 34, 197, 94 !important;
    --bs-danger:  #EF4444 !important; --bs-danger-rgb:  239, 68, 68 !important;
    --bs-warning: #F59E0B !important; --bs-warning-rgb: 245, 158, 11 !important;
    --bs-info:    #0EA5E9 !important; --bs-info-rgb:    14, 165, 233 !important;
    --bs-sidebar-dark-bg: radial-gradient(at 50% -20%, #334155, #0F172A) fixed !important;
    --bs-sidebar-dark-gradient: radial-gradient(at 50% -20%, #334155, #0F172A) fixed !important;
    --bs-dash-gradient:   radial-gradient(at 50% -20%, #334155, #0F172A) fixed !important;
    --bs-bg-topbar-color: radial-gradient(at 50% -20%, #334155, #0F172A) fixed !important;
}

/* ---------- COMMON COMPONENT OVERRIDES (uses --bs-* vars) ---------- */
.btn-primary, .bg-primary { background-color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; }
.btn-success, .bg-success { background-color: var(--bs-success) !important; border-color: var(--bs-success) !important; }
.btn-danger,  .bg-danger  { background-color: var(--bs-danger)  !important; border-color: var(--bs-danger)  !important; }
.btn-warning, .bg-warning { background-color: var(--bs-warning) !important; border-color: var(--bs-warning) !important; color: #1F2A37 !important; }
.btn-info,    .bg-info    { background-color: var(--bs-info)    !important; border-color: var(--bs-info)    !important; color: #fff !important; }

.btn-outline-primary { color: var(--bs-primary) !important; border-color: var(--bs-primary) !important; }
.btn-outline-primary:hover { background-color: var(--bs-primary) !important; color:#fff !important; }

.text-primary { color: var(--bs-primary) !important; }
.text-success { color: var(--bs-success) !important; }
.text-danger  { color: var(--bs-danger)  !important; }
.text-warning { color: var(--bs-warning) !important; }
.text-info    { color: var(--bs-info)    !important; }

.bg-soft-primary { background-color: rgba(var(--bs-primary-rgb), 0.15) !important; color: var(--bs-primary) !important; }
.bg-soft-success { background-color: rgba(var(--bs-success-rgb), 0.15) !important; color: var(--bs-success) !important; }
.bg-soft-warning { background-color: rgba(var(--bs-warning-rgb), 0.18) !important; }
.bg-soft-danger  { background-color: rgba(var(--bs-danger-rgb),  0.15) !important; color: var(--bs-danger) !important; }
.bg-soft-info    { background-color: rgba(var(--bs-info-rgb),    0.18) !important; }

a { color: var(--bs-primary); }
a:hover { filter: brightness(0.85); }

.navbar-brand-box,
.vertical-menu,
#sidebar-menu,
.topnav,
#page-topbar,
#page-topbar .navbar-header {
    background: var(--bs-sidebar-dark-bg) !important;
}

/* Topbar text + icons readable on the new gradient */
#page-topbar .header-item,
#page-topbar .navbar-brand,
#page-topbar a,
#page-topbar i,
#page-topbar .badge.bg-danger { color: #ffffff !important; }
#page-topbar .header-item:hover,
#page-topbar .header-item:focus { background: rgba(255, 255, 255, 0.08) !important; }
#page-topbar .search-input {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
}
#page-topbar .search-input::placeholder { color: rgba(255, 255, 255, 0.7) !important; }
#page-topbar #vertical-menu-btn { color: #ffffff !important; }

#sidebar-menu ul li a.active,
#sidebar-menu ul li.mm-active > a {
    color: var(--bs-warning) !important;
}

/* Page title stays dark for legibility, accent via underline only */
.page-title-box h4 {
    color: #1F2A37 !important;
    border-bottom: 2px solid rgba(var(--bs-primary-rgb), 0.35);
    display: inline-block;
    padding-bottom: 2px;
}

/* Primary buttons always render white text regardless of theme hue */
.btn-primary,
.btn-success,
.btn-danger,
.btn-info { color: #ffffff !important; }
.btn-warning { color: #1F2A37 !important; }

/* Dropdown items dropped from the topbar stay legible (dark on white) */
#page-topbar .dropdown-menu,
#page-topbar .dropdown-menu a,
#page-topbar .dropdown-menu .dropdown-item,
#page-topbar .dropdown-menu i,
#page-topbar .dropdown-menu h5,
#page-topbar .dropdown-menu h6,
#page-topbar .dropdown-menu p,
#page-topbar .dropdown-menu small { color: #1F2A37 !important; }
#page-topbar .dropdown-menu .text-danger,
#page-topbar .dropdown-menu .text-danger i { color: var(--bs-danger) !important; }
#page-topbar .dropdown-menu .dropdown-item:hover { background: rgba(var(--bs-primary-rgb), 0.08) !important; }

/* Right-bar (settings panel) stays neutral so labels are readable on any theme */
.right-bar,
.right-bar .form-check-label,
.right-bar h5,
.right-bar h6,
.right-bar a { color: #1F2A37 !important; }
.right-bar { background: #ffffff !important; }
.rightbar-title { background: rgba(var(--bs-primary-rgb), 0.08) !important; }

/* ---------- THEME PICKER SWATCHES (visual preview in right-bar) ---------- */
.theme-color-swatch {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 50%;
    margin-right: 6px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #CBD5E1;
    vertical-align: middle;
}
.theme-color-swatch.s-default { background: linear-gradient(135deg, #2E86C1, #1F4E79); }
.theme-color-swatch.s-teal    { background: linear-gradient(135deg, #14B8A6, #0F766E); }
.theme-color-swatch.s-orange  { background: linear-gradient(135deg, #F59E0B, #B45309); }
.theme-color-swatch.s-purple  { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.theme-color-swatch.s-green   { background: linear-gradient(135deg, #16A34A, #166534); }
.theme-color-swatch.s-red     { background: linear-gradient(135deg, #EF4444, #991B1B); }
.theme-color-swatch.s-indigo  { background: linear-gradient(135deg, #4F46E5, #312E81); }
.theme-color-swatch.s-coral   { background: linear-gradient(135deg, #FB7185, #9F1239); }
.theme-color-swatch.s-slate   { background: linear-gradient(135deg, #64748B, #334155); }
