/**
 * Osun Theme - Main Stylesheet
 *
 * Structure:
 * 1. CSS Variables / Custom Properties
 * 2. Reset & Base
 * 3. Layout Components
 * 4. Header
 * 5. Sidebar
 * 6. Menu
 * 7. Main Content
 * 8. Theme Components
 * 9. Customizer
 * 10. Utilities
 * 11. Accessibility
 * 12. Responsive
 */

/* ==========================================================================
   1. CSS Variables / Custom Properties
   ========================================================================== */

:root {
    /* Layout */
    --osun-header-height: 60px;
    --osun-sidebar-expanded: 288px;
    --osun-sidebar-collapsed: 60px;
    --osun-sidebar-width: var(--osun-sidebar-expanded);

    /* Transitions */
    --osun-transition-fast: 150ms ease;
    --osun-transition-normal: 250ms ease;
    --osun-transition-slow: 350ms ease;

    /* Border radius */
    --osun-radius-sm: 4px;
    --osun-radius-md: 8px;
    --osun-radius-lg: 12px;
    --osun-radius-full: 9999px;

    /* Shadows */
    --osun-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --osun-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --osun-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --osun-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Z-index layers */
    --osun-z-dropdown: 100;
    --osun-z-sticky: 200;
    --osun-z-header: 300;
    --osun-z-sidebar: 400;
    --osun-z-modal: 500;
    --osun-z-customizer: 600;

    /* Colors - Base (Light theme defaults) */
    --osun-primary-h: 28;
    --osun-primary-s: 78%;
    --osun-primary-l: 44%;
    --osun-primary: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    --osun-primary-hover: hsl(var(--osun-primary-h), var(--osun-primary-s), calc(var(--osun-primary-l) + 10%));

    --osun-accent-h: 280;
    --osun-accent-s: 70%;
    --osun-accent-l: 50%;
    --osun-accent: hsl(var(--osun-accent-h), var(--osun-accent-s), var(--osun-accent-l));
    --osun-accent-hover: hsl(var(--osun-accent-h), var(--osun-accent-s), calc(var(--osun-accent-l) + 10%));

    --osun-success-h: 142;
    --osun-success-s: 70%;
    --osun-success-l: 45%;
    --osun-success: hsl(var(--osun-success-h), var(--osun-success-s), var(--osun-success-l));
    --osun-success-hover: hsl(var(--osun-success-h), var(--osun-success-s), calc(var(--osun-success-l) + 10%));

    --osun-warning-h: 38;
    --osun-warning-s: 92%;
    --osun-warning-l: 50%;
    --osun-warning: hsl(var(--osun-warning-h), var(--osun-warning-s), var(--osun-warning-l));
    --osun-warning-hover: hsl(var(--osun-warning-h), var(--osun-warning-s), calc(var(--osun-warning-l) + 10%));

    --osun-danger-h: 0;
    --osun-danger-s: 84%;
    --osun-danger-l: 60%;
    --osun-danger: hsl(var(--osun-danger-h), var(--osun-danger-s), var(--osun-danger-l));
    --osun-danger-hover: hsl(var(--osun-danger-h), var(--osun-danger-s), calc(var(--osun-danger-l) + 10%));

    /* Theme Colors - Light Mode */
    --osun-bg: #ece5d8;
    --osun-bg-alt: #e5ddd0;
    --osun-bg-muted: #ddd4c4;
    --osun-surface: #ece5d8;
    --osun-surface-hover: rgba(200, 117, 24, 0.15);
    --osun-surface-active: rgba(200, 117, 24, 0.25);
    --osun-border: #c4a878;
    --osun-border-muted: #cdb898;
    --osun-text: #2a1e0a;
    --osun-text-muted: #8a6848;
    --osun-text-light: #b09070;

    /* Header specific */
    --osun-header-bg: #e4dbc8;
    --osun-header-border: var(--osun-border);
    --osun-header-text: var(--osun-text);

    /* Sidebar specific */
    --osun-sidebar-bg: #ddd4c4;
    --osun-sidebar-text: #2a1e0a;
    --osun-sidebar-text-muted: #8a6848;
    --osun-sidebar-border: #c4a878;
    --osun-sidebar-hover: rgba(200, 117, 24, 0.10);
    --osun-sidebar-active: rgba(200, 117, 24, 0.22);

    /* button bg colors */
    --osun-primary-btn-bg: var(--osun-primary);
    --osun-accent-btn-bg: var(--osun-accent);
    --osun-success-btn-bg: var(--osun-success);
    --osun-warning-btn-bg: var(--osun-warning);
    --osun-danger-btn-bg: var(--osun-danger);
}

/* Light Theme (explicit) */
[data-osun-theme="light"],
[data-osun-theme="system"][data-osun-resolved="light"] {
    --osun-primary-h: 28;
    --osun-primary-s: 78%;
    --osun-primary-l: 44%;

    --osun-bg: #ece5d8;
    --osun-bg-alt: #e5ddd0;
    --osun-bg-muted: #ddd4c4;
    --osun-surface: #ece5d8;
    --osun-surface-hover: rgba(200, 117, 24, 0.15);
    --osun-surface-active: rgba(200, 117, 24, 0.25);
    --osun-border: #c4a878;
    --osun-border-muted: #cdb898;
    --osun-text: #2a1e0a;
    --osun-text-muted: #8a6848;
    --osun-text-light: #b09070;

    --osun-header-bg: #e4dbc8;
    --osun-header-border: var(--osun-border);
    --osun-header-text: var(--osun-text);

    --osun-sidebar-bg: #ddd4c4;
    --osun-sidebar-text: #2a1e0a;
    --osun-sidebar-text-muted: #8a6848;
    --osun-sidebar-border: #c4a878;
    --osun-sidebar-hover: rgba(200, 117, 24, 0.10);
    --osun-sidebar-active: rgba(200, 117, 24, 0.22);

    /* Light mode shadows */
    --osun-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --osun-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --osun-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Bootstrap bridge */
    --bs-body-bg: #ece5d8;
    --bs-body-color: #2a1e0a;
    --bs-border-color: #c4a878;
    --bs-border-color-translucent: rgba(196, 168, 120, 0.25);
    --bs-secondary-bg: #e5ddd0;
    --bs-tertiary-bg: #ddd4c4;
    --bs-secondary-color: rgba(42, 30, 10, 0.75);
    --bs-tertiary-color: rgba(42, 30, 10, 0.5);
    --bs-emphasis-color: #1a1006;
    --bs-primary-rgb: 200, 117, 24;
    --bs-focus-ring-color: rgba(200, 117, 24, 0.25);
    --bs-link-color: hsl(28, 78%, 44%);
    --bs-link-color-rgb: 200, 117, 24;
}

/* Dark Theme */
[data-osun-theme="dark"],
[data-osun-theme="system"][data-osun-resolved="dark"] {
    --osun-primary-h: 211;
    --osun-primary-s: 62%;
    --osun-primary-l: 54%;

    --osun-bg: #1a2235;
    --osun-bg-alt: #1e2840;
    --osun-bg-muted: #232e48;
    --osun-surface: #1a2235;
    --osun-surface-hover: rgba(74, 143, 208, 0.2);
    --osun-surface-active: rgba(74, 143, 208, 0.3);
    --osun-border: #2d3f5c;
    --osun-border-muted: #253555;
    --osun-text: #c2d4e8;
    --osun-text-muted: #6888a8;
    --osun-text-light: #4a6080;

    --osun-header-bg: #151e2e;
    --osun-header-border: #2d3f5c;
    --osun-header-text: #c2d4e8;

    --osun-sidebar-bg: #141c2c;
    --osun-sidebar-text: #c2d4e8;
    --osun-sidebar-text-muted: #6888a8;
    --osun-sidebar-border: #253555;
    --osun-sidebar-hover: rgba(74, 143, 208, 0.12);
    --osun-sidebar-active: rgba(74, 143, 208, 0.25);

    /* Adjust shadows for dark mode */
    --osun-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --osun-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --osun-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);

    /* Bootstrap bridge */
    --bs-body-bg: #1a2235;
    --bs-body-color: #c2d4e8;
    --bs-border-color: #2d3f5c;
    --bs-border-color-translucent: rgba(45, 63, 92, 0.5);
    --bs-secondary-bg: #1e2840;
    --bs-tertiary-bg: #232e48;
    --bs-secondary-color: rgba(194, 212, 232, 0.75);
    --bs-tertiary-color: rgba(194, 212, 232, 0.5);
    --bs-emphasis-color: #e0ecf8;
    --bs-primary-rgb: 74, 143, 208;
    --bs-focus-ring-color: rgba(74, 143, 208, 0.25);
    --bs-link-color: hsl(211, 62%, 54%);
    --bs-link-color-rgb: 74, 143, 208;
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c2d4e8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* System theme with media query */
@media (prefers-color-scheme: light) {
    [data-osun-theme="system"] {
        --osun-primary-h: 28;
        --osun-primary-s: 78%;
        --osun-primary-l: 44%;
        --osun-bg: #ece5d8;
        --osun-bg-alt: #e5ddd0;
        --osun-bg-muted: #ddd4c4;
        --osun-surface: #ece5d8;
        --osun-surface-hover: rgba(200, 117, 24, 0.15);
        --osun-surface-active: rgba(200, 117, 24, 0.25);
        --osun-border: #c4a878;
        --osun-border-muted: #cdb898;
        --osun-text: #2a1e0a;
        --osun-text-muted: #8a6848;
        --osun-text-light: #b09070;
        --osun-header-bg: #e4dbc8;
        --osun-header-border: var(--osun-border);
        --osun-header-text: var(--osun-text);
        --osun-sidebar-bg: #ddd4c4;
        --osun-sidebar-text: #2a1e0a;
        --osun-sidebar-text-muted: #8a6848;
        --osun-sidebar-border: #c4a878;
        --bs-body-bg: #ece5d8;
        --bs-body-color: #2a1e0a;
        --bs-border-color: #c4a878;
        --bs-secondary-bg: #e5ddd0;
        --bs-tertiary-bg: #ddd4c4;
        --bs-primary-rgb: 200, 117, 24;
        --bs-focus-ring-color: rgba(200, 117, 24, 0.25);
    }
}

