/* ============================================================
   CardX — Merchant Interface Styles (Rete Aniene Edition)
   Mobile-first SPA, max-width 480px.
   Palette: Dark (#292929 primary), Lime (#D5D92F accent),
   Blue (#2BA3C8 earn), Red (#FC3C3C redeem).
   Font: Oswald (titoli), Barlow Semi Condensed (body).
   Affiliazione: Rete Aniene (reteaniene.it)
   ============================================================ */

/* ---------- Layout generale ---------- */
html, body {
    height: 100%;
    overflow-x: hidden;
    background: var(--cx-bg);
    font-family: var(--cx-font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(213, 217, 47, 0.3);
    color: #292929;
}

/* ---------- App Shell ---------- */
.cx-app-shell {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--cx-bg);
    position: relative;
}

/* ---------- Page Content ---------- */
.cx-page-content {
    flex: 1;
    padding: 1.25rem;
    padding-bottom: 6rem;
}

/* ---------- Page Enter Animation ---------- */
.cx-page-enter {
    animation: cx-page-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cx-page-slide-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ============================================================
   HEADER — Sfondo scuro solido con bordo lime
   ============================================================ */

.cx-header {
    background: #292929;
    color: #fff;
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 3px solid #D5D92F;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.cx-header h1 {
    font-family: var(--cx-font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.cx-header .cx-subtitle {
    font-size: var(--cx-font-size-sm);
    opacity: 0.85;
    font-weight: 500;
    margin-top: 0.15rem;
}

.cx-header #logoutBtn {
    width: 38px;
    height: 38px;
    border-radius: var(--cx-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
}

.cx-header #logoutBtn:hover {
    background: rgba(213, 217, 47, 0.25);
    border-color: rgba(213, 217, 47, 0.4);
    transform: scale(1.05);
}


/* ============================================================
   BOTTOM NAVIGATION — Glassmorphism floating
   ============================================================ */

.cx-bottom-nav {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 2rem);
    max-width: 420px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0.6rem 0.5rem;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08),
                0 2px 8px rgba(0, 0, 0, 0.04);
}

.cx-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--cx-text-muted);
    font-size: 0.625rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
    padding: 0.375rem 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: var(--cx-radius);
    position: relative;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.cx-nav-item i {
    font-size: 1.3rem;
    margin-bottom: 0.2rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-nav-item.active {
    color: #D5D92F;
    background: rgba(213, 217, 47, 0.1);
}

.cx-nav-item.active i {
    transform: scale(1.1);
}

.cx-nav-item:not(.active):hover {
    color: var(--cx-text);
    background: rgba(0, 0, 0, 0.04);
}

/* Bottone Scanner prominente — FAB elevato */
.cx-nav-item--scanner {
    position: relative;
    top: -12px;
}

.cx-nav-item--scanner .cx-scanner-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D5D92F 0%, #959814 100%);
    color: #292929;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(213, 217, 47, 0.35);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.cx-nav-item--scanner .cx-scanner-btn i {
    font-size: 1.6rem;
    margin: 0;
    color: #292929;
}

.cx-nav-item--scanner:hover .cx-scanner-btn,
.cx-nav-item--scanner:active .cx-scanner-btn {
    transform: scale(1.08);
    box-shadow: 0 8px 28px rgba(213, 217, 47, 0.45);
    background: linear-gradient(135deg, #b8bc1a 0%, #959814 100%);
}

.cx-nav-item--scanner span {
    margin-top: 0.3rem;
    font-size: 0.65rem;
}


/* ============================================================
   AUTH — Login / Registrazione
   ============================================================ */

.cx-auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #292929;
    padding: 2rem 1.5rem;
    position: relative;
    overflow: hidden;
}

/* Forme decorative sullo sfondo auth */
.cx-auth-wrapper::before {
    content: '';
    position: absolute;
    top: -15%;
    right: -10%;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: rgba(213, 217, 47, 0.04);
    pointer-events: none;
}

.cx-auth-wrapper::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -15%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(213, 217, 47, 0.03);
    pointer-events: none;
}

