/* ==========================================================================
   Moments Speciality Coffee - Digital Loyalty Card & Rewards Design System
   Matches existing brand identity: #8B4513, #F5E6DA, #CFAF83, #2C3E50
   ========================================================================== */

:root {
    --brand-primary: #8B4513;
    --brand-dark: #1E120A;
    --brand-espresso: #2A170C;
    --brand-mocha: #4A2711;
    --brand-gold: #C6925E;
    --brand-gold-light: #E0BA8F;
    --brand-gold-glow: rgba(198, 146, 94, 0.4);
    --brand-cream: #FDF9F5;
    --brand-sand: #F5E6DA;
    --brand-accent: #CFAF83;
    --text-dark: #2C3E50;
    --text-muted: #8C7A6B;
    --text-light: #FFFFFF;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --warning: #ED6C02;
    --warning-bg: #FFF3E0;
    --danger: #D32F2F;
    --danger-bg: #FFEBEE;
    --card-radius: 24px;
    --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-card: 0 16px 36px -8px rgba(30, 18, 10, 0.35), 0 0 0 1px rgba(198, 146, 94, 0.25);
    --shadow-gold: 0 8px 24px -4px rgba(198, 146, 94, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f7e6dc;
    color: var(--text-dark);
    min-height: 100vh;
    padding-bottom: 3rem;
    overflow-x: hidden;
    position: relative;
}

/* Background Atmosphere */
.loyalty-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 15% 15%, rgba(198, 146, 94, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(139, 69, 19, 0.12) 0%, transparent 50%),
        #f7e6dc;
    z-index: -2;
    pointer-events: none;
}

.loyalty-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 1.25rem 2.5rem;
    position: relative;
    z-index: 1;
}

/* Header & Navigation Bar */
.loyalty-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 0;
    margin-bottom: 0.75rem;
}

.nav-back, .nav-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: var(--brand-primary);
    text-decoration: none;
    border: 1px solid rgba(139, 69, 19, 0.12);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.nav-back:hover, .nav-action:hover {
    transform: translateY(-2px);
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.15);
}

.loyalty-brand-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.loyalty-brand-badge img {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.loyalty-brand-title {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--brand-espresso);
    text-transform: uppercase;
}

/* ==========================================================================
   Digital Loyalty Card - Luxury Espresso/Gold Theme
   ========================================================================== */
.membership-card-wrap {
    perspective: 1000px;
    margin-bottom: 1.75rem;
}

.membership-card {
    background: linear-gradient(145deg, #1f140e 0%, #2e1a10 50%, #150c07 100%);
    border-radius: var(--card-radius);
    padding: 1.6rem;
    color: #ffffff;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(198, 146, 94, 0.35);
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.membership-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 75% 25%, rgba(198, 146, 94, 0.18) 0%, transparent 60%);
    pointer-events: none;
}

/* Gold Metallic Header inside Card */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 2;
}

.card-title-group {
    display: flex;
    flex-direction: column;
}

.card-brand-subtitle {
    font-size: 0.72rem;
    letter-spacing: 2px;
    color: var(--brand-gold-light);
    text-transform: uppercase;
    font-weight: 600;
}

.card-brand-name {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
    margin-top: 2px;
}

.card-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(198, 146, 94, 0.15);
    color: var(--brand-gold-light);
    border: 1px solid rgba(198, 146, 94, 0.4);
}

.card-status-badge.unlocked {
    background: linear-gradient(135deg, #c6925e 0%, #a46d38 100%);
    color: #ffffff;
    box-shadow: 0 0 16px rgba(198, 146, 94, 0.6);
    border: none;
    animation: rewardPulse 2s infinite ease-in-out;
}

@keyframes rewardPulse {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.03); filter: brightness(1.2); }
}

/* Member Name & ID */
.card-member-info {
    margin-bottom: 1.4rem;
    position: relative;
    z-index: 2;
}

.member-display-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-number-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.3rem;
    font-size: 0.82rem;
    color: var(--brand-gold-light);
    font-family: 'SF Mono', 'Courier New', monospace;
}

.member-number {
    letter-spacing: 1.5px;
    font-weight: 600;
}