@media (prefers-color-scheme: dark) {
    /* :not([data-osun-resolved]) : ne s'applique qu'avant la résolution JS
       (osun.js pose toujours data-osun-resolved), pour éviter tout conflit
       une fois le thème système résolu côté client. */
    [data-osun-theme="system"]:not([data-osun-resolved]) {
        --osun-primary-h: 211;
        --osun-primary-s: 62%;
        --osun-primary-l: 54%;
        --osun-bg: #1a2235;
        --osun-bg-alt: #1e2840;
        --osun-bg-muted: #232e48;
        --osun-surface: #1a2235;
        --osun-surface-hover: rgba(74, 143, 208, 0.2);
        --osun-surface-active: rgba(74, 143, 208, 0.3);
        --osun-border: #2d3f5c;
        --osun-border-muted: #253555;
        --osun-text: #c2d4e8;
        --osun-text-muted: #6888a8;
        --osun-text-light: #4a6080;
        --osun-header-bg: #151e2e;
        --osun-header-border: #2d3f5c;
        --osun-header-text: #c2d4e8;
        --osun-sidebar-bg: #141c2c;
        --osun-sidebar-text: #c2d4e8;
        --osun-sidebar-text-muted: #6888a8;
        --osun-sidebar-border: #253555;
        --bs-body-bg: #1a2235;
        --bs-body-color: #c2d4e8;
        --bs-border-color: #2d3f5c;
        --bs-secondary-bg: #1e2840;
        --bs-tertiary-bg: #232e48;
        --bs-primary-rgb: 74, 143, 208;
        --bs-focus-ring-color: rgba(74, 143, 208, 0.25);
    }
}

/* High Contrast Mode */
[data-osun-high-contrast="true"] {
    --osun-text: #000000;
    --osun-text-muted: #333333;
    --osun-border: #000000;
}

[data-osun-high-contrast="true"][data-osun-theme="dark"],
[data-osun-high-contrast="true"][data-osun-theme="system"][data-osun-resolved="dark"] {
    --osun-text: #ffffff;
    --osun-text-muted: #cccccc;
    --osun-border: #ffffff;
}

/* Monochrome Mode */
[data-osun-monochrome="true"] {
    filter: grayscale(100%);
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

[data-osun-reduced-motion="true"] *,
[data-osun-reduced-motion="true"] *::before,
[data-osun-reduced-motion="true"] *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--osun-text);
    background-color: var(--osun-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   3. Layout Components
   ========================================================================== */

.osun-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.osun-body {
    display: flex;
    flex: 1;
    padding-top: var(--osun-header-height);
}

/* ==========================================================================
   4. Header
   ========================================================================== */

.osun-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--osun-header-height);
    display: flex;
    align-items: center;
    background: var(--osun-header-bg);
    border-bottom: 1px solid var(--osun-header-border);
    z-index: var(--osun-z-header);
}

.osun-header-logo {
    width: var(--osun-sidebar-width);
    min-width: var(--osun-sidebar-collapsed);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: left;
    border-right: 1px solid var(--osun-header-border);
    transition: width var(--osun-transition-normal);
}

.osun-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--osun-text);
    font-weight: 600;
    font-size: 1.125rem;
    overflow: hidden;
    padding: 0.5rem;
}

[data-osun-sidebar="collapsed"] .osun-logo {
    padding: 0.5rem;
}

.osun-logo-image,
.osun-logo-text {
    display: block;
}

.osun-logo-image-mini,
.osun-logo-text-mini {
    display: none;
}

.osun-logo-image, .osun-logo-image-mini {
    max-height: 44px;
    width: auto;
}

.osun-header-title {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    min-width: 0;
}

.osun-page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.osun-page-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: var(--osun-primary);
    margin-right: 0.5rem;
}

.osun-page-icon svg {
    width: 100%;
    height: 100%;
}

.osun-page-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--osun-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.osun-header-tools {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem;
}

.osun-tools-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.osun-tool-item {
    display: flex;
    align-items: center;
    height: 40px;
    border: 1px solid var(--osun-border);
    background: var(--osun-surface);
    color: var(--osun-text);
    border-radius: var(--osun-radius-full);
    transition: background-color var(--osun-transition-fast), border-color var(--osun-transition-fast);
}

.osun-tool-item:hover {
    background: var(--osun-surface-hover);
    border-color: var(--osun-primary);
}

/* ==========================================================================
   5. Sidebar
   ========================================================================== */

.osun-sidebar {
    position: fixed;
    top: var(--osun-header-height);
    left: 0;
    bottom: 0;
    width: var(--osun-sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--osun-sidebar-bg);
    border-right: 1px solid var(--osun-sidebar-border);
    z-index: var(--osun-z-sidebar);
    transition: width var(--osun-transition-normal);
    overflow: hidden;
}

.osun-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 40px;
    border-bottom: 1px solid var(--osun-sidebar-border);
}

.osun-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    width: 100%;
    height: 100%;
    padding: 0 1rem;
    border: none;
    background: transparent;
    color: var(--osun-sidebar-text);
    cursor: pointer;
    transition: background-color var(--osun-transition-fast), width var(--osun-transition-fast);
}

.osun-sidebar-toggle:hover {
    background: var(--osun-sidebar-hover);
}

.osun-sidebar-toggle svg {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

/* Label du toggle */
.osun-sidebar-toggle-label {
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--osun-transition-fast), width var(--osun-transition-fast);
}

/* Sidebar toggle icons - show/hide based on state */
.osun-sidebar-icon-close,
.osun-sidebar-icon-open {
    transition: opacity var(--osun-transition-fast), transform var(--osun-transition-fast);
}

/* État expanded : montrer l'icône "close" (flèche vers la gauche) */
.osun-sidebar-icon-close {
    display: block;
}

.osun-sidebar-icon-open {
    display: none;
}

.osun-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0;
}

.osun-sidebar-footer {
    border-top: 1px solid var(--osun-sidebar-border);
    padding: 0.5rem;
}

