/* =========================================
   Profile Page
   ========================================= */
.profile-body {
    background: var(--bg-light);
}

/* =========================================
   Profile Hero
   ========================================= */
.profile-hero {
    position: relative;
    padding: 120px 0 0;
}

/* Hero background removed for a cleaner look. The element is kept in the
   DOM in case any external script references it, but it renders nothing. */
.profile-hero-bg {
    display: none;
}

.profile-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

/* Profile Identity */
.profile-identity {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 32px;
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    height: 100%;
}

.profile-avatar-wrap {
    position: relative;
    display: inline-block;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    font-family: inherit;
    transition: transform var(--duration-fast);
}
.profile-avatar-wrap:hover { transform: scale(1.04); }
.profile-avatar-wrap:hover .profile-avatar-edit {
    background: var(--primary-blue);
    color: white;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue) 0%, #0052cc 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-3xl);
    font-weight: 800;
    color: white;
    flex-shrink: 0;
    letter-spacing: -1px;
    box-shadow: var(--shadow-md);
}

.profile-avatar-edit {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    color: var(--text-dark);
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: background var(--duration-fast), color var(--duration-fast);
}
.profile-avatar-edit i { width: 14px; height: 14px; }

.profile-info h1 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.profile-phone {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.profile-joined {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--text-faint);
    font-weight: 600;
}

.profile-joined i {
    width: 14px;
    height: 14px;
}

/* =========================================
   Membership Card
   ========================================= */
.membership-card {
    padding: 28px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    background: white;
    position: relative;
    overflow: hidden;
    text-align: left;
    font-family: inherit;
    color: inherit;
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr clamp(150px, 32%, 200px);
    gap: 24px;
    align-items: center;
    transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}
.membership-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* Left column: tier name, progress, perks */
.membership-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Right column: the big 3D medal */
.membership-medal {
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tier name + detail arrow row */
.tier-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tier-text {
    display: flex;
    flex-direction: column;
}

.membership-eyebrow {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.tier-icon {
    width: 100%;
    height: 100%;
    min-height: 160px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

model-viewer.medal-3d {
    width: 100%;
    height: 100%;
    background: transparent;
    --poster-color: transparent;
    --progress-bar-color: transparent;
    --progress-mask: transparent;
}

/* Scale + fade pop on first paint; the 3D spin is driven from JS */
@keyframes medal-pop {
    from { opacity: 0; transform: scale(0.55); }
    to   { opacity: 1; transform: scale(1); }
}
model-viewer.medal-3d.medal-pop {
    animation: medal-pop 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.tier-name {
    display: block;
    font-size: var(--text-2xl);
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* All tiers share the brand-blue treatment, the medal itself differentiates them */
.membership-card .tier-name { color: var(--text-dark); }
.membership-card .progress-fill { background: linear-gradient(90deg, var(--primary-blue), #3B82F6); }

/* Progress Bar */
.tier-progress {
    margin-bottom: 0;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

.progress-info strong {
    color: var(--text-dark);
    font-weight: 800;
}

.progress-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-light);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s var(--ease-out-expo);
}

/* Tier Perks */
.tier-perks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.perk-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-light);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-body);
}

.perk-chip i {
    width: 14px;
    height: 14px;
}

/* =========================================
   Stats Grid
   ========================================= */
.profile-stats {
    padding: 32px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-blue-10);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* All four stat icons share the brand-blue tint for a consistent feel.
   The icon shape itself communicates the category, so no extra color is
   needed, keeps the page from feeling AI-generated and noisy. */
.stat-icon-green,
.stat-icon-yellow,
.stat-icon-purple {
    background: var(--primary-blue-10);
    color: var(--primary-blue);
}

.stat-icon i {
    width: 22px;
    height: 22px;
}

.stat-card strong {
    display: block;
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.stat-card span {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
}

/* =========================================
   Dashboard Tabs
   ========================================= */
.profile-dashboard {
    padding-bottom: 80px;
}

.dash-tabs {
    position: relative;
    display: inline-flex;
    gap: 4px;
    padding: 6px;
    background: white;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.dash-tabs::-webkit-scrollbar { display: none; }

.dash-tab-indicator {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--primary-blue);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-blue);
    z-index: 0;
    opacity: 0;
    pointer-events: none;
}

.dash-tab {
    position: relative;
    z-index: 1;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--text-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: color var(--duration-normal) var(--ease-out-expo);
    font-family: var(--font-main);
}

.dash-tab:hover { color: var(--text-dark); }

.dash-tab.active {
    color: white;
    background: transparent;
    box-shadow: none;
}

.dash-tab i { width: 16px; height: 16px; }

/* Panels */
.dash-panel {
    display: none;
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    padding: 32px;
    min-height: 300px;
}

.dash-panel.active {
    display: block;
}

/* Panel Empty */
.panel-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.panel-empty i {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    color: var(--text-faint);
}

.panel-empty h3 {
    color: var(--text-dark);
    font-size: var(--text-xl);
    margin-bottom: 8px;
}

.panel-empty p {
    margin-bottom: 24px;
}

/* Orders List */
.orders-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.order-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: background var(--duration-fast);
}

.order-item:hover { background: var(--bg-light); }

.order-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
}

.order-icon i { width: 20px; height: 20px; }

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

.order-info h4 {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.order-info p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.order-status {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
}

.status-completed { background: #DCFCE7; color: #16A34A; }
.status-processing { background: #FEF3C7; color: #D97706; }
.status-shipped { background: var(--primary-blue-10); color: var(--primary-blue); }
.status-paid { background: #DCFCE7; color: #16A34A; }
.status-complained { background: #FEE2E2; color: #DC2626; }

/* Order complaint badge (next to title in order list) */
.order-complaint-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FEE2E2;
    color: #DC2626;
    margin-left: 6px;
    vertical-align: -3px;
}
.order-complaint-badge i { width: 12px; height: 12px; }

/* Complaint form */
.complaint-form .complaint-help {
    color: var(--text-body);
    line-height: 1.5;
    font-size: var(--text-sm);
    margin-bottom: 16px;
}

.complaint-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 16px;
}

.complaint-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.complaint-field span {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-body);
}

.complaint-field select,
.complaint-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    font-size: var(--text-sm);
    color: var(--text-dark);
    background: white;
    transition: border-color var(--duration-fast);
}

.complaint-field select:focus,
.complaint-field textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--primary-blue-10);
}

