/* ============================================
   CSS VARIABLES (matching main site)
============================================= */
:root {
  --primary: #9c0000;
  --primary-dark: #7a0000;
  --primary-light: #c4302b;
  --secondary: #D4A574;
  --secondary-light: #e8c9a0;
  --cream: #FDF8F3;
  --warm-white: #F5E6D3;
  --dark-coffee: #2C1810;
  --medium-brown: #5C3D2E;
  --card-white: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(44, 24, 16, 0.08);
  --shadow-md: 0 4px 20px rgba(44, 24, 16, 0.12);
  --shadow-lg: 0 8px 40px rgba(44, 24, 16, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Montserrat', 'Segoe UI', sans-serif;
  --font-accent: 'Dancing Script', cursive;

  /* Tier colors */
  --tier-bronce: #CD7F32;
  --tier-plata: #C0C0C0;
  --tier-oro: #FFD700;
  --tier-platino: #E5E4E2;

  /* Status colors */
  --status-active: #22c55e;
  --status-redeemed: #6b7280;
  --status-expired: #ef4444;
}

/* ============================================
   RESET & BASE
============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--dark-coffee);
  background-color: var(--cream);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   HEADER
============================================= */
.rw-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card-white);
  border-bottom: 1px solid rgba(44, 24, 16, 0.08);
  box-shadow: var(--shadow-sm);
}

.rw-header-logo {
  text-decoration: none;
  color: var(--primary);
}

.rw-header-logo .logo-text {
  font-family: var(--font-accent);
  font-size: 1.5rem;
  font-weight: 700;
}

.rw-header-action {
  background: none;
  border: none;
  color: var(--medium-brown);
  font-size: 1.1rem;
  padding: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.rw-header-action:hover {
  color: var(--primary);
  background: rgba(156, 0, 0, 0.06);
}

/* ============================================
   MAIN CONTAINER
============================================= */
.rw-main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 32px;
}

/* ============================================
   LOGIN VIEW
============================================= */
.rw-login-card {
  background: var(--card-white);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  text-align: center;
  margin-top: 24px;
}

.rw-login-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
}

.rw-login-card h1 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  color: var(--dark-coffee);
  margin-bottom: 4px;
}

.rw-login-subtitle {
  font-size: 0.85rem;
  color: var(--medium-brown);
  margin-bottom: 24px;
}

/* Tabs */
.rw-tabs {
  display: flex;
  gap: 4px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 20px;
}

.rw-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--medium-brown);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.rw-tab.active {
  background: var(--card-white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Forms */
.rw-form {
  text-align: left;
}

.rw-form-hint {
  font-size: 0.8rem;
  color: var(--medium-brown);
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.5;
}

.rw-field {
  margin-bottom: 16px;
}

.rw-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--medium-brown);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rw-field input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(44, 24, 16, 0.15);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--dark-coffee);
  background: var(--card-white);
  transition: var(--transition);
  -webkit-appearance: none;
}

.rw-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(156, 0, 0, 0.1);
}

.rw-field input::placeholder {
  color: rgba(44, 24, 16, 0.3);
}

.rw-pin-container {
  position: relative;
}

.rw-pin-container input {
  letter-spacing: 8px;
  text-align: center;
  font-size: 1.3rem;
}

/* Buttons */
.rw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.rw-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.rw-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.rw-btn-primary:active {
  transform: translateY(0);
}

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

.rw-btn-outline {
  background: transparent;
  color: var(--medium-brown);
  border: 1.5px solid rgba(44, 24, 16, 0.2);
}

.rw-btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.rw-btn-sm {
  padding: 10px 16px;
  font-size: 0.8rem;
}

/* Privacy notice */
.rw-privacy {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(44, 24, 16, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rw-privacy-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.72rem;
  color: var(--medium-brown);
  line-height: 1.45;
  text-align: left;
}

.rw-privacy-item i {
  flex-shrink: 0;
  margin-top: 1px;
  font-size: 0.7rem;
  color: var(--secondary);
}

.rw-error {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-size: 0.8rem;
  text-align: center;
}

/* ============================================
   PROFILE CARD
============================================= */
.rw-profile-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  color: white;
  box-shadow: var(--shadow-lg);
  margin-bottom: 16px;
}

.rw-profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.rw-profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 700;
}

.rw-profile-info h2 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
}

.rw-tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.2);
}