.osun-sidebar-tools {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.osun-sidebar-tool-item {
    display: flex;
}

/* Collapsed sidebar state */
[data-osun-sidebar="collapsed"] {
    --osun-sidebar-width: var(--osun-sidebar-collapsed);
}


[data-osun-sidebar="collapsed"] .osun-logo-image,
[data-osun-sidebar="collapsed"] .osun-logo-text {
    display: none;
}

[data-osun-sidebar="collapsed"] .osun-logo-image-mini,
[data-osun-sidebar="collapsed"] .osun-logo-text-mini {
    display: block;
}

[data-osun-sidebar="collapsed"] .osun-menu-label,
[data-osun-sidebar="collapsed"] .osun-menu-badge,
[data-osun-sidebar="collapsed"] .osun-menu-arrow {
    opacity: 0;
    visibility: hidden;
}

[data-osun-sidebar="collapsed"] .osun-submenu {
    display: none;
}

/* ── Collapsed: débloquer l'overflow pour les flyouts ─────────────────── */
[data-osun-sidebar="collapsed"] .osun-sidebar,
[data-osun-sidebar="collapsed"] .osun-sidebar-nav {
    overflow: visible;
}

/* ── Collapsed: tooltip sur les items sans enfants (niveau 0) ─────────── */
[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item::after {
    content: attr(data-label);
    position: absolute;
    left: calc(var(--osun-sidebar-collapsed) - 1px);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: var(--osun-sidebar-bg);
    color: var(--osun-sidebar-text);
    padding: 0.955rem 0.75rem;
    border-radius: 0 var(--osun-radius-md) var(--osun-radius-md) 0;
    box-shadow: var(--osun-shadow-md);
    font-size: 0.8125rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--osun-transition-fast), visibility var(--osun-transition-fast);
    z-index: 1001;
    width: calc(var(--osun-sidebar-expanded) - var(--osun-sidebar-collapsed));
}

[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.active::after {
    background: var(--osun-sidebar-active);
    color: var(--osun-primary);
}

[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ── Collapsed: flyout popup sur les items avec enfants (niveau 0) ─────── */
[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.has-children .osun-submenu {
    display: block;
    position: absolute;
    left: var(--osun-sidebar-collapsed);
    top: 100%;
    min-width: 200px;
    max-height: none;
    overflow: visible;
    background: var(--osun-sidebar-bg);
    border: 1px solid var(--osun-sidebar-border);
    border-left: 3px solid var(--osun-primary);
    border-radius: 0 4px 4px 0;
    box-shadow: var(--osun-shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--osun-transition-fast), visibility var(--osun-transition-fast);
    z-index: 1001;
    pointer-events: none;
    width: calc(var(--osun-sidebar-expanded) - var(--osun-sidebar-collapsed));
}

[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.has-children:hover .osun-submenu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Header du flyout (label du parent) ────────────────────────────────── */
.osun-submenu-header {
    display: none;
    padding: 0.5rem 1rem 0.375rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--osun-sidebar-text-muted);
    border-bottom: 1px solid var(--osun-sidebar-border);
    list-style: none;
}

[data-osun-sidebar="collapsed"] .osun-submenu-header {
    display: block;
}

/* ── Flyout: labels et badges visibles dans le popup ───────────────────── */
[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.has-children .osun-submenu .osun-menu-link {
    padding-left: 1rem;
    border-radius: 0;
    margin: 0;
}

[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.has-children .osun-submenu .osun-menu-label,
[data-osun-sidebar="collapsed"] .osun-menu-list > .osun-menu-item.has-children .osun-submenu .osun-menu-badge {
    opacity: 1;
    visibility: visible;
}

/* ── Collapsed: masquer le bouton quicktask ─────────────────────────────── */
[data-osun-sidebar="collapsed"] .osun-menu-quicktask {
    display: none !important;
}

[data-osun-sidebar="collapsed"] .osun-menu-item.has-quicktask > .osun-menu-link {
    padding-right: 0.5rem;
}

[data-osun-sidebar="collapsed"] .osun-sidebar-toggle:hover::after,
[data-osun-sidebar="collapsed"] .osun-sidebar-toggle:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

/* État collapsed : montrer l'icône "open" (flèche vers la droite) */
[data-osun-sidebar="collapsed"] .osun-sidebar-icon-close {
    display: none;
}

[data-osun-sidebar="collapsed"] .osun-sidebar-icon-open {
    display: block;
}

/* Cacher le label quand collapsed */
[data-osun-sidebar="collapsed"] .osun-sidebar-toggle-label {
    display: none;
}

/* Tooltip pour état collapsed */
[data-osun-sidebar="collapsed"] .osun-sidebar-toggle {
    position: relative;
}

[data-osun-sidebar="collapsed"] .osun-sidebar-toggle::after {
    content: attr(data-tooltip-collapsed);
    position: absolute;
    left: calc(100% + 0.75rem);
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--osun-bg);
    color: var(--osun-text);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    border-radius: var(--osun-radius-md);
    box-shadow: var(--osun-shadow-lg);
    border: 1px solid var(--osun-border);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--osun-transition-fast), visibility var(--osun-transition-fast);
    z-index: var(--osun-z-dropdown);
}


/* ==========================================================================
   6. Menu
   ========================================================================== */

.osun-menu {
    padding: 0;
}

.osun-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.osun-menu-item {
    position: relative;
    margin: 0;
}

.osun-menu-quicktask {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    border: 1px dotted slategrey;
    color: var(--osun-sidebar-text-muted, #8a9bb0);
    font-size: 0.75rem;
    transition: background-color var(--osun-transition-fast), color var(--osun-transition-fast);
    flex-shrink: 0;
    text-decoration: none;
}

.osun-menu-item:hover > .osun-menu-quicktask {
    display: flex;
}

.osun-menu-quicktask:hover {
    background: var(--osun-primary);
    color: #fff;
}

#menuitem-link-preview,
#menuitem-quicktask-preview {
    font-size: x-large;
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
}

#menuitem-quicktask-preview span {
    margin-right: 2rem;
}

/* Empêche le label de passer sous le bouton quicktask */
.osun-menu-item.has-quicktask > .osun-menu-link {
    padding-right: 2.5rem;
}

.osun-menu-divider {
    height: 1px;
    margin: 0.2rem 0.5rem;
    background: var(--osun-sidebar-border);
}

.osun-menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.5rem;
    color: var(--osun-sidebar-text);
    text-decoration: none;
    border-radius: var(--osun-radius-md);
    margin: 0.125rem 0.5rem;
    transition: background-color var(--osun-transition-fast), color var(--osun-transition-fast);
}

.osun-menu-link:hover {
    background: var(--osun-sidebar-hover);
    color: var(--osun-sidebar-text);
}

.osun-menu-item.active > .osun-menu-link {
    background: var(--osun-sidebar-active);
    color: var(--osun-primary);
}

.osun-menu-item.disabled > .osun-menu-link {
    opacity: 0.5;
    pointer-events: none;
}

.osun-menu-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--osun-transition-fast);
}

.osun-menu-item.osun-menu-item-child .osun-menu-item-child .osun-menu-label {
    margin-left: 1rem;
}

.osun-menu-badge {
    flex-shrink: 0;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--osun-radius-full);
    background: var(--osun-primary);
    color: #fff;
    transition: opacity var(--osun-transition-fast);
}

.osun-menu-arrow {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    transition: transform var(--osun-transition-fast), opacity var(--osun-transition-fast);
}

.osun-menu-arrow svg {
    width: 100%;
    height: 100%;
    vertical-align: unset;
}

.osun-menu-item.open > .osun-menu-link .osun-menu-arrow {
    transform: rotate(90deg);
}

/* Submenu */
.osun-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--osun-transition-normal);
    background-color: var(--osun-bg-alt);
}

.osun-menu-item.open > .osun-submenu {
    max-height: 500px;
}

.osun-submenu .osun-menu-link {
    font-size: 0.875rem;
    padding-top: 0.47rem;
    padding-bottom: 0.47rem;
}

[data-osun-sidebar="collapsed"] .osun-menu-item .osun-menu-link {
    margin-right: 0;
    border-bottom-right-radius: 0;
    border-top-right-radius: 0;
}

[data-osun-sidebar="collapsed"] .osun-menu-item.active .osun-menu-link .osun-menu-label {
    background: var(--osun-sidebar-active);
    color: var(--osun-primary);
}

/* ==========================================================================
   7. Main Content
   ========================================================================== */

.osun-main {
    flex: 1;
    margin-left: var(--osun-sidebar-width);
    min-width: 0;
    transition: margin-left var(--osun-transition-normal);
}

.osun-no-sidebar .osun-main {
    margin-left: 0;
}

.osun-content {
    padding: 1.5rem;
    max-width: 100%;
}

/* ==========================================================================
   8. Theme Components (Buttons, Forms, etc.)
   ========================================================================== */

/* Buttons */
.osun-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: var(--osun-radius-md);
    cursor: pointer;
    transition: all var(--osun-transition-fast);
}

.osun-btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.osun-btn-primary {
    background: var(--osun-primary);
    color: #fff;
}

.osun-btn-primary:hover {
    filter: brightness(1.1);
}

.osun-btn-secondary {
    background: var(--osun-surface);
    color: var(--osun-text);
    border-color: var(--osun-border);
}

.osun-btn-secondary:hover {
    background: var(--osun-surface-hover);
}

/* Boutons avec bordures adaptatives pour thèmes light/dark */
.osun-btn-adaptive {
    --osun-border-lighten-amount: 15%;
    --osun-border-darken-amount: 20%;
}