/* ==========================================================================
   The 5-Stamp Visual Grid (Buy 5, 6th FREE)
   ========================================================================== */
.stamps-tracker-container {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 18px;
    padding: 1.15rem 1rem;
    border: 1px solid rgba(198, 146, 94, 0.2);
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 2;
}

.stamps-tracker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
}

.stamps-count-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #d8c3b1;
}

.stamps-ratio-pill {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--brand-gold-light);
    background: rgba(198, 146, 94, 0.2);
    padding: 0.2rem 0.65rem;
    border-radius: 12px;
}

.stamps-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    align-items: center;
}

.stamp-slot {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.04);
    border: 2px dashed rgba(198, 146, 94, 0.3);
    color: rgba(198, 146, 94, 0.4);
    cursor: default;
}

.stamp-slot .stamp-icon {
    font-size: 1.1rem;
    transition: var(--transition-smooth);
}

.stamp-slot .stamp-num {
    font-size: 0.62rem;
    font-weight: 700;
    margin-top: 2px;
    opacity: 0.6;
}

/* Filled Stamp State */
.stamp-slot.filled {
    background: linear-gradient(135deg, #c6925e 0%, #8b4513 100%);
    border: 2px solid #e0ba8f;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(198, 146, 94, 0.4);
    animation: stampBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stamp-slot.filled .stamp-icon {
    color: #ffffff;
    transform: scale(1.05);
}

.stamp-slot.filled .stamp-num {
    opacity: 0.95;
    color: #ffffff;
}

@keyframes stampBounce {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* Next Stamp Pulse Highlight */
.stamp-slot.next-target {
    border-color: var(--brand-gold);
    border-style: solid;
    animation: nextStampGlow 2s infinite ease-in-out;
}

@keyframes nextStampGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(198, 146, 94, 0.4); }
    50% { box-shadow: 0 0 0 6px rgba(198, 146, 94, 0); }
}

/* Progress Text Feedback */
.stamps-feedback-text {
    margin-top: 0.75rem;
    font-size: 0.78rem;
    color: #cfaf83;
    text-align: center;
    font-weight: 500;
}

/* Card Footer */
.card-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    color: #8c7a6b;
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Unlocked Reward / 6th Free Drink Banner
   ========================================================================== */
.reward-unlock-banner {
    background: linear-gradient(135deg, #2a170c 0%, #4a2711 100%);
    border-radius: var(--card-radius);
    padding: 1.35rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(198, 146, 94, 0.5);
    box-shadow: var(--shadow-gold);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.reward-banner-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.reward-gift-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, #c6925e 0%, #8b4513 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.4rem;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(198, 146, 94, 0.4);
}

.reward-banner-text h3 {
    font-size: 1.05rem;
    color: #ffffff;
    font-weight: 700;
}

.reward-banner-text p {
    font-size: 0.8rem;
    color: var(--brand-gold-light);
    margin-top: 2px;
}

.btn-redeem-reward {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #c6925e 0%, #9e642e 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(198, 146, 94, 0.35);
    transition: var(--transition-smooth);
}

.btn-redeem-reward:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(198, 146, 94, 0.5);
    filter: brightness(1.08);
}

/* ==========================================================================
   Digital Wallet Buttons (Apple Wallet & Google Wallet)
   ========================================================================== */
.wallet-actions-section {
    margin-bottom: 1.75rem;
}

.section-label {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--brand-mocha);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.wallet-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.wallet-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    font-weight: 600;
    font-size: 0.82rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.wallet-btn-apple {
    background: #000000;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.wallet-btn-apple:hover {
    background: #1a1a1a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.wallet-btn-google {
    background: #ffffff;
    color: #1f1f1f;
    border: 1px solid #dadce0;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.wallet-btn-google:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Location & Proximity Card
   ========================================================================== */
.location-card-widget {
    background: #ffffff;
    border-radius: 18px;
    padding: 1.25rem;
    margin-bottom: 1.75rem;
    border: 1px solid rgba(139, 69, 19, 0.12);
    box-shadow: 0 8px 24px rgba(139, 69, 19, 0.06);
}

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

.location-widget-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--brand-espresso);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.location-distance-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-primary);
    background: var(--brand-sand);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
}