.complaint-field textarea {
    resize: vertical;
    min-height: 90px;
}

.complaint-existing {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.complaint-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.complaint-status-label {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.complaint-status-pill {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
}

.complaint-status-pending  { background: #FEF3C7; color: #D97706; }
.complaint-status-in_progress { background: var(--primary-blue-10); color: var(--primary-blue); }
.complaint-status-resolved { background: #DCFCE7; color: #16A34A; }
.complaint-status-rejected { background: #FEE2E2; color: #DC2626; }

.complaint-existing-msg {
    font-size: var(--text-sm);
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.5;
    font-style: italic;
}

.complaint-existing-date {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.order-amount {
    font-weight: 800;
    color: var(--text-dark);
    white-space: nowrap;
}

/* Events List */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.event-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
}

.event-item-date {
    text-align: center;
    min-width: 52px;
    padding: 8px;
    border-radius: var(--radius-md);
    background: var(--primary-blue-10);
}

.event-item-date .month {
    display: block;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary-blue);
    text-transform: uppercase;
}

.event-item-date .day {
    display: block;
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--primary-blue);
    line-height: 1.2;
}

.event-item-info { flex: 1; }

.event-item-info h4 {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.event-item-info p {
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.event-item-badge {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
}

.badge-upcoming { background: var(--primary-blue-10); color: var(--primary-blue); }
.badge-attended { background: #DCFCE7; color: #16A34A; }

/* Event Groups (Saved + My Events) */
.events-group {
    margin-bottom: 32px;
}

.events-group:last-child {
    margin-bottom: 0;
}

.events-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.events-group-header h3 {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.events-group-header h3 i {
    width: 18px;
    height: 18px;
    color: var(--primary-blue);
}

.events-group-count {
    background: var(--primary-blue-10);
    color: var(--primary-blue);
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 800;
    min-width: 24px;
    text-align: center;
}

/* Inline (smaller) empty state used inside group */
.panel-empty-inline {
    padding: 28px 20px;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    border: 1.5px dashed var(--border-light);
}

.panel-empty-inline i {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
}

.panel-empty-inline h4 {
    color: var(--text-dark);
    font-size: var(--text-base);
    font-weight: 700;
    margin-bottom: 6px;
}

.panel-empty-inline p {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: 14px;
}

/* Event item refinements */
.event-item {
    transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}

.event-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-blue);
    transform: translateX(2px);
}

.event-item-info p {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.event-item-info p i {
    width: 12px;
    height: 12px;
}

.event-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.event-item-unsave {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast);
}

.event-item-unsave:hover {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #FCA5A5;
    transform: scale(1.08);
}

.event-item-unsave i {
    width: 14px;
    height: 14px;
}

/* =========================================
   Rewards Tab
   ========================================= */
.rewards-balance-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 28px 32px;
    border-radius: var(--radius-xl);
    background: var(--primary-blue);
    color: white;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.rewards-balance-card::before {
    content: '';
    position: absolute;
    inset: -40px -60px auto auto;
    width: 200px; height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}

.rewards-balance-text { flex: 1; }

.rewards-label {
    font-size: var(--text-sm);
    font-weight: 600;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

.rewards-balance-card h2 {
    font-size: clamp(2.25rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 8px;
}

.rewards-note {
    font-size: var(--text-xs);
    opacity: 0.75;
    font-weight: 500;
}

.rewards-balance-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}
.rewards-balance-icon i { width: 28px; height: 28px; color: white; }

.rewards-section {
    margin-bottom: 32px;
}
.rewards-section:last-child { margin-bottom: 0; }

.rewards-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.rewards-section-header h3 {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
    margin: 0;
}
.rewards-section-sub {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
}

.tier-info-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 900px) {
    .tier-info-list { grid-template-columns: 1fr; }
}

.tier-info-card.is-current {
    background: var(--primary-blue-10);
    border-color: var(--primary-blue);
}
.tier-info-now {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: var(--primary-blue);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* Claimable rewards inline list */
.rewards-claim-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.reward-claim-card {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: white;
    transition: border-color var(--duration-fast), transform var(--duration-fast);
}
.reward-claim-card:hover:not(.is-locked) {
    border-color: var(--primary-blue);
    transform: translateY(-1px);
}
.reward-claim-card.is-locked { opacity: 0.55; }

.reward-claim-icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: var(--primary-blue-10);
    color: var(--primary-blue);
    display: flex; align-items: center; justify-content: center;
}
.reward-claim-icon i { width: 20px; height: 20px; }

.reward-tint-purple .reward-claim-icon { background: rgba(139,92,246,0.1); color: #8B5CF6; }
.reward-tint-green  .reward-claim-icon { background: rgba(34,197,94,0.1);  color: #22C55E; }
.reward-tint-yellow .reward-claim-icon { background: rgba(245,158,11,0.1); color: #F59E0B; }
.reward-tint-orange .reward-claim-icon { background: rgba(249,115,22,0.1); color: #F97316; }

.reward-claim-info { min-width: 0; }
.reward-claim-info h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
    margin-bottom: 2px;
}
.reward-claim-info p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.reward-claim-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.reward-claim-cost {
    font-weight: 800;
    font-size: var(--text-sm);
    color: var(--text-dark);
}
.reward-claim-cost small {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
}

.tier-info-card {
    display: grid;
    grid-template-columns: 1fr 84px;
    gap: 16px;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.tier-info-body { min-width: 0; }

.tier-info-badge {
    align-self: stretch;
    width: 84px;
    height: 100%;
    min-height: 84px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tier-info-badge model-viewer {
    width: 100%;
    height: 100%;
    min-height: 84px;
    background: transparent;
    --poster-color: transparent;
    --progress-bar-color: transparent;
    --progress-mask: transparent;
}

.tier-info-card h4 {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.tier-info-card p {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.tier-info-card ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.tier-info-card li {
    font-size: var(--text-xs);
    color: var(--text-body);
    padding-left: 16px;
    position: relative;
}

.tier-info-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--primary-blue);
    font-weight: 700;
}

/* Points History */
.points-history h3 {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.points-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.points-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-light);
}

.points-item-info h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-dark);
}

.points-item-info p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.points-amount {
    font-weight: 800;
    font-size: var(--text-base);
}

.points-amount.positive { color: var(--primary-blue); }
.points-amount.negative { color: #EF4444; }

/* =========================================
   Settings Tab
   ========================================= */
.settings-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border-light);
}

.settings-section:last-child { border-bottom: none; }

.settings-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 20px;
}

.settings-section h3 i {
    width: 20px;
    height: 20px;
    color: var(--primary-blue);
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
}

.settings-field-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}
.settings-field-row > div { flex: 1; }
.settings-field-row .btn { white-space: nowrap; }

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-field label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 6px;
}

.settings-field input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: var(--font-main);
    font-weight: 500;
}

.settings-field input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px var(--primary-blue-10);
}

.settings-field input:disabled {
    background: var(--bg-light);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Toggle switches */
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
}

.setting-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 8px 0;
}