/* Variantes colorées avec bordures adaptatives */
.osun-btn-adaptive-primary {
    --osun-btn-bg: var(--osun-primary);
    --osun-btn-color: #fff;
    --osun-btn-border-light: hsl(
        var(--osun-primary-h),
        var(--osun-primary-s),
        calc(var(--osun-primary-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-primary-h),
        var(--osun-primary-s),
        calc(var(--osun-primary-l) + var(--osun-border-lighten-amount))
    );
}

.osun-btn-adaptive-accent {
    --osun-btn-bg: var(--osun-accent);
    --osun-btn-color: #fff;
    --osun-btn-border-light: hsl(
        var(--osun-accent-h),
        var(--osun-accent-s),
        calc(var(--osun-accent-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-accent-h),
        var(--osun-accent-s),
        calc(var(--osun-accent-l) + var(--osun-border-lighten-amount))
    );
}

.osun-btn-adaptive-success {
    --osun-btn-bg: var(--osun-success);
    --osun-btn-color: #fff;
    --osun-btn-border-light: hsl(
        var(--osun-success-h),
        var(--osun-success-s),
        calc(var(--osun-success-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-success-h),
        var(--osun-success-s),
        calc(var(--osun-success-l) + var(--osun-border-lighten-amount))
    );
}

.osun-btn-adaptive-warning {
    --osun-btn-bg: var(--osun-warning);
    --osun-btn-color: var(--osun-text);
    --osun-btn-border-light: hsl(
        var(--osun-warning-h),
        var(--osun-warning-s),
        calc(var(--osun-warning-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-warning-h),
        var(--osun-warning-s),
        calc(var(--osun-warning-l) + var(--osun-border-lighten-amount))
    );
}

.osun-btn-adaptive-danger {
    --osun-btn-bg: var(--osun-danger);
    --osun-btn-color: #fff;
    --osun-btn-border-light: hsl(
        var(--osun-danger-h),
        var(--osun-danger-s),
        calc(var(--osun-danger-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-danger-h),
        var(--osun-danger-s),
        calc(var(--osun-danger-l) + var(--osun-border-lighten-amount))
    );
}

/* Appliquer les styles pour le thème light (par défaut) */
.osun-btn-adaptive {
    background-color: var(--osun-btn-bg);
    color: var(--osun-btn-color);
    border-color: var(--osun-btn-border-light);
}

/* Appliquer les styles pour le thème dark */
[data-osun-theme="dark"] .osun-btn-adaptive,
[data-osun-theme="system"]:not([data-osun-resolved="light"]) .osun-btn-adaptive {
    border-color: var(--osun-btn-border-dark);
}

/* Boutons outline adaptatifs */
.osun-btn-outline-adaptive {
    background-color: transparent;
    border-width: 2px;
}

.osun-btn-outline-adaptive-primary {
    --osun-btn-color: var(--osun-primary);
    --osun-btn-border-light: hsl(
        var(--osun-primary-h),
        var(--osun-primary-s),
        calc(var(--osun-primary-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        var(--osun-primary-h),
        var(--osun-primary-s),
        calc(var(--osun-primary-l) + var(--osun-border-lighten-amount))
    );
    color: var(--osun-btn-color);
    border-color: var(--osun-btn-border-light);
}

[data-osun-theme="dark"] .osun-btn-outline-adaptive-primary,
[data-osun-theme="system"]:not([data-osun-resolved="light"]) .osun-btn-outline-adaptive-primary {
    border-color: var(--osun-btn-border-dark);
}

.osun-btn-outline-adaptive-primary:hover {
    background-color: var(--osun-primary);
    color: #fff;
}

/* Effet au survol pour tous les boutons adaptatifs */
.osun-btn-adaptive:hover,
.osun-btn-outline-adaptive:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

/* Boutons pour le customizer */
.osun-customizer .osun-btn-adaptive {
    margin: 0.25rem;
}

/* Ajustements pour le mode contraste élevé */
[data-osun-high-contrast="true"] .osun-btn-adaptive {
    border-width: 2px;
}

.osun-btn-icon {
    width: 44px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--osun-text-muted);
    border-radius: var(--osun-radius-md);
}

.osun-btn-icon:hover {
    background: var(--osun-surface-hover);
    color: var(--osun-text);
}

.osun-btn-icon svg, .osun-btn-icon img, .osun-tool-item .osun-btn-icon svg {
    width: 20px;
    height: 20px;
}

.osun-tool-item .osun-btn-icon:hover {
    background: none;
}

/* Bouton logout : proportion 1 (hauteur) pour 2 (largeur) */
.osun-user-menu-logout .osun-btn-icon {
    width: auto;
    aspect-ratio: 1.5 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Theme Toggle */
.osun-theme-toggle, .osun-customizer-trigger, .osun-notification-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.25rem;
}

/* Theme Toggle Button (Dropdown trigger) */
.osun-theme-toggle-btn, .osun-notification-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: inherit;
    cursor: pointer;
    transition: all var(--osun-transition-fast);
    width: 100%;
    height: 100%;
}

/* Theme icons visibility */
.osun-theme-icon {
    width: 20px;
    height: 20px;
    display: none !important;
}

.osun-theme-icon svg {
    width: 100%;
    height: 100%;
}

/* Show appropriate icon based on theme */
[data-osun-theme="light"] .osun-theme-icon-light,
[data-osun-theme="system"][data-osun-resolved="light"] .osun-theme-icon-light {
    display: block !important;
}

[data-osun-theme="dark"] .osun-theme-icon-dark,
[data-osun-theme="system"]:not([data-osun-resolved="light"]) .osun-theme-icon-dark {
    display: block !important;
}

[data-osun-theme="system"][data-osun-resolved="dark"] .osun-theme-icon-system {
    display: none !important;
}

[data-osun-theme="system"]:not([data-osun-resolved]) .osun-theme-icon-system {
    display: block !important;
}

/* Theme labels visibility */
.osun-theme-label span {
    display: none;
}

[data-osun-theme="light"] .osun-theme-label-light,
[data-osun-theme="system"][data-osun-resolved="light"] .osun-theme-label-light {
    display: inline;
}

[data-osun-theme="dark"] .osun-theme-label-dark,
[data-osun-theme="system"]:not([data-osun-resolved="light"]) .osun-theme-label-dark {
    display: inline;
}

[data-osun-theme="system"]:not([data-osun-resolved]) .osun-theme-label-system {
    display: inline;
}

/* Theme Dropdown : rail vertical de boutons ronds compacts qui s'étendent
   au survol/focus pour révéler leur libellé (l'option active reste
   identifiable même repliée grâce à sa couleur d'accent). Les règles sont
   scopées sous .osun-theme-rail pour ne pas entrer en collision avec
   .osun-theme-option/.osun-theme-icon/.osun-theme-label utilisés ailleurs
   (ex: sélecteur de thème en cartes de la page profil). */
.osun-theme-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: -4px;
    /* Même largeur que le déclencheur (.osun-theme-toggle, son ancêtre
       positionné) plutôt qu'une largeur ajustée au contenu. */
    width: 100%;
    min-width: 0;
    padding: 0.5rem 0.2rem;
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-full);
    box-shadow: var(--osun-shadow-lg);
    z-index: var(--osun-z-dropdown);
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity var(--osun-transition-fast), transform var(--osun-transition-fast);
}

.osun-theme-dropdown.show {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    opacity: 1;
    transform: translateY(0);
    margin-top: 0.3rem !important;
}

.osun-theme-rail .osun-theme-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--osun-text-muted);
    border-radius: var(--osun-radius-full);
    cursor: pointer;
    transition: background-color var(--osun-transition-fast), color var(--osun-transition-fast);
}

.osun-theme-rail .osun-theme-option:hover,
.osun-theme-rail .osun-theme-option:focus-visible {
    background: var(--osun-surface-hover) !important;
    color: var(--osun-text);
}

.osun-theme-rail .osun-theme-option svg:first-child {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Le libellé ne redimensionne pas le bouton : il est positionné en
   absolu et déborde par-dessus le contenu voisin au lieu d'agrandir
   le cercle (rail vertical à largeur fixe). */
.osun-theme-rail .osun-theme-option span {
    position: absolute;
    top: 50%;
    right: calc(100% - 2.7rem);
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    padding: 0.4rem 0.75rem;
    padding-right: 4rem;
    border-radius:  var(--osun-radius-full);
    background: var(--osun-surface-hover);
    border: 1px solid var(--osun-border);
    box-shadow: var(--osun-shadow-md);
    font-size: 0.875rem;
    line-height: 2;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--osun-transition-fast);
}

.osun-theme-rail .osun-theme-option:hover span,
.osun-theme-rail .osun-theme-option:focus-visible span {
    opacity: 1;
}

/* Option active : accent visible même repliée, sans dépendre du survol */
[data-osun-theme="light"] .osun-theme-rail .osun-theme-option[data-theme="light"],
[data-osun-theme="dark"] .osun-theme-rail .osun-theme-option[data-theme="dark"],
[data-osun-theme="system"] .osun-theme-rail .osun-theme-option[data-theme="system"] {
    color: var(--osun-primary);
    background: var(--osun-surface-hover);
}

.osun-theme-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    height: 100%;
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: inherit;
    cursor: pointer;
    transition: all var(--osun-transition-fast);
}

.osun-theme-btn svg {
    width: 18px;
    height: 18px;
}

.osun-theme-toggle-large .osun-theme-btn {
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
}

.osun-theme-label {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Toggle Switch */
.osun-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.osun-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.osun-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--osun-border);
    border-radius: var(--osun-radius-full);
    transition: background-color var(--osun-transition-fast);
}

.osun-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--osun-shadow-sm);
    transition: transform var(--osun-transition-fast);
}

.osun-toggle-input:checked + .osun-toggle-switch {
    background: var(--osun-primary);
}

.osun-toggle-input:checked + .osun-toggle-switch::after {
    transform: translateX(20px);
}

.osun-toggle-input:focus-visible + .osun-toggle-switch {
    outline: 2px solid var(--osun-primary);
    outline-offset: 2px;
}

.osun-toggle-label {
    font-size: 0.9375rem;
    color: var(--osun-text);
}

/* Range Slider */
.osun-range-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.osun-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--osun-border);
    border-radius: var(--osun-radius-full);
    outline: none;
}

.osun-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--osun-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--osun-shadow-sm);
    transition: transform var(--osun-transition-fast);
}

.osun-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.osun-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--osun-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--osun-shadow-sm);
}

.osun-range-hue {
    background: linear-gradient(to right,
        hsl(0, 70%, 50%),
        hsl(60, 70%, 50%),
        hsl(120, 70%, 50%),
        hsl(180, 70%, 50%),
        hsl(240, 70%, 50%),
        hsl(300, 70%, 50%),
        hsl(360, 70%, 50%)
    );
}

.osun-range-value {
    min-width: 3rem;
    font-size: 0.8125rem;
    color: var(--osun-text-muted);
    text-align: right;
}

.osun-range-sm {
    height: 4px;
}

.osun-range-sm::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
}

.osun-range-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.osun-range-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--osun-text-muted);
    width: 12px;
}

/* Form elements */
.osun-form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--osun-text);
    margin-bottom: 0.5rem;
}

.osun-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: var(--osun-radius-sm);
    border: 1px solid var(--osun-border);
}

.osun-color-controls {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ==========================================================================
   9. User Menu
   ========================================================================== */

.osun-user-menu {
    position: relative;
}

.osun-user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.75rem;
    border: none;
    background: transparent;
    color: inherit;
    border-radius: inherit;
    cursor: pointer;
    transition: all var(--osun-transition-fast);
    width: 100%;
    height: 100%;
}

.osun-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.osun-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.osun-user-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--osun-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}

