/**
 * GilGamez Accounts Platform — UX & Motion Engine Styles
 * Path: engine/Ux/css/ux.css
 * Provides hardware-accelerated motion tokens, easing curves, and FLIP container classes.
 */

:root {
    --ux-ease-spring: cubic-bezier(0.2, 0, 0, 1);
    --ux-ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --ux-ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
    --ux-ease-decelerate: cubic-bezier(0, 0, 0.2, 1);
    --ux-dur-fast: 160ms;
    --ux-dur-normal: 280ms;
    --ux-dur-slow: 420ms;
}

/* ─── FLIP Morph Overlay & Container ─── */
.ux-morph-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 15, 26, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    pointer-events: auto;
    opacity: 1 !important;
    transition: background-color var(--ux-dur-normal) var(--ux-ease-spring),
                backdrop-filter var(--ux-dur-normal) var(--ux-ease-spring),
                -webkit-backdrop-filter var(--ux-dur-normal) var(--ux-ease-spring);
    animation: none !important;
}

.ux-morph-overlay.open {
    background: rgba(10, 15, 26, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.ux-morph-card {
    position: relative;
    background: #0d121c;
    border: 1px solid rgba(197, 160, 89, 0.28);
    border-radius: 16px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05);
    width: 100%;
    max-height: min(92dvh, 620px);
    display: flex;
    flex-direction: column;
    padding: 20px 20px 18px;
    box-sizing: border-box;
    color: #f8fafc;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, border-radius, box-shadow;
    opacity: 1 !important;
    animation: none !important;
}

@media (max-width: 480px) {
    .ux-morph-card {
        padding: 16px 14px 14px;
        border-radius: 14px;
        max-height: min(94dvh, 620px);
    }
}

/* Neutralize any static CSS popup animations from modal.css */
.ux-morph-overlay.ggz-modal-overlay,
.ux-morph-card.ggz-modal-card {
    animation: none !important;
    opacity: 1 !important;
}

.ux-morph-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #c5a059 25%, #f5e6a3 50%, #c5a059 75%, transparent);
    z-index: 3;
}

.ux-morph-content {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    opacity: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 160, 89, 0.3) rgba(15, 23, 42, 0.4);
}

.ux-morph-content::-webkit-scrollbar {
    width: 5px;
}
.ux-morph-content::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 3px;
}
.ux-morph-content::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.3);
    border-radius: 3px;
}
.ux-morph-content::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.55);
}

/* Modal action buttons styling */
.ux-morph-card .btn-primary-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 18px;
    background: linear-gradient(135deg, #d4af37 0%, #b89328 100%);
    color: #0a0e17 !important;
    font-size: 13px;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.28);
    transition: all 0.15s ease;
}

.ux-morph-card .btn-primary-gold:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #dfbc45 0%, #c5a059 100%);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.42);
    filter: brightness(1.08);
}

.ux-morph-card .btn-primary-gold:active {
    transform: translateY(1px);
}

.ux-morph-card .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1 !important;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ux-morph-card .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.25);
}

.ux-morph-card .btn-ghost:active {
    transform: translateY(1px);
}

/* Compact QR Code Container for Zero-Clipping on Mobile */
.totp-qr-wrapper.compact-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    background: #080c14;
    border: 1px solid rgba(197, 160, 89, 0.2);
    border-radius: 10px;
    margin: 8px 0;
    box-sizing: border-box;
    min-height: unset !important;
}

.totp-qr-wrapper.compact-qr svg {
    width: 120px;
    height: 120px;
    max-width: 120px;
    max-height: 120px;
    display: block;
    border-radius: 6px;
}

@media (max-width: 360px) {
    .totp-qr-wrapper.compact-qr svg {
        width: 112px;
        height: 112px;
        max-width: 112px;
        max-height: 112px;
    }
}

/* Compact Secret Box */
.totp-secret-box {
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--acc-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
    padding: 6px 10px;
    text-align: center;
}

.totp-secret-box .secret-label {
    font-size: 11px;
    color: var(--acc-text-muted, #94a3b8);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.totp-secret-box code {
    font-family: var(--acc-font-mono, 'JetBrains Mono', monospace);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--acc-gold-light, #e5c781);
    letter-spacing: 1.5px;
    word-break: break-all;
    user-select: all;
}

/* Responsive instruction switch for TOTP modal */
.totp-instruction .desktop-instruction {
    display: block;
}
.totp-instruction .mobile-instruction {
    display: none;
}
@media (max-width: 480px) {
    .totp-instruction .desktop-instruction {
        display: none;
    }
    .totp-instruction .mobile-instruction {
        display: block;
    }
}

/* Custom Slim Scrollbar for Modal Body */
.ux-modal-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(197, 160, 89, 0.3) rgba(15, 23, 42, 0.4);
}

.ux-modal-scroll::-webkit-scrollbar {
    width: 6px;
}

.ux-modal-scroll::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 3px;
}

.ux-modal-scroll::-webkit-scrollbar-thumb {
    background: rgba(197, 160, 89, 0.3);
    border-radius: 3px;
}

.ux-modal-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(197, 160, 89, 0.5);
}

/* ─── Recovery Codes Grid & Pills (Luxury Gold Dark-Glass) ─── */
.ux-morph-card .recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px 12px;
    background: #090d14;
    border: 1px solid rgba(197, 160, 89, 0.22);
    border-radius: 10px;
    padding: 12px;
    box-sizing: border-box;
}

.ux-morph-card .recovery-code-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    font-family: var(--acc-font-mono, 'JetBrains Mono', 'Fira Code', monospace);
    font-size: 12px;
    letter-spacing: 0.5px;
    color: #f8fafc;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ux-morph-card .recovery-code-pill:hover {
    background: rgba(197, 160, 89, 0.08);
    border-color: rgba(197, 160, 89, 0.3);
}

.ux-morph-card .recovery-code-pill .code-num {
    font-size: 10.5px;
    color: var(--acc-gold, #c5a059);
    font-weight: 600;
    margin-right: 6px;
    user-select: none;
}

.ux-morph-card .recovery-code-pill .code-val {
    font-weight: 600;
    color: #f1f5f9;
}

/* Secondary Button styling within morph cards */
.ux-morph-card .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0 !important;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ux-morph-card .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(197, 160, 89, 0.4);
    color: #ffffff !important;
    transform: translateY(-1px);
}

.ux-morph-card .btn-secondary:active {
    transform: translateY(1px);
}

/* Scoped Modal Form Actions Bar */
.ux-morph-card .form-actions-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--acc-border, rgba(255, 255, 255, 0.08));
}

.ux-morph-card .form-actions-bar > button {
    width: auto !important;
    flex: 0 0 auto;
}

/* ─── Tactile Micro-Interactions ─── */
.ux-tactile {
    transition: transform 0.14s var(--ux-ease-spring), box-shadow 0.14s ease, filter 0.14s ease;
    user-select: none;
    -webkit-user-select: none;
}

.ux-tactile:active {
    transform: scale(0.975) translateY(1px);
}