.setting-toggle span:first-child {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-body);
}

.setting-toggle input {
    display: none;
}

.toggle-switch {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--border-light);
    position: relative;
    transition: background var(--duration-fast);
    flex-shrink: 0;
}

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

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

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

/* Settings panel: 2-col grid on desktop */
@media (min-width: 768px) {
    #panel-settings.active {
        display: grid;
        grid-template-columns: 1fr 1fr;
        column-gap: 40px;
        row-gap: 0;
    }
    #panel-settings .settings-section {
        padding: 24px 0;
    }
    #panel-settings .settings-section:nth-last-child(-n+2) {
        border-bottom: none;
    }
    #panel-settings .settings-section:first-child,
    #panel-settings .settings-section:nth-child(2) {
        padding-top: 0;
    }
}

/* Danger zone */
.settings-danger {
    padding-top: 32px;
}

.btn-danger {
    color: #EF4444 !important;
    border-color: #FCA5A5 !important;
}

.btn-danger:hover {
    background: #FEE2E2 !important;
}

/* =========================================
   Toast
   ========================================= */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(200%);
    background: var(--text-dark);
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-xl);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: var(--text-sm);
    z-index: 400;
    transition: transform var(--duration-normal) var(--ease-out-back);
}

.toast.show { transform: translateX(-50%) translateY(0); }
.toast i { width: 18px; height: 18px; color: #22C55E; }

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 1024px) {
    .profile-card {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================
   Wishlist list
   ========================================= */
.wishlist-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wishlist-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px;
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    transition: all 0.2s ease;
    cursor: pointer;
}

.wishlist-item:hover {
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.wishlist-item-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-light);
    flex-shrink: 0;
}