.osun-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.osun-user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--osun-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.osun-user-email {
    font-size: 0.75rem;
    color: var(--osun-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.osun-user-menu-arrow {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    transition: transform var(--osun-transition-fast);
}

.osun-user-menu-btn[aria-expanded="true"] .osun-user-menu-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.osun-user-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    box-shadow: var(--osun-shadow-lg);
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.osun-user-menu-dropdown.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.osun-user-menu-header {
    padding: 0.75rem 1rem;
}

.osun-user-menu-info .osun-user-name {
    font-size: 0.9375rem;
    font-weight: 600;
    max-width: none;
}

.osun-user-menu-info .osun-user-email {
    font-size: 0.8125rem;
    margin-top: 0.125rem;
    max-width: none;
}

.osun-user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    color: var(--osun-text);
    text-decoration: none;
    border-radius: var(--osun-radius-sm);
    background: transparent;
    transition: background-color var(--osun-transition-fast), color var(--osun-transition-fast);
}

.osun-user-menu-item:active {
    background: transparent;
}

.osun-user-menu-item:hover {
    background: var(--osun-surface-hover) !important;
    color: var(--osun-text);
}

.osun-user-menu-item.text-danger {
    color: var(--osun-danger);
}

.osun-user-menu-item.text-danger:hover {
    background: hsla(var(--osun-danger-h), var(--osun-danger-s), var(--osun-danger-l), 0.1);
    color: var(--osun-danger);
}

.osun-menu-icon {
    width: 30px;
    height: 30px;
    font-size: 1.4rem !important;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.osun-menu-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

.osun-user-menu-dropdown .dropdown-divider {
    margin: 0.5rem 0;
    border-color: var(--osun-border-muted);
}


/* Responsive: masquer le nom sur petit écran */
@media (max-width: 768px) {
    .osun-user-info {
        display: none;
    }

    .osun-user-menu-arrow {
        display: none;
    }

    .osun-user-menu-btn {
        padding: 0.375rem;
    }
}

/* ==========================================================================
   10. Customizer Panel
   ========================================================================== */

.osun-customizer {
    position: fixed;
    inset: 0;
    z-index: var(--osun-z-customizer);
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear var(--osun-transition-normal), opacity var(--osun-transition-normal);
}

.osun-customizer[aria-hidden="false"] {
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.osun-customizer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.osun-customizer-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--osun-surface);
    box-shadow: var(--osun-shadow-xl);
    transform: translateX(100%);
    transition: transform var(--osun-transition-normal);
}

.osun-customizer[aria-hidden="false"] .osun-customizer-panel {
    transform: translateX(0);
}

.osun-customizer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--osun-border);
}

.osun-customizer-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.osun-customizer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.osun-customizer-section {
    margin-bottom: 1.5rem;
}

.osun-customizer-section:last-child {
    margin-bottom: 0;
}

.osun-customizer-section-title {
    margin: 0 0 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--osun-text-muted);
}

.osun-customizer-row {
    margin-bottom: 1rem;
}

.osun-customizer-row:last-child {
    margin-bottom: 0;
}

.osun-customizer-color-row {
    padding: 0.75rem;
    background: var(--osun-bg-alt);
    border-radius: var(--osun-radius-md);
}

.osun-customizer-color-row .osun-form-label {
    margin-bottom: 0.75rem;
}

.osun-customizer-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--osun-border);
}

/* Hide sections based on theme */
[data-osun-theme="light"] [data-show-for="dark"],
[data-osun-theme="system"][data-osun-resolved="light"] [data-show-for="dark"] {
    display: none;
}

/* ==========================================================================
   10. Utilities
   ========================================================================== */

/* No Sidebar Layout */
.osun-no-sidebar .osun-main {
    margin-left: 0;
}

.osun-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.osun-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--osun-border) transparent;
}

.osun-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.osun-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.osun-scrollbar::-webkit-scrollbar-thumb {
    background: var(--osun-border);
    border-radius: var(--osun-radius-full);
}

/* ==========================================================================
   11. Accessibility - Focus States
   ========================================================================== */

:focus-visible {
    outline: 2px solid var(--osun-primary);
    outline-offset: 2px;
}

.osun-menu-link:focus-visible {
    outline-offset: -2px;
}

/* Skip link */
.osun-skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    background: var(--osun-primary);
    color: #fff;
    text-decoration: none;
    border-radius: var(--osun-radius-md);
    z-index: 9999;
    transition: top var(--osun-transition-fast);
}

.osun-skip-link:focus {
    top: 1rem;
}

/* ==========================================================================
   12. Responsive
   ========================================================================== */

@media (max-width: 991.98px) {
    :root {
        --osun-sidebar-width: var(--osun-sidebar-collapsed);
    }

    .osun-sidebar {
        transform: translateX(-100%);
    }

    [data-osun-sidebar="expanded"] .osun-sidebar {
        transform: translateX(0);
        width: var(--osun-sidebar-expanded);
        box-shadow: var(--osun-shadow-xl);
    }

    .osun-main {
        margin-left: 0;
    }
}

@media (max-width: 575.98px) {
    .osun-header-title {
        display: none;
    }

    .osun-content {
        padding: 1rem;
    }

    .osun-customizer-panel {
        width: 100%;
    }
}

/* ==========================================================================
   13. Login Layout
   ========================================================================== */

.osun-login-page {
    min-height: 100vh;
    background: var(--osun-bg);
}

.osun-login-page .card {
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    box-shadow: var(--osun-shadow-lg);
}

.osun-login-page .card .card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
    margin-bottom: 0rem;
    color: var(--osun-text);
}   

.osun-login-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Login Sidebar */
.osun-login-sidebar {
    position: relative;
    width: var(--osun-login-sidebar-width, 400px);
    min-height: 100vh;
    background: var(--osun-sidebar-bg);
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.osun-login-sidebar-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(0, 0, 0, 0.5) 50%,
        rgba(0, 0, 0, 0.7) 100%
    );
    pointer-events: none;
}

.osun-login-sidebar-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 2rem 1.5rem;
    color: #fff;
}

/* Login Message */
.osun-login-message {
    max-width: 100%;
}

.osun-login-message-title {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.osun-login-message-content {
    font-size: 1.0625rem;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 2rem;
}

.osun-login-message-content p {
    margin: 0 0 1rem;
}

.osun-login-message-content p:last-child {
    margin-bottom: 0;
}

/* Login Features List */
.osun-login-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.osun-login-feature {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.osun-login-feature-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--osun-radius-md);
    color: var(--osun-primary);
}

.osun-login-feature-icon svg {
    width: 20px;
    height: 20px;
}

.osun-login-feature-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.osun-login-feature-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #fff;
}

.osun-login-feature-desc {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Login Main Area */
.osun-login-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--osun-bg);
}

/* Login Header */
.osun-login-header {
    display: flex;
    justify-content: flex-end;
    padding: 1.5rem 2rem;
}

.osun-login-header-tools {
    display: flex;
    align-items: center;
}

.osun-login-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.osun-login-tool-item {
    display: flex;
    align-items: center;
}

/* Login Content */
.osun-login-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Login Logo */
.osun-login-logo {
    margin-bottom: 3rem;
    text-align: center;
}

.osun-login-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--osun-text);
}

.osun-login-logo-image {
    max-width: 200px;
    max-height: 80px;
    width: auto;
    height: auto;
}

.osun-login-logo-text {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--osun-primary), var(--osun-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Login Form Wrapper */
.osun-login-form-wrapper {
    width: 100%;
    max-width: 400px;
}

/* Login Form Styles */
.osun-login-form {
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-lg);
    padding: 0.5rem;
    box-shadow: var(--osun-shadow-lg);
}

.osun-login-form fieldset {
    border: none;
    margin: 0;
}

.osun-login-form-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--osun-text);
}

.osun-login-form-subtitle {
    margin: 0 0 2rem;
    font-size: 0.9375rem;
    text-align: center;
    color: var(--osun-text-muted);
}

.osun-login-form-group {
    margin-bottom: 1.25rem;
}

.osun-login-form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.osun-login-form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--osun-text);
}

.osun-login-form-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--osun-text);
    background: var(--osun-bg);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    transition: border-color var(--osun-transition-fast), box-shadow var(--osun-transition-fast);
}

.osun-login-form-input:focus {
    outline: none;
    border-color: var(--osun-primary);
    box-shadow: 0 0 0 3px rgba(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l), 0.15);
}

.osun-login-form-input::placeholder {
    color: var(--osun-text-light);
}

.osun-login-form-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.osun-login-form-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--osun-text-muted);
    cursor: pointer;
}

.osun-login-form-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--osun-primary);
}

.osun-login-form-forgot {
    font-size: 0.875rem;
    color: var(--osun-primary);
    text-decoration: none;
}

.osun-login-form-forgot:hover {
    text-decoration: underline;
}

.osun-login-form-submit {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--osun-primary);
    border: none;
    border-radius: var(--osun-radius-md);
    cursor: pointer;
    transition: filter var(--osun-transition-fast), transform var(--osun-transition-fast);
}

.osun-login-form-submit:hover {
    filter: brightness(1.1);
}

.osun-login-form-submit:active {
    transform: scale(0.98);
}

.osun-login-form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.osun-login-form-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--osun-text-muted);
    font-size: 0.8125rem;
}

.osun-login-form-divider::before,
.osun-login-form-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--osun-border);
}

.osun-login-form-social {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.osun-login-form-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--osun-text);
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--osun-transition-fast), border-color var(--osun-transition-fast);
}

.osun-login-form-social-btn:hover {
    background: var(--osun-surface-hover);
    border-color: var(--osun-text-light);
}

.osun-login-form-social-btn svg {
    width: 20px;
    height: 20px;
}

.osun-login-form-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--osun-border);
    text-align: center;
    font-size: 0.9375rem;
    color: var(--osun-text-muted);
}

.osun-login-form-footer a {
    color: var(--osun-primary);
    text-decoration: none;
    font-weight: 500;
}

.osun-login-form-footer a:hover {
    text-decoration: underline;
}

/* Login Footer */
.osun-login-footer {
    padding: 1.5rem 2rem;
    text-align: center;
}

.osun-login-footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.osun-login-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.osun-login-footer-link {
    font-size: 0.8125rem;
    color: var(--osun-text-muted);
    text-decoration: none;
    transition: color var(--osun-transition-fast);
}

.osun-login-footer-link:hover {
    color: var(--osun-text);
}

.osun-login-copyright {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--osun-text-light);
}

/* Language Selector Dropdown */
.osun-language-selector {
    position: relative;
}

.osun-btn-ghost {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--osun-text-muted);
    background: transparent;
    border: none;
    border-radius: var(--osun-radius-md);
    cursor: pointer;
    transition: background-color var(--osun-transition-fast), color var(--osun-transition-fast);
}

.osun-btn-ghost:hover {
    background: var(--osun-surface-hover);
    color: var(--osun-text);
}

