/* ===================================================================
   XEUS Connect — UX Polish Layer (v1)
   Senior Product Designer continuous improvements
   - Micro-interactions, skeletons, toasts, tooltips, share, breadcrumbs,
     scroll progress, confirm modal, ripple, focus glow, a11y modes,
     branded 404 styles, retry banners.
   Loaded after styles.css/theme/mobile-fixes — overrides nothing structural.
   =================================================================== */

/* ---------- Tokens ---------- */
:root {
    --ux-success: #22c55e;
    --ux-error:   #ef4444;
    --ux-warn:    #f59e0b;
    --ux-info:    #3b82f6;
    --ux-radius:  14px;
    --ux-shadow:  0 12px 40px rgba(0,0,0,.35);
    --ux-ease:    cubic-bezier(.16,1,.3,1);
}

/* ---------- 1. Cart badge bounce on add ---------- */
@keyframes cartPulse {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.55); }
    55%  { transform: scale(.85); }
    80%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.cart-count.bump {
    animation: cartPulse .55s var(--ux-ease);
    box-shadow: 0 0 0 6px rgba(184,149,63,.25);
}

/* Wishlist heart fill burst */
@keyframes heartBurst {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.45); }
    65%  { transform: scale(.85); }
    100% { transform: scale(1); }
}
.product-wishlist.active svg { fill: #ef4444 !important; stroke: #ef4444; }
.product-wishlist.bursting   { animation: heartBurst .55s var(--ux-ease); }

/* ---------- 2. Button ripple ---------- */
.btn, .cart-checkout-btn, button[data-ripple] { position: relative; overflow: hidden; }
.ux-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    background: rgba(255,255,255,.45);
    pointer-events: none;
    animation: rippleExpand .6s linear;
}
@keyframes rippleExpand {
    to { transform: scale(4); opacity: 0; }
}

/* ---------- 3. Input focus glow ---------- */
input:not([type=checkbox]):not([type=radio]):focus,
textarea:focus,
select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(184,149,63,.28), 0 0 24px rgba(184,149,63,.18);
    border-color: var(--accent-start, #B8953F) !important;
    transition: box-shadow .25s var(--ux-ease), border-color .25s var(--ux-ease);
}

/* ---------- 4. Skeleton loader (shimmer) ---------- */
.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.10) 50%, rgba(255,255,255,.04) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 18px;
    padding: 16px;
    background: rgba(255,255,255,.02);
}
.skeleton-card .skeleton-img    { height: 180px; border-radius: 12px; margin-bottom: 14px; }
.skeleton-card .skeleton-line   { height: 12px; border-radius: 6px; margin-bottom: 10px; }
.skeleton-card .skeleton-line.w-40 { width: 40%; }
.skeleton-card .skeleton-line.w-70 { width: 70%; }
.skeleton-card .skeleton-line.w-90 { width: 90%; }