.rw-tier-badge.tier-bronce { background: var(--tier-bronce); color: #fff; }
.rw-tier-badge.tier-plata { background: var(--tier-plata); color: #333; }
.rw-tier-badge.tier-oro { background: var(--tier-oro); color: #333; }
.rw-tier-badge.tier-platino { background: var(--tier-platino); color: #333; }

.rw-points-display {
  text-align: center;
  margin-bottom: 16px;
}

.rw-points-number {
  font-family: var(--font-heading);
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1;
}

.rw-points-label {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-top: 4px;
}

.rw-stats-row {
  display: flex;
  gap: 12px;
}

.rw-stat {
  flex: 1;
  text-align: center;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
}

.rw-stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
}

.rw-stat-label {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* Next tier progress */
.rw-next-tier {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.rw-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 6px;
  opacity: 0.9;
}

.rw-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.rw-progress-fill {
  height: 100%;
  background: var(--secondary);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ============================================
   NAV TABS
============================================= */
.rw-nav-tabs {
  display: flex;
  gap: 4px;
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.rw-nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--medium-brown);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.rw-nav-tab.active {
  background: var(--primary);
  color: white;
}

.rw-nav-tab i {
  font-size: 0.9rem;
}

/* ============================================
   REWARDS GRID
============================================= */
.rw-rewards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.rw-reward-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: var(--transition);
}

.rw-reward-card:active {
  transform: scale(0.98);
}

.rw-reward-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--secondary-light), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 1.3rem;
}

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

.rw-reward-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.3;
  margin-bottom: 2px;
}

.rw-reward-desc {
  font-size: 0.75rem;
  color: var(--medium-brown);
  line-height: 1.4;
}

.rw-reward-points {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 3px 8px;
  background: rgba(156, 0, 0, 0.06);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.rw-reward-action {
  flex-shrink: 0;
}

.rw-reward-action .rw-btn {
  width: auto;
  padding: 10px 16px;
  font-size: 0.75rem;
}

.rw-reward-action .rw-btn:disabled {
  background: rgba(44, 24, 16, 0.1);
  color: var(--medium-brown);
}

/* ============================================
   COUPON FILTERS
============================================= */
.rw-coupon-filters {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.rw-coupon-filters::-webkit-scrollbar {
  display: none;
}

.rw-filter {
  flex-shrink: 0;
  padding: 7px 14px;
  border: 1.5px solid rgba(44, 24, 16, 0.12);
  border-radius: 20px;
  background: var(--card-white);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--medium-brown);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.rw-filter.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ============================================
   COUPONS LIST
============================================= */
.rw-coupons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rw-coupon-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.rw-coupon-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
}

.rw-coupon-card.status-ACTIVE::before { background: var(--status-active); }
.rw-coupon-card.status-REDEEMED::before { background: var(--status-redeemed); }
.rw-coupon-card.status-EXPIRED::before { background: var(--status-expired); }

.rw-coupon-body {
  padding: 14px 16px 14px 20px;
}

.rw-coupon-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.rw-coupon-product {
  font-weight: 600;
  font-size: 0.9rem;
}

.rw-coupon-status {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 20px;
}

.rw-coupon-status.status-ACTIVE {
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
}

.rw-coupon-status.status-REDEEMED {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.rw-coupon-status.status-EXPIRED {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.rw-coupon-code {
  display: inline-block;
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  background: rgba(156, 0, 0, 0.05);
  padding: 6px 12px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.rw-coupon-meta {
  font-size: 0.7rem;
  color: var(--medium-brown);
  display: flex;
  gap: 12px;
}

.rw-coupon-meta i {
  margin-right: 3px;
}

/* ============================================
   INFO / HOW-TO SECTION
============================================= */
.rw-info-card {
  background: var(--card-white);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.rw-info-card h3 {
  font-family: var(--font-heading);
  font-size: 1rem;
  color: var(--dark-coffee);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rw-info-card h3 i {
  color: var(--primary);
  font-size: 0.95rem;
}

.rw-info-desc {
  font-size: 0.8rem;
  color: var(--medium-brown);
  margin-bottom: 14px;
  line-height: 1.5;
}

.rw-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rw-info-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: var(--dark-coffee);
}

.rw-info-list li i {
  color: var(--secondary);
  margin-top: 2px;
  font-size: 0.8rem;
  flex-shrink: 0;
  width: 16px;
  text-align: center;
}

.rw-info-steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rw-info-steps li {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.rw-info-steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tiers list */
.rw-tiers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rw-tier-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--cream);
  border-radius: var(--radius-sm);
}

.rw-tier-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(44, 24, 16, 0.1);
}

.rw-tier-name {
  font-weight: 600;
  font-size: 0.85rem;
  flex: 1;
}

.rw-tier-req {
  font-size: 0.75rem;
  color: var(--medium-brown);
}

/* ============================================
   EMPTY & LOADING STATES
============================================= */
.rw-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--medium-brown);
}

.rw-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.rw-empty p {
  font-size: 0.85rem;
}

.rw-loading {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.rw-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(156, 0, 0, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   MODAL
============================================= */
.rw-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.rw-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.rw-modal-content {
  position: relative;
  background: var(--card-white);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px;
  width: 100%;
  max-width: 480px;
  text-align: center;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.rw-modal-content h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.rw-modal-content p {
  font-size: 0.85rem;
  color: var(--medium-brown);
  margin-bottom: 24px;
  line-height: 1.5;
}

.rw-modal-actions {
  display: flex;
  gap: 10px;
}

.rw-modal-actions .rw-btn {
  flex: 1;
}

/* ============================================
   TOAST
============================================= */
.rw-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--dark-coffee);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.rw-toast.success {
  background: #16a34a;
}

.rw-toast.error {
  background: #dc2626;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ============================================
   UTILITIES
============================================= */
.rw-view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   RESPONSIVE (larger phones)
============================================= */
@media (min-width: 400px) {
  .rw-rewards-grid {
    gap: 14px;
  }

  .rw-reward-card {
    padding: 18px;
  }
}

/* Small phones */
@media (max-width: 360px) {
  .rw-main {
    padding: 12px;
  }

  .rw-profile-card {
    padding: 20px 16px;
  }

  .rw-points-number {
    font-size: 2.2rem;
  }

  .rw-login-card {
    padding: 24px 16px;
  }
}