.osun-btn-ghost .osun-icon {
    width: 18px;
    height: 18px;
}

.osun-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 140px;
    margin-top: 0.25rem;
    padding: 0.5rem 0;
    list-style: none;
    background: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    box-shadow: var(--osun-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity var(--osun-transition-fast), transform var(--osun-transition-fast), visibility var(--osun-transition-fast);
    z-index: var(--osun-z-dropdown);
}

.osun-language-selector:focus-within .osun-dropdown-menu,
.osun-language-selector .osun-btn-ghost[aria-expanded="true"] + .osun-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.osun-dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--osun-text);
    text-decoration: none;
    transition: background-color var(--osun-transition-fast);
}

.osun-dropdown-item:hover {
    background: var(--osun-surface-hover);
}

.osun-dropdown-item.active {
    color: var(--osun-primary);
    font-weight: 500;
}

/* Login Layout Responsive */
@media (max-width: 991.98px) {
    .osun-login-sidebar {
        width: 320px;
    }

    .osun-login-sidebar-content {
        padding: 2rem 1.5rem;
    }

    .osun-login-message-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 767.98px) {
    .osun-login-wrapper {
        flex-direction: column;
    }

    .osun-login-sidebar {
        width: 100%;
        min-height: auto;
        order: 2;
    }

    .osun-login-sidebar-content {
        padding: 2rem 1.5rem;
    }

    .osun-login-main {
        min-height: auto;
        order: 1;
    }

    .osun-login-content {
        padding: 1.5rem;
    }

    .osun-login-logo {
        margin-bottom: 2rem;
    }

    .osun-login-form {
        padding: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .osun-login-form-wrapper {
        max-width: 100%;
    }

    .osun-login-form-check {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* Input group pour les champs avec bouton */
.osun-input-group {
    display: flex;
    position: relative;
}

.osun-input-group-password {
    display: flex;
    align-items: stretch;
    border-radius: var(--osun-radius-md);
}

.osun-input-group-password .osun-login-form-input {
    flex: 1;
    border-right: none;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.osun-input-group-password .osun-password-toggle {
    border: 1px solid var(--osun-border);
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: var(--osun-primary-btn-bg);
    color: var(--osun-text);
    transition: all var(--osun-transition-fast);
    height: inherit;
}

.osun-input-group-password .osun-password-toggle:hover {
    background: var(--osun-surface-hover);
    color: var(--osun-text);
}

/* Bouton large */
.osun-btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Actions du formulaire */
.osun-login-form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--osun-border);
}

/* Classe utilitaire pour largeur 100% */
.w-100 {
    width: 100% !important;
}

/* Bouton secondary adaptatif */
.osun-btn-adaptive-secondary {
    --osun-btn-bg: var(--osun-surface);
    --osun-btn-color: var(--osun-text);
    --osun-btn-border-light: hsl(
        0, 0%,
        calc(var(--osun-primary-l) - var(--osun-border-darken-amount))
    );
    --osun-btn-border-dark: hsl(
        0, 0%,
        calc(var(--osun-primary-l) + var(--osun-border-lighten-amount))
    );
    background-color: var(--osun-btn-bg);
    color: var(--osun-btn-color);
    border-color: var(--osun-btn-border-light);
}

[data-osun-theme="dark"] .osun-btn-adaptive-secondary,
[data-osun-theme="system"]:not([data-osun-resolved="light"]) .osun-btn-adaptive-secondary {
    border-color: var(--osun-btn-border-dark);
}

.osun-btn-adaptive-secondary:hover {
    background: var(--osun-surface-hover);
}

/* Améliorations d'accessibilité pour le formulaire */
.osun-login-form-input:focus {
    outline: 2px solid var(--osun-primary);
    outline-offset: 2px;
}

.osun-password-toggle[aria-label="Show password"] .lucide-eye-off, .osun-password-toggle[aria-label="Hide password"] .lucide-eye {
    display: none;
}

.osun-input-group-password .osun-password-toggle:focus, .osun-input-group-password .osun-login-form-input:focus {
    outline: none;
}

.osun-input-group-password:has(.osun-password-toggle:focus), .osun-input-group-password:has(.osun-login-form-input:focus) {
    outline: 2px solid var(--osun-primary);
    outline-offset: 2px;
}

.osun-login-form-input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: var(--osun-danger);
}

.osun-login-form-input:invalid:not(:focus):not(:placeholder-shown) + .osun-input-group-password .osun-password-toggle {
    border-color: var(--osun-danger);
}

/* Ajustements pour le mode contraste élevé */
[data-osun-high-contrast="true"] .osun-login-form-input {
    border-width: 2px;
}

[data-osun-high-contrast="true"] .osun-input-group-password .osun-password-toggle {
    border-width: 2px;
}

/* Style pour le select de langue */
.osun-login-form .osun-input-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9375rem;
    color: var(--osun-text);
    background: var(--osun-bg);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    transition: border-color var(--osun-transition-fast), box-shadow var(--osun-transition-fast);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px;
    padding-right: 2.5rem;
}

.osun-login-form .osun-input-group select:focus {
    outline: none;
    border-color: var(--osun-primary);
    box-shadow: 0 0 0 3px rgba(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l), 0.15);
}

[data-osun-theme="dark"] .osun-login-form .osun-input-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Style pour les messages d'erreur (optionnel) */
.osun-form-error {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--osun-danger);
}

.osun-login-form-input:invalid:not(:focus):not(:placeholder-shown) ~ .osun-form-error {
    display: block;
}

[icon-name="eye-off"] .icon-eye, [icon-name="eye"] .icon-eye-off {
    display: none;
}

/* ==========================================================================
   14. Loader / Splash Screen
   ========================================================================== */

.osun-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--osun-bg);
    transition: opacity var(--osun-transition-slow), visibility var(--osun-transition-slow);
}

.osun-loader.osun-loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.osun-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
    padding: 2rem;
}

/* Logo dans le loader */
.osun-loader-logo {
    margin-bottom: 0.5rem;
}

.osun-loader-logo img {
    max-width: 150px;
    max-height: 60px;
    width: auto;
    height: auto;
}

.osun-loader-logo-text {
    font-size: 2rem;
    font-weight: 700;
    color: var(--osun-primary);
    letter-spacing: -0.02em;
}

/* Texte du loader */
.osun-loader-text {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--osun-text-muted);
    animation: osun-fade-pulse 2s ease-in-out infinite;
}

@keyframes osun-fade-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ===== Animation: Spinner ===== */
.osun-loader-spinner {
    width: 50px;
    height: 50px;
}

.osun-spinner {
    width: 100%;
    height: 100%;
    animation: osun-spinner-rotate 2s linear infinite;
}

.osun-spinner-path {
    stroke: var(--osun-primary);
    stroke-linecap: round;
    animation: osun-spinner-dash 1.5s ease-in-out infinite;
}

@keyframes osun-spinner-rotate {
    100% { transform: rotate(360deg); }
}

@keyframes osun-spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ===== Animation: Dots ===== */
.osun-loader-dots .osun-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.osun-dots span {
    width: 12px;
    height: 12px;
    background: var(--osun-primary);
    border-radius: 50%;
    animation: osun-dots-bounce 1.4s ease-in-out infinite both;
}

.osun-dots span:nth-child(1) { animation-delay: -0.32s; }
.osun-dots span:nth-child(2) { animation-delay: -0.16s; }
.osun-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes osun-dots-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ===== Animation: Pulse ===== */
.osun-loader-pulse .osun-pulse {
    width: 50px;
    height: 50px;
    background: var(--osun-primary);
    border-radius: 50%;
    animation: osun-pulse-scale 1.5s ease-in-out infinite;
}

@keyframes osun-pulse-scale {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.8);
        opacity: 1;
    }
}

/* ===== Animation: Bars ===== */
.osun-loader-bars .osun-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 40px;
}

.osun-bars span {
    width: 6px;
    height: 100%;
    background: var(--osun-primary);
    border-radius: 3px;
    animation: osun-bars-stretch 1.2s ease-in-out infinite;
}

.osun-bars span:nth-child(1) { animation-delay: -1.1s; }
.osun-bars span:nth-child(2) { animation-delay: -1.0s; }
.osun-bars span:nth-child(3) { animation-delay: -0.9s; }
.osun-bars span:nth-child(4) { animation-delay: -0.8s; }
.osun-bars span:nth-child(5) { animation-delay: -0.7s; }

@keyframes osun-bars-stretch {
    0%, 40%, 100% {
        transform: scaleY(0.4);
    }
    20% {
        transform: scaleY(1);
    }
}

/* Respecter reduced motion */
@media (prefers-reduced-motion: reduce) {
    .osun-loader-text,
    .osun-spinner,
    .osun-spinner-path,
    .osun-dots span,
    .osun-pulse,
    .osun-bars span {
        animation: none;
    }

    .osun-spinner-path {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
}

[data-osun-reduced-motion="true"] .osun-loader-text,
[data-osun-reduced-motion="true"] .osun-spinner,
[data-osun-reduced-motion="true"] .osun-spinner-path,
[data-osun-reduced-motion="true"] .osun-dots span,
[data-osun-reduced-motion="true"] .osun-pulse,
[data-osun-reduced-motion="true"] .osun-bars span {
    animation: none;
}

[data-osun-reduced-motion="true"] .osun-spinner-path {
    stroke-dasharray: 90, 150;
    stroke-dashoffset: -35;
}

.osun-btn.dropdown-toggle::after {
    display: none;
} 

.osun-btn.dropdown-toggle svg:last-child {
    margin-left: 1.5rem;
    margin-right: 0;
}

/* ==========================================================================
   15. Fieldset et Legend
   ========================================================================== */

.osun-form-fieldset {
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md);
    padding: 1rem 1.5rem 1.5rem;
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
}