/* ---------- 5. Toast notifications (4 variants) ---------- */
.ux-toast-stack {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom, 0px));
    left: 50%;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    z-index: 9999;
    pointer-events: none;
    width: min(92vw, 420px);
}
.ux-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--ux-radius);
    font-family: 'Inter', sans-serif;
    font-size: .9rem;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--ux-shadow);
    transform: translateY(20px);
    opacity: 0;
    animation: toastIn .35s var(--ux-ease) forwards;
    backdrop-filter: blur(12px);
}
.ux-toast.leaving { animation: toastOut .3s var(--ux-ease) forwards; }
.ux-toast .ux-toast-icon { flex-shrink: 0; width: 22px; height: 22px; }
.ux-toast .ux-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: .7;
    cursor: pointer;
    padding: 4px;
}
.ux-toast .ux-toast-close:hover { opacity: 1; }
.ux-toast--success { background: linear-gradient(135deg, #16a34a, #22c55e); }
.ux-toast--error   { background: linear-gradient(135deg, #dc2626, #ef4444); }
.ux-toast--warn    { background: linear-gradient(135deg, #d97706, #f59e0b); color: #1a1a1a; }
.ux-toast--info    { background: linear-gradient(135deg, #2563eb, #3b82f6); }
@keyframes toastIn  { to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

/* ---------- 6. Tooltips on icon-only buttons ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(20,20,20,.96);
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: .72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 1500;
    border: 1px solid rgba(184,149,63,.3);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---------- 7. Reading / scroll progress bar ---------- */
.ux-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-start, #B8953F), var(--accent-end, #DBB867));
    z-index: 9998;
    transition: width .1s linear;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(184,149,63,.6);
}

/* ---------- 8. Confirm modal ---------- */
.ux-confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(6px);
    z-index: 9990;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    animation: fadeIn .25s forwards;
}
@keyframes fadeIn { to { opacity: 1; } }
.ux-confirm-modal {
    background: linear-gradient(180deg, #1a1a1a, #0e0e0e);
    border: 1px solid rgba(184,149,63,.25);
    border-radius: 18px;
    padding: 28px;
    max-width: 420px;
    width: calc(100% - 32px);
    box-shadow: var(--ux-shadow);
    transform: scale(.92);
    animation: popIn .3s var(--ux-ease) forwards;
    color: #fff;
    font-family: 'Inter', sans-serif;
}
@keyframes popIn { to { transform: scale(1); } }
.ux-confirm-modal h3 { margin: 0 0 8px; font-size: 1.15rem; }
.ux-confirm-modal p  { margin: 0 0 22px; color: #b9b9b9; font-size: .92rem; line-height: 1.5; }
.ux-confirm-actions  { display: flex; gap: 10px; justify-content: flex-end; }
.ux-confirm-actions button {
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: .88rem;
    cursor: pointer;
    border: none;
    transition: transform .15s, opacity .15s;
}
.ux-confirm-actions button:hover { transform: translateY(-1px); }
.ux-confirm-cancel { background: rgba(255,255,255,.08); color: #fff; }
.ux-confirm-ok     { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
.ux-confirm-ok.safe { background: linear-gradient(135deg, var(--accent-start, #B8953F), var(--accent-end, #DBB867)); color: #000; }

/* ---------- 9. Branded empty state ---------- */
.ux-empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #b9b9b9;
    font-family: 'Inter', sans-serif;
}
.ux-empty-state svg {
    width: 96px; height: 96px;
    margin-bottom: 18px;
    opacity: .4;
    color: var(--accent-start, #B8953F);
}
.ux-empty-state h3 { color: #fff; font-size: 1.2rem; margin: 0 0 8px; }
.ux-empty-state p  { font-size: .92rem; margin: 0 0 20px; }
.ux-empty-state .btn { display: inline-flex; }

/* ---------- 10. Offline / retry banner ---------- */
.ux-net-banner {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: linear-gradient(90deg, #d97706, #f59e0b);
    color: #1a1a1a;
    padding: 10px 16px;
    text-align: center;
    font-weight: 600;
    font-size: .88rem;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform .35s var(--ux-ease);
    font-family: 'Inter', sans-serif;
}
.ux-net-banner.visible { transform: translateY(0); }
.ux-net-banner button {
    margin-left: 12px;
    background: rgba(0,0,0,.2);
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------- 11. Branded 404 styles ---------- */
.ux-404-page {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
    color: #fff;
    font-family: 'Inter', sans-serif;
}
.ux-404-page .ux-404-code {
    font-size: clamp(6rem, 18vw, 12rem);
    font-weight: 900;
    background: linear-gradient(135deg, var(--accent-start, #B8953F), var(--accent-end, #DBB867));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin: 0;
}

/* ---------- 12. Accessibility: high-contrast & larger-text modes ---------- */
body.ux-high-contrast {
    --accent-start: #FFD700;
    --accent-end:   #FFEA70;
}
body.ux-high-contrast,
body.ux-high-contrast * {
    color: #fff !important;
}
body.ux-high-contrast a,
body.ux-high-contrast .btn,
body.ux-high-contrast button {
    text-decoration: underline;
    outline: 1px solid #fff;
}
body.ux-larger-text { font-size: 18px; }
body.ux-larger-text .product-name,
body.ux-larger-text h1,
body.ux-larger-text h2,
body.ux-larger-text h3 { font-size: 1.2em; }

/* ---------- 13. A11y toolbar — DISABLED per request (kept for safety override) ---------- */
.ux-a11y-toolbar { display: none !important; }

/* ---------- 14. Reduce motion respect ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- 15. Submit button spinner state ---------- */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 18px; height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 16. Share menu for products ---------- */
.ux-share-menu {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid rgba(184,149,63,.3);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    gap: 6px;
    box-shadow: var(--ux-shadow);
    z-index: 1200;
    animation: popIn .2s var(--ux-ease);
    transform-origin: top right;
}
.ux-share-menu button {
    background: rgba(255,255,255,.06);
    border: none;
    color: #fff;
    width: 38px; height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform .15s, background .15s;
}
.ux-share-menu button:hover { transform: scale(1.1); background: rgba(184,149,63,.2); }

/* ---------- Skeleton loaders (luxe shimmer) ---------- */
.xvs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    padding: 8px 0;
}
.xvs-card {
    background: rgba(28,28,28,.55);
    border: 1px solid rgba(184,149,63,.12);
    border-radius: 16px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 340px;
    overflow: hidden;
    position: relative;
}
.xvs-media {
    aspect-ratio: 4/3;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}
.xvs-line {
    height: 12px;
    border-radius: 6px;
    background: rgba(255,255,255,.05);
}
.xvs-line--w80 { width: 80%; }
.xvs-line--w60 { width: 60%; }
.xvs-line--w40 { width: 40%; height: 16px; }
.xvs-row { display: flex; gap: 8px; }
.xvs-pill {
    height: 22px; width: 58px;
    border-radius: 11px;
    background: rgba(255,255,255,.05);
}
.xvs-shimmer {
    position: relative;
    overflow: hidden;
}
.xvs-shimmer::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 0%,
        transparent 30%,
        rgba(184,149,63,.10) 45%,
        rgba(212,175,90,.18) 50%,
        rgba(184,149,63,.10) 55%,
        transparent 70%,
        transparent 100%
    );
    background-size: 220% 100%;
    animation: xvsShimmer 1.6s linear infinite;
    pointer-events: none;
}
@keyframes xvsShimmer {
    0%   { background-position: 120% 0; }
    100% { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .xvs-shimmer::after { animation: none; opacity: .5; }
}

/* ---------- XEUS luxe breadcrumbs ---------- */
.xeus-breadcrumbs {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 24px 0;
    font-size: .82rem;
    color: rgba(255,255,255,.55);
}
.xeus-breadcrumbs ol {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.xeus-breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.xeus-breadcrumbs li + li::before {
    content: "";
    width: 4px;
    height: 4px;
    background: rgba(184,149,63,.45);
    border-radius: 50%;
    margin: 0 6px;
    display: inline-block;
    flex-shrink: 0;
}
.xeus-breadcrumbs a {
    color: rgba(212,175,90,.75);
    text-decoration: none;
    transition: color .2s ease;
    min-height: 24px;
    display: inline-flex;
    align-items: center;
    padding: 2px 0;
    letter-spacing: .2px;
}
.xeus-breadcrumbs a:hover,
.xeus-breadcrumbs a:focus-visible {
    color: #E6C478;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.xeus-breadcrumbs a:focus-visible {
    outline: 2px solid rgba(212,175,90,.5);
    outline-offset: 3px;
    border-radius: 3px;
}
.xeus-breadcrumbs [aria-current="page"] {
    color: #fff;
    font-weight: 500;
}
.xeus-breadcrumbs svg {
    width: 14px;
    height: 14px;
    opacity: .7;
    flex-shrink: 0;
}
@media (max-width: 600px) {
    .xeus-breadcrumbs { padding: 12px 16px 0; font-size: .78rem; }
}

/* ---------- Icon-only buttons — WCAG 2.5.5 (min 44×44) ---------- */
.btn-icon,
button.btn-icon,
a.btn-icon {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    box-sizing: border-box;
}
/* Compact dashboard icon buttons in table cells — reduce visual weight but keep tap target */
.table .btn-icon,
td .btn-icon,
.actions .btn-icon {
    min-width: 36px;
    min-height: 36px;
    padding: 6px;
}
@media (max-width: 768px) {
    .table .btn-icon,
    td .btn-icon,
    .actions .btn-icon {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }
}

/* ---------- Body scroll lock when modal open (inert alternative) ---------- */
body.xeus-modal-open {
    overflow: hidden;
    overscroll-behavior: contain;
}

/* ---------- Spinner luxe pour boutons submit backend ---------- */
.xeus-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 6px;
    border: 2px solid rgba(184, 149, 63, 0.3);
    border-top-color: #B8953F;
    border-radius: 50%;
    animation: xeus-spin 720ms linear infinite;
}
@keyframes xeus-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .xeus-spinner { animation-duration: 1800ms; }
}
button[aria-busy="true"] {
    cursor: progress !important;
    opacity: .8;
}