.wishlist-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wishlist-item-info {
    min-width: 0;
}

.wishlist-item-brand {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.wishlist-item-info h4 {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 6px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wishlist-item-price {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.wishlist-item-price strong {
    font-size: var(--text-base);
    font-weight: 800;
    color: var(--primary-blue);
}

.wishlist-item-original {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-decoration: line-through;
}

.wishlist-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-light);
    background: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: #FEF2F2;
    color: #DC2626;
    border-color: #FECACA;
}

.btn-icon i {
    width: 16px;
    height: 16px;
}

@media (max-width: 768px) {
    .profile-hero { padding-top: 100px; }
    .profile-hero-bg { height: 200px; }
    .profile-identity { flex-direction: column; text-align: center; padding: 24px; }
    .membership-card { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .dash-tabs { width: 100%; }
    .dash-panel { padding: 20px; }
    .wishlist-item { grid-template-columns: 64px 1fr; }
    .wishlist-item-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .wishlist-item-image { width: 64px; height: 64px; }

    /* ---- Orders list: switch to a 2-row grid on phones ----
       The desktop single-row flex layout squeezes the title column to almost
       nothing on narrow screens, so long product names ("Royal Padel Whip
       2026 Pro …") wrapped one word per line and the rows overlapped. Here we
       lay each order out as: [icon] [title/meta], with status + price on a
       second row, so everything has room to breathe. */
    .order-item {
        display: grid;
        grid-template-columns: 44px 1fr auto;
        grid-template-areas:
            "icon info chevron"
            "meta meta meta";
        align-items: center;
        gap: 8px 14px;
        padding: 14px 16px;
    }
    .order-icon { grid-area: icon; }
    .order-info { grid-area: info; }
    .order-chevron { grid-area: chevron; align-self: center; }
    .order-info h4 {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.3;
    }
    /* Status badge + amount share the second row, pinned to opposite ends. */
    .order-status {
        grid-area: meta;
        justify-self: start;
    }
    .order-amount {
        grid-area: meta;
        justify-self: end;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .profile-avatar { width: 64px; height: 64px; font-size: var(--text-2xl); }
    .dash-tab { padding: 10px 16px; font-size: var(--text-xs); }
}

/* Settings: sport preferences */
.settings-prefs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.settings-prefs-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.settings-prefs-empty {
    font-size: var(--text-sm);
    color: var(--text-muted);
}
.pref-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-blue-10);
    color: var(--primary-blue);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
}
.pref-chip i { width: 14px; height: 14px; }


/* =========================================
   Buttons: small + danger variants used by profile
   ========================================= */
.btn-sm {
    padding: 8px 14px;
    font-size: var(--text-sm);
}

/* Solid red for confirm OK on destructive actions */
.btn-danger-solid {
    background: #DC2626 !important;
    color: white !important;
    border-color: #DC2626 !important;
}
.btn-danger-solid:hover {
    background: #B91C1C !important;
    border-color: #B91C1C !important;
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.25);
}