.osun-form-fieldset legend {
    font-size: 1rem;
    font-weight: 600;
    padding: 0 1rem;
    color: var(--osun-text);
    background: var(--osun-bg);
    margin-left: 0;
    width: fit-content;
    transform: translateY(-135%);
}

/**
 * Profile Page Styles
 * Styles pour la page de profil utilisateur avec personnalisation et accessibilité
 */

/* Layout principal */
.osun-profile-container {
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
}

/* Bandeau de profil type Facebook */
.osun-profile-banner {
    background: var(--osun-bg);
    border-radius: var(--osun-radius-lg, 0.5rem);
    overflow: hidden;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.osun-profile-cover {
    position: relative;
    width: 100%;
    height: 270px;
    overflow: hidden;
}

.osun-profile-cover-image {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        #01AED6 0%,
        #93BD3D 25%,
        #EE7713 50%,
        #FCC62E 75%,
        #E53535 100%
    );
    background-size: cover;
    background-position: center;
    transition: transform var(--osun-transition-normal, 0.3s);
}

.osun-profile-cover:hover .osun-profile-cover-image {
    transform: scale(1.02);
}

.osun-profile-cover-edit {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: white;
    border: none;
    border-radius: var(--osun-radius-md, 0.375rem);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--osun-transition-fast, 0.15s);
}

.osun-profile-cover-edit:hover {
    background: rgba(0, 0, 0, 0.75);
}

.osun-profile-cover-edit i {
    width: 16px;
    height: 16px;
}

.osun-profile-header {
    position: relative;
    padding: 0 2rem 1.5rem 2rem;
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
}

.osun-profile-avatar-wrapper {
    position: relative;
    margin-top: -80px;
}

.osun-profile-avatar {
    width: 168px;
    height: 168px;
    border-radius: 50%;
    border: 6px solid var(--osun-surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform var(--osun-transition-fast, 0.15s);
}

.osun-profile-avatar:hover {
    transform: scale(1.02);
}

.osun-profile-avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.osun-profile-avatar-text {
    font-size: 4rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.osun-profile-avatar-edit {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--osun-surface);
    border: 2px solid var(--osun-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--osun-transition-fast, 0.15s);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.osun-profile-avatar-edit:hover {
    background: var(--osun-surface-hover);
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.osun-profile-avatar-edit i {
    width: 18px;
    height: 18px;
    color: var(--osun-text);
}

.osun-profile-info {
    padding-bottom: 0.5rem;
}

.osun-profile-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--osun-text);
    margin: 0 0 0.25rem 0;
    line-height: 1.2;
}

.osun-profile-username {
    font-size: 1rem;
    color: var(--osun-text-muted);
    margin: 0;
}

/* Adaptation pour les petits écrans */
@media (max-width: 768px) {
    .osun-profile-cover {
        height: 200px;
    }

    .osun-profile-header {
        padding: 0 1rem 1rem 1rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .osun-profile-avatar-wrapper {
        margin-top: -60px;
    }

    .osun-profile-avatar {
        width: 120px;
        height: 120px;
        border-width: 4px;
    }

    .osun-profile-avatar-text {
        font-size: 3rem;
    }

    .osun-profile-avatar-edit {
        width: 36px;
        height: 36px;
        bottom: 4px;
        right: 4px;
    }

    .osun-profile-avatar-edit i {
        width: 16px;
        height: 16px;
    }

    .osun-profile-name {
        font-size: 1.5rem;
    }

    .osun-profile-username {
        font-size: 0.9rem;
    }
}

.osun-profile-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.osun-profile-layout .osun-card {
    margin-bottom: 2.5rem;
}

.osun-profile-layout .osun-card:last-child {
    margin-bottom: 0;
}

/* Sections */
.osun-profile-section {
    display: flex;
    flex-direction: row;
}

.osun-profile-section .osun-card-title {
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(to left, #ee82ee, #4b0082, #0000ff, #008000, #ffff00, #ffa500, #ff0000) 1;
}

.osun-profile-section:last-child {
    margin-bottom: 0;
}

/* Form grid */
.osun-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.osun-form-group-full {
    grid-column: 1 / -1;
}

@media (max-width: 768px) {
    .osun-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Form elements */
.osun-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.osun-form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--osun-text);
    margin-bottom: 0.25rem;
}

.osun-form-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--osun-text);
    background-color: var(--osun-surface);
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md, 0.375rem);
    transition: border-color var(--osun-transition-fast, 0.15s),
                box-shadow var(--osun-transition-fast, 0.15s);
}

.osun-form-input:focus {
    outline: none;
    border-color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    box-shadow: 0 0 0 3px hsla(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l), 0.1);
}

.osun-form-input:disabled {
    background-color: var(--osun-surface-hover);
    cursor: not-allowed;
    opacity: 0.6;
}

.osun-form-help {
    font-size: 0.8125rem;
    color: var(--osun-text-muted);
    margin-top: 0.25rem;
}

.osun-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Customizer sections dans le profil */
.osun-customizer-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--osun-text);
    margin-bottom: 0.75rem;
    margin-top: 0;
}

.osun-customizer-row {
    margin-bottom: 1.5rem;
}

.osun-customizer-row:last-child {
    margin-bottom: 0;
}

/* Theme selector - boutons en ligne */
.osun-theme-selector {
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
}

.osun-theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid var(--osun-border);
    border-radius: var(--osun-radius-md, 0.375rem);
    cursor: pointer;
    transition: all var(--osun-transition-fast, 0.15s);
    background: var(--osun-surface);
}

.osun-theme-option:hover {
    border-color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    background: var(--osun-surface-hover);
}

.osun-theme-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.osun-theme-option:has(input[type="radio"]:checked) {
    border-color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    background: hsla(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l), 0.1);
}

.osun-theme-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--osun-text);
}

.osun-theme-option:has(input[type="radio"]:checked) .osun-theme-icon {
    color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
}

.osun-theme-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--osun-text);
}

.osun-theme-option:has(input[type="radio"]:checked) .osun-theme-label {
    color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    font-weight: 600;
}

@media (max-width: 768px) {
    .osun-theme-selector {
        flex-direction: column;
    }

    .osun-theme-option {
        flex-direction: row;
        justify-content: flex-start;
        min-width: auto;
    }
}

/* Couleurs grid - 3 colonnes */
.osun-colors-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

@media (max-width: 1200px) {
    .osun-colors-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .osun-colors-grid-3 {
        grid-template-columns: 1fr;
    }
}

.osun-color-card {
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md, 0.375rem);
    overflow: hidden;
    background: var(--osun-surface);
    transition: box-shadow var(--osun-transition-fast, 0.15s);
}

.osun-color-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.osun-color-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--osun-background);
    border-bottom: 1px solid var(--osun-border);
}

.osun-color-swatch {
    width: 32px;
    height: 32px;
    border-radius: var(--osun-radius-sm, 0.25rem);
    border: 2px solid var(--osun-border);
    flex-shrink: 0;
    transition: transform var(--osun-transition-fast, 0.15s);
}

.osun-color-card:hover .osun-color-swatch {
    transform: scale(1.1);
}

.osun-color-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--osun-text);
}

.osun-color-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Couleurs grid - ancienne version (gardée pour compatibilité) */
.osun-colors-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.osun-color-details {
    border: 1px solid var(--osun-border);
    border-radius: var(--osun-radius-md, 0.375rem);
    overflow: hidden;
    background: var(--osun-surface);
}

.osun-color-summary {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    list-style: none;
    transition: background-color var(--osun-transition-fast, 0.15s);
}

.osun-color-summary:hover {
    background: var(--osun-surface-hover);
}

.osun-color-summary::-webkit-details-marker {
    display: none;
}

.osun-chevron {
    margin-left: auto;
    transition: transform var(--osun-transition-fast, 0.15s);
    width: 16px;
    height: 16px;
    color: var(--osun-text-muted);
}

.osun-color-details[open] .osun-chevron {
    transform: rotate(180deg);
}

.osun-color-controls {
    padding: 1rem;
    border-top: 1px solid var(--osun-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--osun-background);
}

/* Range group */
.osun-range-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.osun-range-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--osun-text-muted);
    min-width: 12px;
    text-align: center;
}

.osun-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--osun-border);
    outline: none;
}

.osun-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    cursor: pointer;
    border: 2px solid var(--osun-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform var(--osun-transition-fast, 0.15s);
}

.osun-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.osun-range::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    cursor: pointer;
    border: 2px solid var(--osun-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform var(--osun-transition-fast, 0.15s);
}

.osun-range::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.osun-range-hue {
    background: linear-gradient(to right,
        hsl(0, 100%, 50%),
        hsl(60, 100%, 50%),
        hsl(120, 100%, 50%),
        hsl(180, 100%, 50%),
        hsl(240, 100%, 50%),
        hsl(300, 100%, 50%),
        hsl(360, 100%, 50%)
    );
}

.osun-range-sm {
    height: 4px;
}

.osun-range-value-sm {
    font-size: 0.75rem;
    color: var(--osun-text-muted);
    min-width: 40px;
    text-align: right;
}

.osun-range-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.osun-range-value {
    font-size: 0.875rem;
    color: var(--osun-text);
    min-width: 45px;
    text-align: right;
    font-weight: 500;
}

/* Radio group pour taille de police */
.osun-radio-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.osun-radio-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    border: 2px solid var(--osun-border);
    border-radius: var(--osun-radius-md, 0.375rem);
    cursor: pointer;
    transition: all var(--osun-transition-fast, 0.15s);
    background: var(--osun-surface);
}

.osun-radio-label:hover {
    border-color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    background: var(--osun-surface-hover);
}

