.page-loader {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .94);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

html.is-page-loading .page-loader {
    opacity: 1;
    visibility: visible;
}

.page-loader__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .85rem;
    color: #111827;
    font-weight: 700;
}

.page-loader__spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #ffedd5;
    border-top-color: #f97316;
    border-right-color: #111827;
    border-radius: 50%;
    animation: page-loader-spin .75s linear infinite;
}

.page-loader__brand { color: #f97316; }
.select2-container { max-width: 100%; }

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
    border-color: #d1d5db;
    border-radius: .65rem;
    min-height: 42px;
}

.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 .2rem rgba(249, 115, 22, .14);
    outline: 0;
}

:root {
    --brand-orange: #f97316;
    --brand-orange-dark: #ea580c;
    --brand-orange-light: #fff7ed;
    --bs-warning: #f97316;
    --bs-warning-rgb: 249, 115, 22;
}

html {
    font-size: clamp(.9375rem, .9rem + .15vw, 1rem);
}

body,
#pageContent,
.main-content,
.container,
.container-fluid,
.row > * {
    min-width: 0;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.select2-container,
.choices,
.choices__inner {
    max-width: 100%;
}

.select2-container {
    width: 100% !important;
}

.payment-point-submit {
    min-height: 2.75rem;
    padding-inline: 1rem;
    white-space: nowrap;
}

.responsive-media {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.btn-warning {
    --bs-btn-color: #fff;
    --bs-btn-bg: #f97316;
    --bs-btn-border-color: #f97316;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #ea580c;
    --bs-btn-hover-border-color: #ea580c;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #c2410c;
    --bs-btn-active-border-color: #c2410c;
}

.btn-orange {
    background-color: #f97316 !important;
    border-color: #f97316 !important;
    color: #fff !important;
}
.btn-orange:hover,
.btn-orange:focus-visible {
    background-color: #ea580c !important;
    border-color: #ea580c !important;
    color: #fff !important;
}
.btn-outline-orange {
    background-color: transparent !important;
    border-color: #f97316 !important;
    color: #f97316 !important;
}
.btn-outline-orange:hover,
.btn-outline-orange:focus-visible {
    background-color: #f97316 !important;
    border-color: #f97316 !important;
    color: #fff !important;
}

.text-warning { color: #f97316 !important; }
.bg-warning { background-color: #f97316 !important; }
.border-warning { border-color: #f97316 !important; }
.alert-warning {
    --bs-alert-color: #9a3412;
    --bs-alert-bg: #fff7ed;
    --bs-alert-border-color: #fed7aa;
}

#pageContent.is-live-loading {
    opacity: .58;
    pointer-events: none;
    transition: opacity .16s ease;
}

.product-search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 1080;
    max-height: 420px;
    overflow-y: auto;
    padding: .5rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 18px 45px rgba(17, 24, 39, .18);
}

.product-search-heading {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .55rem .7rem .7rem;
    color: #111827;
    font-size: .82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.product-search-heading small { color: #6b7280; font-weight: 600; text-transform: none; }

.product-search-result {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem;
    border-radius: .75rem;
    color: #111827;
    text-decoration: none;
}
.product-search-result:hover,
.product-search-result:focus-visible { background: #fff7ed; color: #111827; }
.product-search-result img,
.product-search-avatar {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    border-radius: .7rem;
    object-fit: cover;
}
.product-search-avatar {
    display: grid;
    place-items: center;
    background: #111827;
    color: #fff;
    font-weight: 800;
}
.product-search-result span:last-child { min-width: 0; }
.product-search-result strong,
.product-search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-search-result small { color: #6b7280; }
.product-search-empty { padding: 1rem; color: #6b7280; text-align: center; }
.product-search-empty i { color: #f97316; font-size: 1.5rem; }
.product-search-loading { padding: 1rem; color: #6b7280; text-align: center; }
.product-search-all {
    display: block;
    margin-top: .35rem;
    padding: .75rem;
    border-radius: .75rem;
    background: #111827;
    color: #fff;
    font-size: .86rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
}
.product-search-all:hover { background: #f97316; color: #fff; }

.product-card-image-link {
    position: absolute;
    inset: 0;
    display: block;
    color: inherit;
    overflow: hidden;
}
.product-card-gallery-image { transition: opacity .12s ease, transform .3s ease !important; }
.product-card-gallery-image.is-changing { opacity: .2; }
.product-card-image-hint {
    position: absolute;
    left: 50%;
    bottom: 12px;
    z-index: 2;
    padding: .42rem .72rem;
    border-radius: 999px;
    background: rgba(17, 24, 39, .88);
    color: #fff;
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity .2s ease, transform .2s ease;
}
.product-card-image-link:hover .product-card-image-hint,
.product-card-image-link:focus-visible .product-card-image-hint { opacity: 1; transform: translate(-50%, 0); }

.confirmation-modal-icon {
    display: inline-grid;
    width: 64px;
    height: 64px;
    place-items: center;
    border-radius: 50%;
    background: #fff7ed;
    color: #f97316;
    font-size: 1.8rem;
}
.confirmation-modal-icon.is-success { background: #ecfdf5; color: #198754; }
.confirmation-modal-icon.is-danger { background: #fef2f2; color: #dc3545; }

@keyframes page-loader-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .page-loader { transition: none; }
    .page-loader__spinner { animation-duration: 1.5s; }
}

@media (pointer: coarse) {
    .btn,
    .form-control,
    .form-select,
    .select2-selection,
    .page-link,
    .dropdown-item {
        min-height: 2.75rem;
    }
}

@media (max-width: 61.99875rem) {
    .card-header.d-flex,
    .card-body > .d-flex,
    .page-heading.d-flex {
        flex-wrap: wrap;
        gap: .75rem;
    }

    .dropdown-menu {
        max-width: calc(100vw - 1.5rem);
    }
}

@media (max-width: 47.99875rem) {
    h1,
    .h1 { font-size: clamp(1.65rem, 7vw, 2.15rem); }
    h2,
    .h2 { font-size: clamp(1.4rem, 6vw, 1.85rem); }

    .modal-dialog {
        margin: .75rem;
    }

    .modal-content {
        border-radius: 1rem;
    }

    .table-responsive {
        border-radius: .75rem;
    }

    .table-responsive > .table {
        margin-bottom: 0;
    }

    .pagination {
        flex-wrap: wrap;
        gap: .25rem;
    }
}

@media (max-width: 35.99875rem) {
    .payment-card .card-body {
        padding: 1rem !important;
    }

    .payment-point-submit,
    .payment-point-form .btn {
        width: 100%;
    }

    .product-search-suggestions {
        position: fixed;
        top: auto;
        right: .75rem;
        bottom: .75rem;
        left: .75rem;
        max-height: min(70vh, 32rem);
    }

    .btn-group.responsive-actions {
        width: 100%;
        display: grid;
        gap: .5rem;
    }

    .btn-group.responsive-actions > .btn {
        width: 100%;
        border-radius: .65rem !important;
    }
}
.brand-logo-shell {
    position: relative;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .28rem .42rem;
    border-radius: 1rem;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(255, 247, 237, .94));
    border: 1px solid rgba(249, 115, 22, .38);
    box-shadow: 0 .28rem .9rem rgba(17, 24, 39, .12), 0 0 0 .16rem rgba(249, 115, 22, .08);
}

.brand-logo-shell::before,
.brand-logo-shell::after {
    content: '';
    position: absolute;
    border-radius: inherit;
    pointer-events: none;
}

.brand-logo-shell::before {
    inset: 0;
    z-index: 2;
    width: 38%;
    transform: translateX(-180%) skewX(-18deg);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .82), transparent);
    animation: brand-logo-shine 5.2s ease-in-out infinite;
}

.brand-logo-shell::after {
    inset: auto 16% -.18rem;
    z-index: 0;
    height: .18rem;
    background: linear-gradient(90deg, #111827, #f97316, #111827);
    opacity: .82;
}

.brand-logo-shell--compact {
    padding: .2rem .34rem;
    border-radius: .8rem;
}

.brand-logo-animated {
    position: relative;
    z-index: 1;
    transform-origin: center;
    animation: brand-logo-breathe 3.6s ease-in-out infinite;
}

.brand-logo-shell:hover {
    border-color: rgba(249, 115, 22, .72);
    box-shadow: 0 .38rem 1.1rem rgba(17, 24, 39, .15), 0 0 0 .2rem rgba(249, 115, 22, .12);
}

@keyframes brand-logo-shine {
    0%, 68% { transform: translateX(-180%) skewX(-18deg); opacity: 0; }
    76% { opacity: .9; }
    92%, 100% { transform: translateX(430%) skewX(-18deg); opacity: 0; }
}

@keyframes brand-logo-breathe {
    0%, 100% { transform: scale(1); filter: saturate(1) drop-shadow(0 0 0 rgba(249, 115, 22, 0)); }
    50% { transform: scale(1.018); filter: saturate(1.1) drop-shadow(0 .16rem .3rem rgba(249, 115, 22, .2)); }
}

@media (prefers-reduced-motion: reduce) {
    .brand-logo-shell::before,
    .brand-logo-animated {
        animation: none;
    }
}

/* Thème clair/sombre partagé entre la boutique et la gestion interne. */
.theme-toggle-button {
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #111827;
    transition: color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.theme-toggle-button:hover,
.theme-toggle-button:focus-visible {
    color: #f97316 !important;
    background: rgba(249, 115, 22, .12) !important;
    box-shadow: 0 0 0 .2rem rgba(249, 115, 22, .14);
    transform: translateY(-1px);
}

.theme-toggle-button i {
    font-size: 1.1rem;
    line-height: 1;
}

.client-profile-avatar {
    width: 4.5rem !important;
    min-width: 4.5rem;
    max-width: 4.5rem !important;
    height: 4.5rem !important;
    min-height: 4.5rem;
    max-height: 4.5rem !important;
    display: block;
    flex: 0 0 4.5rem;
    overflow: hidden;
    object-fit: cover;
    object-position: center;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
}

.client-profile-avatar--edit {
    width: 5.125rem !important;
    min-width: 5.125rem;
    max-width: 5.125rem !important;
    height: 5.125rem !important;
    min-height: 5.125rem;
    max-height: 5.125rem !important;
    flex-basis: 5.125rem;
}

.client-profile-avatar--nav {
    width: 1.75rem !important;
    min-width: 1.75rem;
    max-width: 1.75rem !important;
    height: 1.75rem !important;
    min-height: 1.75rem;
    max-height: 1.75rem !important;
    flex-basis: 1.75rem;
}

.client-profile-avatar--fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

[data-bs-theme="dark"] {
    --bs-body-color: #e5e7eb;
    --bs-body-color-rgb: 229, 231, 235;
    --bs-body-bg: #0b1120;
    --bs-body-bg-rgb: 11, 17, 32;
    --bs-secondary-color: #aab3c2;
    --bs-secondary-bg: #172033;
    --bs-tertiary-bg: #111827;
    --bs-border-color: #303b4f;
    --bs-emphasis-color: #ffffff;
    --bs-link-color: #fb923c;
    --bs-link-hover-color: #fdba74;
}

[data-bs-theme="dark"] .theme-toggle-button {
    color: #111827 !important;
    background: #fbbf24 !important;
    border: 1px solid #fde68a;
    box-shadow: 0 .3rem .9rem rgba(251, 191, 36, .28);
}

[data-bs-theme="dark"] .theme-toggle-button:hover,
[data-bs-theme="dark"] .theme-toggle-button:focus-visible {
    color: #000 !important;
    background: #fdba74 !important;
    border-color: #fed7aa;
}

[data-bs-theme="dark"] body,
[data-bs-theme="dark"] .main-content {
    color: #e5e7eb;
    background: #0b1120 !important;
}

[data-bs-theme="dark"] .header,
[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] .mobile-nav,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .modal-content,
[data-bs-theme="dark"] .dropdown-menu,
[data-bs-theme="dark"] .list-group-item,
[data-bs-theme="dark"] .offcanvas,
[data-bs-theme="dark"] .login-card,
[data-bs-theme="dark"] .reset-card,
[data-bs-theme="dark"] .settings-section,
[data-bs-theme="dark"] .product-card,
[data-bs-theme="dark"] .category-showcase-card,
[data-bs-theme="dark"] .category-item {
    color: #e5e7eb;
    background-color: #111827 !important;
    border-color: #303b4f !important;
}

[data-bs-theme="dark"] .topbar,
[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] .header {
    box-shadow: 0 .2rem 1rem rgba(0, 0, 0, .32);
}

[data-bs-theme="dark"] .sidebar {
    border-right-color: #303b4f;
}

[data-bs-theme="dark"] .card-header,
[data-bs-theme="dark"] .card-footer,
[data-bs-theme="dark"] .dropdown-item,
[data-bs-theme="dark"] .table,
[data-bs-theme="dark"] table,
[data-bs-theme="dark"] thead,
[data-bs-theme="dark"] tbody,
[data-bs-theme="dark"] tr,
[data-bs-theme="dark"] td,
[data-bs-theme="dark"] th {
    color: #e5e7eb;
    border-color: #303b4f;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus,
[data-bs-theme="dark"] .nav-link-orange:hover,
[data-bs-theme="dark"] .nav-link-orange.active,
[data-bs-theme="dark"] .submenu-link:hover,
[data-bs-theme="dark"] .submenu-link.active {
    color: #fb923c !important;
    background-color: rgba(249, 115, 22, .14) !important;
}

[data-bs-theme="dark"] .nav-link-orange,
[data-bs-theme="dark"] .submenu-link,
[data-bs-theme="dark"] .text-secondary,
[data-bs-theme="dark"] .text-muted {
    color: #aab3c2 !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #f3f4f6 !important;
}

[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] .dropdown-item,
[data-bs-theme="dark"] .card-header.bg-white {
    color: #e5e7eb !important;
    background-color: #111827 !important;
}

[data-bs-theme="dark"] .bg-light,
[data-bs-theme="dark"] .alert-light {
    color: #dbe3ef !important;
    background-color: #172033 !important;
    border-color: #303b4f !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .form-check-input,
[data-bs-theme="dark"] .input-group-text,
[data-bs-theme="dark"] .search-bar input,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown,
[data-bs-theme="dark"] .select2-search__field {
    color: #f3f4f6 !important;
    background-color: #0f172a !important;
    border-color: #3b475d !important;
}

[data-bs-theme="dark"] .form-control::placeholder,
[data-bs-theme="dark"] .search-bar input::placeholder {
    color: #7f8a9d;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__rendered,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__placeholder {
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-results__option {
    color: #e5e7eb;
    background: #111827;
}

[data-bs-theme="dark"] .product-card .product-name,
[data-bs-theme="dark"] .product-card .product-price,
[data-bs-theme="dark"] .header-actions .action-item,
[data-bs-theme="dark"] .logo-text,
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #f8fafc;
}

[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button),
[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button) > i {
    color: #f8fafc !important;
}

[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button):hover,
[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button):focus-visible,
[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button):hover > i,
[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button):focus-visible > i {
    color: #fb923c !important;
}

[data-bs-theme="dark"] .header-actions .action-item:not(.theme-toggle-button):focus-visible {
    outline: 2px solid #fb923c;
    outline-offset: 4px;
    border-radius: .65rem;
}

@media (max-width: 47.99875rem) {
    .footer .social-icons {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
        max-width: 22rem;
        gap: .65rem;
    }

    .footer .social-icons a {
        display: inline-flex !important;
        width: 100%;
        min-width: 0;
        margin: 0;
        padding-inline: .8rem;
        justify-content: flex-start;
        overflow: visible;
    }

    .footer .social-icons a i,
    .footer .social-icons a span {
        display: inline-block !important;
        color: #fff !important;
        visibility: visible;
    }
}

@media (max-width: 22.5rem) {
    .footer .social-icons {
        grid-template-columns: minmax(0, 1fr);
    }
}

[data-bs-theme="dark"] .btn-outline-dark {
    color: #f8fafc;
    border-color: #94a3b8;
}

[data-bs-theme="dark"] .btn-outline-dark:hover {
    color: #111827;
    background: #f8fafc;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-end,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start {
    border-color: #303b4f !important;
}

[data-bs-theme="dark"] .brand-logo-shell {
    background: linear-gradient(145deg, rgba(255, 255, 255, .98), rgba(255, 247, 237, .94));
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle-button {
        transition: none;
    }
}