/* Logout sits in the danger zone, so it gets a red treatment too.
   We use the lighter outline variant so it reads as "destructive but
   reversible", while delete-account uses the harder solid red below. */
#logout-btn {
    color: #DC2626;
    border-color: #FCA5A5;
    background: #FEF2F2;
}
#logout-btn:hover {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #B91C1C;
}

/* =========================================
   Tier detail arrow on membership card
   ========================================= */
.tier-detail-arrow {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration-fast), color var(--duration-fast), transform var(--duration-fast);
}
.tier-detail-arrow i { width: 16px; height: 16px; }
.membership-card:hover .tier-detail-arrow {
    background: var(--primary-blue);
    color: white;
    transform: translateX(2px);
}

/* Stat cards are interactive: make that obvious */
.stat-card {
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    color: inherit;
    transition: transform var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-blue);
    box-shadow: var(--shadow-md);
}

/* Wishlist stat icon: brand blue (matches the rest of the stat row) */
.stat-icon-purple { background: var(--primary-blue-10); color: var(--primary-blue); }

/* Order/Event row buttons reset native button styling */
.order-item, .event-item {
    width: 100%;
    text-align: left;
    background: white;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}
.order-chevron, .event-chevron {
    width: 18px;
    height: 18px;
    color: var(--text-faint);
    flex-shrink: 0;
}

/* =========================================
   Modal base (used by #profile-modal + #confirm-modal)
   ========================================= */
.modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-normal);
}
.modal.open {
    opacity: 1;
    pointer-events: all;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px;
    width: calc(100% - 32px);
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95) translateY(8px);
    transition: transform var(--duration-normal) var(--ease-out-expo);
}
.modal.open .modal-content {
    transform: scale(1) translateY(0);
}

.modal-content-sm { max-width: 420px; text-align: center; }
.modal-content-lg { max-width: 640px; }

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: background var(--duration-fast), transform var(--duration-fast);
    z-index: 2;
}
.modal-close:hover { background: var(--border-light); transform: rotate(90deg); }
.modal-close i { width: 18px; height: 18px; }

/* Shared modal typography */
.modal-label {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-blue);
    margin-bottom: 6px;
}
#modal-body h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 8px;
    padding-right: 36px;
}
.modal-subline {
    font-size: var(--text-sm);
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.modal-subline i { width: 14px; height: 14px; }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-light);
}
.modal-actions .btn { flex: 1 1 auto; justify-content: center; }

/* =========================================
   Order detail modal
   ========================================= */
.order-timeline {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 24px 0;
    position: relative;
}
.order-timeline::before {
    content: '';
    position: absolute;
    top: 14px;
    left: 12.5%;
    right: 12.5%;
    height: 2px;
    background: var(--border-light);
    z-index: 0;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}
.timeline-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--border-light);
    color: var(--text-faint);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xs);
    font-weight: 800;
    transition: all var(--duration-fast);
}
.timeline-dot i { width: 14px; height: 14px; }
.timeline-step span {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.timeline-step.reached .timeline-dot {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}
.timeline-step.reached span { color: var(--text-dark); }

.order-detail-items {
    background: var(--bg-light);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-top: 16px;
}
.order-detail-items h4 {
    font-size: var(--text-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.order-detail-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: var(--text-sm);
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-light);
}
.order-detail-item:last-of-type { border-bottom: none; }
.order-detail-item strong { color: var(--text-dark); font-weight: 700; }

.order-detail-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    margin-top: 8px;
    border-top: 2px solid var(--text-dark);
    font-size: var(--text-base);
}
.order-detail-total strong {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
}