.cx-auth-logo {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
    animation: cx-auth-logo-enter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cx-auth-logo-enter {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.cx-auth-logo h2 {
    color: #D5D92F;
    font-family: var(--cx-font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin: 0 0 0.5rem 0;
}

.cx-auth-logo small {
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--cx-font-size-base);
    font-weight: 500;
}

.cx-auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0.5rem;
    border-top: 3px solid #D5D92F;
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2),
                0 4px 16px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
    animation: cx-auth-card-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

@keyframes cx-auth-card-enter {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cx-auth-card h2 {
    color: var(--cx-text);
}

.cx-auth-card .form-label {
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    color: var(--cx-text);
}

.cx-auth-card .form-control {
    border-radius: 0.5rem;
    border: 1.5px solid var(--cx-border);
    padding: 0.75rem 1rem;
    font-size: var(--cx-font-size-base);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--cx-bg);
}

.cx-auth-card .form-control:focus {
    border-color: #D5D92F;
    box-shadow: 0 0 0 3px rgba(213, 217, 47, 0.15);
    background: #fff;
}

.cx-auth-card .input-group-text {
    border-radius: 0.5rem 0 0 0.5rem;
    border: 1.5px solid var(--cx-border);
    border-right: none;
    background: var(--cx-bg);
    color: var(--cx-text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-auth-card .input-group .form-control {
    border-left: none;
    border-radius: 0 0.5rem 0.5rem 0;
}

.cx-auth-card .input-group:focus-within .input-group-text {
    border-color: #D5D92F;
    color: #959814;
}

.cx-auth-card .input-group:focus-within .form-control {
    border-color: #D5D92F;
}


/* ============================================================
   BUTTON PRIMARIO — Lime con testo scuro
   ============================================================ */

.btn-cx-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: #D5D92F;
    border: none;
    border-radius: var(--cx-radius);
    padding: 0.875rem;
    color: #292929;
    font-weight: 700;
    font-size: var(--cx-font-size-base);
    box-shadow: 0 4px 14px rgba(213, 217, 47, 0.3);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-cx-primary:hover {
    background: #959814;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(213, 217, 47, 0.35);
    color: #292929;
}

.btn-cx-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(213, 217, 47, 0.25);
}

.btn-cx-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ---------- Button outline ---------- */
.btn-cx-outline {
    background: transparent;
    border: 1.5px solid #e0e0d8;
    border-radius: var(--cx-radius);
    padding: 0.5rem 1.25rem;
    color: #D5D92F;
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.btn-cx-outline:hover {
    border-color: #D5D92F;
    color: #D5D92F;
    background: rgba(213, 217, 47, 0.06);
}


/* ============================================================
   CARD GENERICA & SEZIONI
   ============================================================ */

.cx-card {
    background: var(--cx-surface);
    border-radius: 0.5rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--cx-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cx-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.cx-card-title {
    font-size: var(--cx-font-size-base);
    font-weight: 700;
    color: var(--cx-text);
    margin: 0;
}

.cx-section-title {
    font-family: var(--cx-font-heading);
    font-size: var(--cx-font-size-lg);
    font-weight: 700;
    color: var(--cx-text);
    margin-bottom: 1rem;
    padding-left: 0.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}


/* ============================================================
   STATS GRID — Dashboard
   ============================================================ */

.cx-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cx-stat-card {
    background: var(--cx-surface);
    border-radius: var(--cx-radius);
    padding: 0.875rem 0.625rem;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--cx-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.cx-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #D5D92F;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.cx-stat-card:hover::before {
    opacity: 1;
}

.cx-stat-value {
    font-size: var(--cx-font-size-xl);
    font-weight: 800;
    color: #D5D92F;
    line-height: 1.2;
}

.cx-stat-value.cx-stat--earn {
    color: #2BA3C8;
}

.cx-stat-value.cx-stat--redeem {
    color: #FC3C3C;
}

.cx-stat-label {
    font-size: 0.65rem;
    color: var(--cx-text-muted);
    font-weight: 700;
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ============================================================
   QUICK ACTIONS — Con overlay e icone animate
   ============================================================ */

.cx-quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.cx-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 0.5rem;
    border: 1px solid var(--cx-border);
    border-radius: var(--cx-radius);
    background: var(--cx-surface);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    color: var(--cx-text);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: var(--cx-font-size-xs);
    font-weight: 600;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.cx-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(213, 217, 47, 0.03);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-action-btn i {
    font-size: 1.5rem;
    color: #292929;
    background: rgba(213, 217, 47, 0.12);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--cx-radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

.cx-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(213, 217, 47, 0.12);
    text-decoration: none;
    color: var(--cx-text);
    border-color: rgba(213, 217, 47, 0.3);
}

.cx-action-btn:hover::before {
    opacity: 1;
}

.cx-action-btn:hover i {
    background: #292929;
    color: #D5D92F;
    transform: scale(1.05);
}


/* ============================================================
   TRANSAZIONI — Lista con hover animati
   ============================================================ */

.cx-tx-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    gap: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-tx-item:last-child {
    border-bottom: none;
}

.cx-tx-item:hover {
    background: rgba(213, 217, 47, 0.03);
    border-radius: var(--cx-radius-sm);
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.cx-tx-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.cx-tx-icon--earn {
    background: rgba(43, 163, 200, 0.1);
    color: #2BA3C8;
}

.cx-tx-icon--redeem {
    background: rgba(252, 60, 60, 0.1);
    color: #FC3C3C;
}

.cx-tx-info {
    flex: 1;
    min-width: 0;
}

.cx-tx-name {
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    color: var(--cx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cx-tx-detail {
    font-size: var(--cx-font-size-xs);
    color: var(--cx-text-muted);
}

.cx-tx-points {
    font-weight: 700;
    font-size: var(--cx-font-size-sm);
    text-align: right;
    flex-shrink: 0;
}

.cx-tx-points--earn {
    color: #2BA3C8;
}

.cx-tx-points--redeem {
    color: #FC3C3C;
}

.cx-tx-date {
    font-size: var(--cx-font-size-xs);
    color: var(--cx-text-light);
    text-align: right;
}


/* ============================================================
   SCANNER — Pagina full-screen
   ============================================================ */

.cx-scanner-wrapper {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: 100vh;
    background: #000;
    z-index: 300;
    display: flex;
    flex-direction: column;
}

.cx-scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    z-index: 10;
}

.cx-scanner-header h3 {
    margin: 0;
    font-family: var(--cx-font-heading);
    font-size: var(--cx-font-size-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cx-scanner-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cx-qr-reader {
    width: 100%;
    height: 100%;
}

#cx-qr-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Nascondi le UI di default di html5-qrcode */
#cx-qr-reader img[alt="Info icon"],
#cx-qr-reader span:not(.cx-keep),
#cx-qr-reader__dashboard_section,
#cx-qr-reader__dashboard_section_csr,
#cx-qr-reader__status_span,
#cx-qr-reader__header_message {
    display: none !important;
}

.cx-scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.cx-scan-frame {
    width: 250px;
    height: 250px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    position: relative;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.3);
}

.cx-scan-frame::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 2px;
    background: #D5D92F;
    box-shadow: 0 0 12px #D5D92F, 0 0 4px #D5D92F;
    animation: cx-scan-line 2s ease-in-out infinite;
}

@keyframes cx-scan-line {
    0%, 100% { top: 10%; }
    50% { top: 85%; }
}

.cx-scanner-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.95);
    font-size: var(--cx-font-size-sm);
    font-weight: 500;
    text-align: center;
    z-index: 10;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1.25rem;
    border-radius: var(--cx-radius-full);
}


/* ============================================================
   POST-SCAN — Risultato scansione
   ============================================================ */

.cx-scan-result {
    padding: 1rem;
    background: var(--cx-bg);
    flex: 1;
    overflow-y: auto;
}

/* ---------- Customer Banner (Dark con accenti lime) ---------- */
.cx-customer-banner {
    background: #292929;
    color: #fff;
    border-radius: var(--cx-radius);
    padding: 1.25rem;
    text-align: center;
    margin-bottom: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border-left: 3px solid #D5D92F;
    border-right: 3px solid #D5D92F;
}

.cx-customer-banner::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(213, 217, 47, 0.06);
    pointer-events: none;
}

.cx-customer-banner::after {
    content: '';
    position: absolute;
    bottom: -25%;
    left: -8%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(213, 217, 47, 0.04);
    pointer-events: none;
}

.cx-customer-banner .cx-customer-name {
    font-family: var(--cx-font-heading);
    font-size: var(--cx-font-size-lg);
    font-weight: 700;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cx-customer-banner .cx-customer-code {
    font-size: var(--cx-font-size-xs);
    opacity: 0.6;
    font-family: monospace;
    position: relative;
    z-index: 1;
}


/* ============================================================
   OP TABS — Carica / Riscatta
   ============================================================ */

.cx-op-tabs {
    display: flex;
    gap: 0;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-bottom: 1rem;
    border: none;
    background: var(--cx-surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 0.25rem;
}

.cx-op-tab {
    flex: 1;
    padding: 0.6rem;
    text-align: center;
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background: transparent;
    color: var(--cx-text-muted);
    border-radius: 0.375rem;
}

.cx-op-tab.active {
    background: #D5D92F;
    color: #292929;
    box-shadow: 0 2px 8px rgba(213, 217, 47, 0.3);
}

.cx-op-tab:not(.active):hover {
    background: rgba(213, 217, 47, 0.08);
    color: #959814;
}


/* ============================================================
   REWARD GRID — Griglia selezione premi (scanner)
   ============================================================ */

.cx-reward-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.cx-reward-item {
    background: var(--cx-surface);
    border: 1.5px solid var(--cx-border);
    border-radius: var(--cx-radius);
    padding: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cx-reward-item:hover,
.cx-reward-item.selected {
    border-color: #D5D92F;
    box-shadow: 0 0 0 3px rgba(213, 217, 47, 0.15);
}

.cx-reward-item.selected {
    background: rgba(213, 217, 47, 0.04);
}

.cx-reward-item .cx-reward-name {
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    margin-bottom: 0.25rem;
    color: var(--cx-text);
}

.cx-reward-item .cx-reward-pts {
    font-size: var(--cx-font-size-xs);
    font-weight: 700;
    color: #D5D92F;
}

.cx-reward-item .cx-reward-stock {
    font-size: 0.65rem;
    color: var(--cx-text-muted);
    margin-top: 0.15rem;
}


/* ============================================================
   SUCCESS ANIMATION — Check con glow ring
   ============================================================ */

.cx-success-anim {
    text-align: center;
    padding: 2rem 1rem;
}

.cx-success-check {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(43, 163, 200, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    animation: cx-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.cx-success-check::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(43, 163, 200, 0.2);
    animation: cx-glow-ring 1.5s ease-in-out infinite;
}

@keyframes cx-glow-ring {
    0%, 100% {
        transform: scale(1);
        opacity: 0.6;
    }
    50% {
        transform: scale(1.08);
        opacity: 1;
    }
}

.cx-success-check i {
    font-size: 2.5rem;
    color: #2BA3C8;
}

@keyframes cx-pop-in {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.cx-result-detail {
    font-size: var(--cx-font-size-2xl);
    font-weight: 800;
    margin: 0.5rem 0;
}

.cx-result-detail--earn {
    color: #2BA3C8;
}

.cx-result-detail--redeem {
    color: #D5D92F;
}

.cx-result-balance {
    font-size: var(--cx-font-size-sm);
    color: var(--cx-text-muted);
}


/* ============================================================
   REWARDS MANAGEMENT — Tab bar + Card gestione premi
   ============================================================ */

.cx-tab-bar {
    display: flex;
    background: var(--cx-surface);
    border-radius: var(--cx-radius);
    padding: 0.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--cx-border);
}

.cx-tab-btn {
    flex: 1;
    padding: 0.5rem;
    text-align: center;
    border: none;
    border-radius: var(--cx-radius-sm);
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
    color: var(--cx-text-muted);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-tab-btn.active {
    background: #D5D92F;
    color: #292929;
    box-shadow: 0 2px 8px rgba(213, 217, 47, 0.3);
}

.cx-tab-btn:not(.active):hover {
    color: #959814;
    background: rgba(213, 217, 47, 0.08);
}

/* ---------- Category Items ---------- */
.cx-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem;
    background: var(--cx-surface);
    border-radius: var(--cx-radius-sm);
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--cx-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-category-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.cx-category-item .cx-cat-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cx-category-item .cx-cat-icon {
    font-size: 1.25rem;
}

.cx-category-item .cx-cat-name {
    font-weight: 600;
    font-size: var(--cx-font-size-sm);
}

/* ---------- Reward Cards (gestione CRUD) ---------- */
.cx-reward-card {
    background: var(--cx-surface);
    border-radius: var(--cx-radius);
    padding: 1.125rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 0.75rem;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--cx-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-reward-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #D5D92F;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-reward-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    border-color: rgba(213, 217, 47, 0.25);
}

.cx-reward-card:hover::before {
    opacity: 1;
}

.cx-reward-card .cx-reward-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.cx-reward-card .cx-reward-card-title {
    font-weight: 700;
    font-size: var(--cx-font-size-base);
    color: var(--cx-text);
}

.cx-reward-card .cx-reward-card-cat {
    font-size: var(--cx-font-size-xs);
    color: var(--cx-text-muted);
}

.cx-reward-card .cx-reward-card-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cx-reward-card .cx-reward-card-points {
    font-size: var(--cx-font-size-lg);
    font-weight: 800;
    color: #D5D92F;
}

.cx-reward-card .cx-reward-card-stock {
    font-size: var(--cx-font-size-xs);
    color: var(--cx-text-muted);
}


/* ============================================================
   STORE SETUP — Branding
   ============================================================ */

.cx-color-preview {
    width: 100%;
    padding: 1.5rem;
    border-radius: var(--cx-radius);
    text-align: center;
    margin-bottom: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.cx-color-input-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.cx-color-swatch {
    width: 40px;
    height: 40px;
    border-radius: var(--cx-radius-sm);
    border: 2px solid var(--cx-border);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cx-color-swatch:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.cx-color-swatch input[type="color"] {
    width: 56px;
    height: 56px;
    border: none;
    padding: 0;
    margin: -8px;
    cursor: pointer;
}


/* ============================================================
   EMPTY STATE
   ============================================================ */

.cx-empty-cta {
    text-align: center;
    padding: 3rem 1.5rem;
}

.cx-empty-cta i {
    font-size: 3.5rem;
    color: #D5D92F;
    margin-bottom: 1rem;
    display: block;
}

.cx-empty-cta h3 {
    font-family: var(--cx-font-heading);
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cx-empty-cta p {
    color: var(--cx-text-muted);
    margin-bottom: 1.5rem;
}


/* ============================================================
   PAGINATION
   ============================================================ */

.cx-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-bottom: 1rem;
}

.cx-pagination button {
    width: 36px;
    height: 36px;
    border-radius: var(--cx-radius-full);
    border: 1px solid var(--cx-border);
    background: var(--cx-surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cx-pagination button:not(:disabled):hover {
    background: #D5D92F;
    color: #292929;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(213, 217, 47, 0.3);
    transform: scale(1.05);
}

.cx-pagination .cx-page-info {
    font-size: var(--cx-font-size-sm);
    color: var(--cx-text-muted);
    padding: 0 0.5rem;
}


/* ============================================================
   BADGES
   ============================================================ */

.cx-badge {
    font-size: var(--cx-font-size-xs);
    padding: 0.2rem 0.6rem;
    border-radius: var(--cx-radius-full);
    font-weight: 600;
    display: inline-block;
}

.cx-badge--earn {
    background: rgba(43, 163, 200, 0.12);
    color: #2BA3C8;
}

.cx-badge--redeem {
    background: rgba(252, 60, 60, 0.12);
    color: #FC3C3C;
}


/* ============================================================
   UTILITY
   ============================================================ */

.cx-clickable {
    cursor: pointer;
}

.cx-divider {
    height: 1px;
    background: var(--cx-border);
    margin: 1rem 0;
}

/* ---------- Store selector dropdown (nell'header) ---------- */
.cx-store-selector {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--cx-radius);
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.cx-store-selector select {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: var(--cx-radius-sm);
    padding: 0.3rem 0.5rem;
    font-size: var(--cx-font-size-sm);
    width: 100%;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cx-store-selector select:focus {
    border-color: #D5D92F;
    outline: none;
}

.cx-store-selector select option {
    color: var(--cx-text);
    background: var(--cx-surface);
}


/* ============================================================
   CONFIRM MODAL OVERLAY
   ============================================================ */

.cx-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 400;
    animation: cx-fade-in 0.2s ease;
}

.cx-confirm-sheet {
    background: var(--cx-surface);
    width: 100%;
    max-width: 480px;
    border-radius: 0.5rem 0.5rem 0 0;
    border-top: 3px solid #D5D92F;
    padding: 1.5rem;
    animation: cx-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.12);
}

@keyframes cx-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cx-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}


/* ============================================================
   SCROLLBAR
   ============================================================ */

::-webkit-scrollbar {
    width: 4px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(213, 217, 47, 0.3);
    border-radius: var(--cx-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(213, 217, 47, 0.5);
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Desktop > 480px: sfondo warm gray e shell centrata con ombra */
@media (min-width: 481px) {
    body {
        background: #e5e5e0;
    }

    .cx-app-shell {
        box-shadow: 0 0 40px rgba(0, 0, 0, 0.08),
                    0 0 0 1px var(--cx-border);
        border-radius: 0;
        min-height: 100vh;
    }

    .cx-auth-wrapper {
        min-height: 100vh;
    }
}

/* Schermi piccoli < 380px: riduci paddings */
@media (max-width: 380px) {
    .cx-page-content {
        padding: 1rem;
        padding-bottom: 5.5rem;
    }

    .cx-stats-grid,
    .cx-quick-actions {
        gap: 0.5rem;
    }

    .cx-stat-card {
        padding: 0.625rem 0.375rem;
    }

    .cx-stat-value {
        font-size: var(--cx-font-size-lg);
    }

    .cx-stat-label {
        font-size: 0.6rem;
    }

    .cx-action-btn {
        padding: 1rem 0.35rem;
    }

    .cx-action-btn i {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .cx-header {
        padding: 1rem 1.25rem;
    }

    .cx-header h1 {
        font-size: 1.1rem;
    }

    .cx-customer-banner {
        padding: 1rem;
    }
}