.location-branch-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-dark);
}

.location-branch-hours {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.location-actions-row {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.btn-location-action {
    flex: 1;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    border: 1px solid rgba(139, 69, 19, 0.15);
    background: #fdfaf7;
    color: var(--brand-primary);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-location-action.primary {
    background: var(--brand-primary);
    color: #ffffff;
    border-color: var(--brand-primary);
}

.btn-location-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.12);
}

/* ==========================================================================
   Activity Ledger & Recent History
   ========================================================================== */
.history-section {
    background: #ffffff;
    border-radius: 18px;
    padding: 1.25rem;
    border: 1px solid rgba(139, 69, 19, 0.12);
    box-shadow: 0 8px 24px rgba(139, 69, 19, 0.06);
    margin-bottom: 2rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f4e9e0;
}

.history-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.history-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-icon.earn { background: #e8f5e9; color: #2e7d32; }
.history-icon.redeem { background: #fff3e0; color: #e65100; }
.history-icon.reward_unlock { background: #fdf2e9; color: #c6925e; }

.history-details {
    flex: 1;
    margin-left: 0.75rem;
}

.history-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dark);
}

.history-date {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.history-badge {
    font-size: 0.82rem;
    font-weight: 700;
}

.history-badge.plus { color: #2e7d32; }
.history-badge.redeemed { color: #e65100; }

/* ==========================================================================
   Modals (Redemption QR Code, OTP Login, Wallet Setup)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 8, 4, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-sheet {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 24px;
    padding: 1.75rem;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.active .modal-sheet {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f4e9e0;
    border: none;
    color: var(--brand-mocha);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    background: #ebd7c8;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.modal-header h3 {
    font-size: 1.15rem;
    color: var(--brand-espresso);
    font-weight: 700;
}

.modal-header p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* QR Code Container */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: #ffffff;
    border-radius: 20px;
    border: 2px solid #f0e2d5;
    margin: 1rem 0;
}

.qr-canvas-box {
    padding: 10px;
    background: #ffffff;
    border-radius: 12px;
}

.qr-code-text {
    font-family: 'SF Mono', monospace;
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--brand-espresso);
    margin-top: 0.75rem;
}

.qr-expiry-timer {
    font-size: 0.76rem;
    color: var(--warning);
    font-weight: 600;
    margin-top: 0.3rem;
}

/* OTP Form Elements */
.otp-form-group {
    margin-bottom: 1.15rem;
}

.otp-form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--brand-espresso);
    margin-bottom: 0.4rem;
}

.phone-input-wrap {
    display: flex;
    border: 1.5px solid #d8c3b1;
    border-radius: 14px;
    overflow: hidden;
    background: #ffffff;
    transition: var(--transition-smooth);
}

.phone-input-wrap:focus-within {
    border-color: var(--brand-gold);
    box-shadow: 0 0 0 3px rgba(198, 146, 94, 0.2);
}

.phone-prefix {
    background: #f7ede5;
    color: var(--brand-primary);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.8rem 0.9rem;
    display: flex;
    align-items: center;
    border-right: 1px solid #e5d4c5;
}

.phone-input-wrap input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.8rem 0.9rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.btn-primary-action {
    width: 100%;
    padding: 0.9rem;
    border-radius: 14px;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 6px 16px rgba(139, 69, 19, 0.25);
}

.btn-primary-action:hover {
    background: #73380e;
    transform: translateY(-2px);
}

.btn-primary-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Toast Notification */
.toast-notice {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e120a;
    color: #ffffff;
    padding: 0.8rem 1.4rem;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(198, 146, 94, 0.4);
    z-index: 2000;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
    opacity: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-notice.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive adjustments */
@media (max-width: 380px) {
    .stamps-grid-5 {
        gap: 0.35rem;
    }
    .stamp-slot .stamp-icon {
        font-size: 0.95rem;
    }
    .wallet-btn {
        font-size: 0.74rem;
        padding: 0.75rem 0.6rem;
    }
}