.order-detail-points {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 14px;
    background: var(--primary-blue-10);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary-blue);
}
.order-detail-points i { width: 14px; height: 14px; }

.order-tracking {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-light);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-md);
}
.order-tracking code {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-dark);
    margin-top: 4px;
}

/* =========================================
   Event detail modal
   ========================================= */
.event-detail-image {
    position: relative;
    width: calc(100% + 64px);
    margin: -32px -32px 20px;
    aspect-ratio: 16/9;
    background: var(--bg-light);
    overflow: hidden;
}
.event-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.event-detail-status {
    position: absolute;
    top: 16px;
    left: 16px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 800;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.event-detail-desc {
    font-size: var(--text-base);
    color: var(--text-body);
    line-height: 1.6;
    margin-top: 8px;
}

/* =========================================
   Tier detail modal (membership card popup)
   ========================================= */
.tier-detail-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.tier-detail-card {
    display: grid;
    grid-template-columns: 1fr clamp(96px, 26%, 140px);
    gap: 16px;
    align-items: center;
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: white;
    transition: all var(--duration-fast);
}
.tier-detail-card.is-current {
    background: var(--primary-blue-10);
    border-color: var(--primary-blue);
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.08);
}

.tier-detail-body { min-width: 0; }

.tier-detail-medal {
    align-self: stretch;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tier-detail-medal model-viewer {
    width: 100%;
    height: 100%;
    min-height: 120px;
    background: transparent;
    --poster-color: transparent;
    --progress-bar-color: transparent;
    --progress-mask: transparent;
}

.tier-detail-head {
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.tier-detail-head h4 {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 2px;
}
.tier-detail-head p {
    font-size: var(--text-xs);
    color: var(--text-muted);
    font-weight: 600;
}
.tier-detail-now {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: var(--primary-blue);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    vertical-align: middle;
}
.tier-detail-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tier-detail-card li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--text-body);
}
.tier-detail-card li i {
    width: 16px;
    height: 16px;
    color: var(--primary-blue);
    flex-shrink: 0;
}

/* =========================================
   Avatar edit modal
   ========================================= */
.avatar-gradient-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
    margin: 16px 0 8px;
}
.avatar-swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
    padding: 0;
    box-shadow: var(--shadow-sm);
}
.avatar-swatch:hover { transform: scale(1.08); }
.avatar-swatch.selected {
    border-color: var(--text-dark);
    box-shadow: 0 0 0 3px white, 0 0 0 5px var(--primary-blue);
    transform: scale(1.05);
}
@media (max-width: 480px) {
    .avatar-gradient-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =========================================
   Sessions modal (active devices)
   ========================================= */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}
.session-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: white;
    transition: opacity var(--duration-fast);
}
.session-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-light);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.session-icon i { width: 20px; height: 20px; }
.session-info { flex: 1; min-width: 0; }
.session-info h4 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}
.session-info p {
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.session-now {
    display: inline-block;
    margin-left: 4px;
    padding: 1px 8px;
    background: #DCFCE7;
    color: #16A34A;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* =========================================
   Confirm modal
   ========================================= */
#confirm-modal .modal-content { padding: 32px 28px 24px; }
.confirm-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--primary-blue-10);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}
.confirm-icon i { width: 26px; height: 26px; }
.confirm-icon-danger {
    background: #FEE2E2;
    color: #DC2626;
}
#confirm-title {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}
#confirm-message {
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 22px;
}
.confirm-actions {
    display: flex;
    gap: 10px;
}
.confirm-actions .btn { flex: 1; justify-content: center; }

/* Responsive: stack tier list + reduce timeline density on phones */
@media (max-width: 600px) {
    .modal-content { padding: 24px; }
    .event-detail-image { width: calc(100% + 48px); margin: -24px -24px 16px; }
    .order-timeline { grid-template-columns: repeat(4, 1fr); gap: 4px; }
    .timeline-step span { font-size: 9px; }
    .modal-actions .btn { flex: 1 1 100%; }
}