.osun-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.osun-radio-label input[type="radio"]:checked + span,
.osun-radio-label:has(input[type="radio"]:checked) {
    border-color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    background: hsla(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l), 0.1);
    color: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
    font-weight: 600;
}

/* Toggle switch - reprendre du ThemeToggle */
.osun-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--osun-radius-md, 0.375rem);
    transition: background-color var(--osun-transition-fast, 0.15s);
}

.osun-toggle-wrapper:hover {
    background: var(--osun-surface-hover);
}

.osun-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.osun-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    background: var(--osun-border);
    border-radius: 12px;
    transition: background-color var(--osun-transition-fast, 0.15s);
    flex-shrink: 0;
}

.osun-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: var(--osun-surface);
    border-radius: 50%;
    transition: transform var(--osun-transition-fast, 0.15s);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.osun-toggle-input:checked + .osun-toggle-switch {
    background: hsl(var(--osun-primary-h), var(--osun-primary-s), var(--osun-primary-l));
}

.osun-toggle-input:checked + .osun-toggle-switch::after {
    transform: translateX(20px);
}

.osun-toggle-label {
    font-size: 0.875rem;
    color: var(--osun-text);
    user-select: none;
}

/* Bouton pleine largeur */
.osun-btn-full {
    width: 100%;
    justify-content: center;
}

/* Section data-show-for */
[data-show-for="dark"] {
    display: none;
}

:root[data-theme="dark"] [data-show-for="dark"] {
    display: block;
}

/* Classes d'accessibilité appliquées au :root */

/* Taille de police */
:root.font-small {
    font-size: 14px;
}

:root.font-large {
    font-size: 18px;
}

:root.font-xlarge {
    font-size: 20px;
}

/* Contraste élevé */
:root.high-contrast {
    --osun-border: hsl(var(--osun-text-h, 0), var(--osun-text-s, 0%), calc(var(--osun-text-l, 50%) * 0.5));
}

:root.high-contrast .osun-form-input,
:root.high-contrast .osun-btn {
    border-width: 2px;
}

:root.high-contrast .osun-color-details,
:root.high-contrast .osun-color-card {
    border-width: 2px;
}

/* Réduction des animations */
:root.reduced-motion * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
}

/* Espacement agrandi */
:root.increased-spacing .osun-form-grid {
    gap: 2rem;
}

:root.increased-spacing .osun-profile-layout {
    gap: 2rem;
}

:root.increased-spacing .osun-customizer-row {
    margin-bottom: 2rem;
}

:root.increased-spacing .osun-form-input,
:root.increased-spacing .osun-btn {
    padding: 0.875rem 1.125rem;
}

:root.increased-spacing .osun-radio-label {
    padding: 0.875rem 1.25rem;
}

:root.increased-spacing .osun-color-summary {
    padding: 1rem 1.25rem;
}

:root.increased-spacing .osun-color-controls {
    padding: 1.25rem;
    gap: 1rem;
}

/* Indicateur de force du mot de passe */
.osun-password-strength {
    margin-top: 0.75rem;
}

.osun-password-strength-bar {
    width: 100%;
    height: 8px;
    background: var(--osun-border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.osun-password-strength-fill {
    height: 100%;
    transition: width var(--osun-transition-fast, 0.15s) ease,
                background-color var(--osun-transition-fast, 0.15s) ease;
    border-radius: 4px;
}

.osun-password-weak {
    width: 33.33%;
    background: linear-gradient(90deg,
        hsl(0, 84%, 60%) 0%,
        hsl(0, 84%, 60%) 100%
    );
}

.osun-password-medium {
    width: 66.66%;
    background: linear-gradient(90deg,
        hsl(0, 84%, 60%) 0%,
        hsl(0, 84%, 60%) 33.33%,
        hsl(38, 92%, 50%) 33.33%,
        hsl(38, 92%, 50%) 100%
    );
}

.osun-password-strong {
    width: 100%;
    background: linear-gradient(90deg,
        hsl(0, 84%, 60%) 0%,
        hsl(0, 84%, 60%) 33.33%,
        hsl(38, 92%, 50%) 33.33%,
        hsl(38, 92%, 50%) 66.66%,
        hsl(142, 70%, 45%) 66.66%,
        hsl(142, 70%, 45%) 100%
    );
}

.osun-password-strength-text {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.osun-password-text-weak {
    color: hsl(0, 84%, 60%);
}

.osun-password-text-medium {
    color: hsl(38, 92%, 50%);
}

.osun-password-text-strong {
    color: hsl(142, 70%, 45%);
}

/* Messages d'aide pour les mots de passe */
.osun-password-match {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.osun-text-success {
    color: hsl(var(--osun-success-h, 142), var(--osun-success-s, 70%), var(--osun-success-l, 45%));
}

.osun-text-danger {
    color: hsl(var(--osun-danger-h, 0), var(--osun-danger-s, 84%), var(--osun-danger-l, 60%));
}

/* États de validation des inputs */
.osun-input-success {
    border-color: hsl(var(--osun-success-h, 142), var(--osun-success-s, 70%), var(--osun-success-l, 45%)) !important;
    box-shadow: 0 0 0 3px hsla(var(--osun-success-h, 142), var(--osun-success-s, 70%), var(--osun-success-l, 45%), 0.1) !important;
}

.osun-input-error {
    border-color: hsl(var(--osun-danger-h, 0), var(--osun-danger-s, 84%), var(--osun-danger-l, 60%)) !important;
    box-shadow: 0 0 0 3px hsla(var(--osun-danger-h, 0), var(--osun-danger-s, 84%), var(--osun-danger-l, 60%), 0.1) !important;
}

/* ==========================================================================
   Bootstrap Form Controls — Theme overrides
   Bootstrap 5.3 hard-codes the focus border/shadow, so we must override here.
   ========================================================================== */

[data-osun-theme="light"] .form-control:focus,
[data-osun-theme="light"] .form-select:focus,
[data-osun-theme="system"][data-osun-resolved="light"] .form-control:focus,
[data-osun-theme="system"][data-osun-resolved="light"] .form-select:focus {
    border-color: hsl(28, 78%, 55%);
    box-shadow: 0 0 0 0.25rem rgba(200, 117, 24, 0.25);
}

[data-osun-theme="dark"] .form-control:focus,
[data-osun-theme="dark"] .form-select:focus,
[data-osun-theme="system"][data-osun-resolved="dark"] .form-control:focus,
[data-osun-theme="system"][data-osun-resolved="dark"] .form-select:focus {
    border-color: hsl(211, 62%, 60%);
    box-shadow: 0 0 0 0.25rem rgba(74, 143, 208, 0.25);
}

[data-osun-theme="dark"] .form-select,
[data-osun-theme="system"][data-osun-resolved="dark"] .form-select {
    --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c2d4e8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

/* Mode préfers-reduced-motion du navigateur */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Contraste élevé du système */
@media (prefers-contrast: high) {
    :root {
        --osun-border: hsl(var(--osun-text-h, 0), var(--osun-text-s, 0%), calc(var(--osun-text-l, 50%) * 0.5));
    }

    .osun-form-input,
    .osun-btn,
    .osun-color-details,
    .osun-color-card {
        border-width: 2px;
    }
}

/* ==========================================================================
   Toasts (messages flash)
   Pop-up empilables ancrés en haut à droite. Chaque toast entre en
   glissant depuis la droite (hors écran), pousse les précédents vers le
   bas pour se faire une place, puis en sortant rebondit légèrement avant
   de glisser vers le haut de l'écran.
   ========================================================================== */

.osun-toast-container {
    position: fixed;
    top: calc(var(--osun-header-height) + 16px);
    right: 20px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 380px;
    max-width: calc(100vw - 40px);
    pointer-events: none;
}

.osun-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--osun-radius-md);
    background: var(--osun-surface);
    color: var(--osun-text);
    border: 1px solid var(--osun-border);
    border-left: 4px solid var(--osun-primary);
    box-shadow: var(--osun-shadow-lg);
    transform: translateX(450px);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

/* État affiché : glissée en place */
.osun-toast.osun-toast-show {
    transform: translateX(0);
    opacity: 1;
}

/* Fermeture : léger rebond puis sortie vers le haut de l'écran */
.osun-toast.osun-toast-leaving {
    animation: osun-toast-leave 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) forwards;
}

@keyframes osun-toast-leave {
    0% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
    30% {
        transform: translateX(0) translateY(6px);
        opacity: 1;
    }
    100% {
        transform: translateX(0) translateY(-160%);
        opacity: 0;
    }
}

.osun-toast-icon {
    flex-shrink: 0;
    margin-top: 1px;
    font-size: 1.1rem;
    line-height: 1.4;
}

.osun-toast-body {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.osun-toast-close {
    flex-shrink: 0;
    padding: 2px;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.5;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.osun-toast-close:hover {
    opacity: 1;
}

.osun-toast-success { border-left-color: var(--osun-success); }
.osun-toast-success .osun-toast-icon { color: var(--osun-success); }

.osun-toast-error { border-left-color: var(--osun-danger); }
.osun-toast-error .osun-toast-icon { color: var(--osun-danger); }

.osun-toast-warning { border-left-color: var(--osun-warning); }
.osun-toast-warning .osun-toast-icon { color: var(--osun-warning); }

.osun-toast-info { border-left-color: var(--osun-primary); }
.osun-toast-info .osun-toast-icon { color: var(--osun-primary); }

@media (max-width: 480px) {
    .osun-toast-container {
        right: 10px;
        left: 10px;
        width: auto;
    }

    .osun-toast {
        transform: translateY(-450px);
    }

    .osun-toast.osun-toast-show {
        transform: translateY(0);
    }
}
