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

:root {
  --primary: #111111;
  --primary-dark: #000000;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(108, 60, 225, 0.1);
  --shadow-lg: 0 8px 40px rgba(108, 60, 225, 0.15);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===========================
   PUBLIC PAGE
   =========================== */
.public-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem 4rem;
  background: #f5f5f5;
}

.container {
  width: 100%;
  max-width: 480px;
}

.hero-card {
  background: white;
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.brand {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
  background-image: 
    linear-gradient(160deg, rgba(108,60,225,0.88) 0%, rgba(50,20,140,0.92) 100%),
    var(--brand-bg-image, none);
  background-size: cover;
  background-position: center;
  padding: 3rem 2rem 2.5rem;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

/* Círculos decorativos de fondo */
.brand::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}

.brand::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -40px;
  width: 260px; height: 260px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
}

.brand > * { position: relative; z-index: 1; }

.brand-logo {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  border: 3px solid rgba(255,255,255,0.3);
}

.brand-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.brand h1 {
  font-size: 1.9rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.brand p {
  opacity: 0.85;
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.75rem;
}

/* ===========================
   FORMS
   =========================== */
.register-section, .card-display {
  padding: 2rem;
}

.register-section h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.register-section p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: white;
  color: var(--text);
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* ===========================
   BUTTONS
   =========================== */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 60, 225, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: all 0.15s;
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
  border: none;
  padding: 0.85rem 1.5rem;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-copy {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

/* ===========================
   LOYALTY CARD
   =========================== */
.loyalty-card {
  background: linear-gradient(135deg, var(--card-color, #6C3CE1), color-mix(in srgb, var(--card-color, #6C3CE1) 70%, #000));
  border-radius: 20px;
  padding: 1.5rem;
  color: white;
  margin: 1rem 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.loyalty-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}

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

.card-business {
  font-weight: 700;
  font-size: 1.1rem;
}

.card-code {
  font-size: 0.8rem;
  opacity: 0.8;
  font-family: monospace;
  letter-spacing: 1px;
}

.stamps-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.stamp {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid rgba(255,255,255,0.3);
  transition: all 0.3s;
}

.stamp.filled {
  background: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.9);
  color: var(--card-color, #6C3CE1);
  font-size: 0.9rem;
}

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

.progress-text {
  font-size: 0.8rem;
  opacity: 0.85;
}

.reward-badge {
  background: rgba(255,255,255,0.2);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,0.3);
}

/* ===========================
   WALLET BUTTONS
   =========================== */
.wallet-buttons {
  margin-top: 1.5rem;
  text-align: center;
}

.wallet-buttons p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0.25rem;
  transition: all 0.15s;
}

.wallet-btn svg { width: 18px; height: 18px; }

.wallet-btn.apple {
  background: #000;
  color: white;
}

.wallet-btn.google {
  background: #1a73e8;
  color: white;
}

.wallet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

/* ===========================
   ALERTS
   =========================== */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ===========================
   CARD URL INPUT
   =========================== */
.card-link-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.card-link-section p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card-url {
  display: flex;
  gap: 0.5rem;
}

.card-url input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg);
}

/* ===========================
   QR CODE
   =========================== */
.qr-section {
  text-align: center;
  margin: 1.5rem 0;
  padding: 1.5rem;
  background: var(--bg);
  border-radius: 16px;
}

.qr-section p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.qr-code svg {
  width: 160px;
  height: 160px;
}

.code-text {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary);
  margin-top: 0.75rem;
}

/* ===========================
   MOTIVATION TEXT
   =========================== */
.motivation {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.motivation.celebration {
  color: var(--success);
  font-weight: 600;
  font-size: 1rem;
}

/* ===========================
   HISTORY
   =========================== */
.history-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.history-section h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.h-icon { font-size: 1.1rem; }
.h-text { flex: 1; }
.h-text em { color: var(--text-muted); }
.h-date { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }

/* ===========================
   WALLET INSTRUCTIONS
   =========================== */
.wallet-instructions { padding: 2rem; }

.steps-card {
  background: #f8f9fa;
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1.5rem 0;
}

.steps-card h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
}

.steps-card.android { background: #e8f4fd; }

.step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.9rem;
}

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

/* ===========================
   ADMIN LOGIN
   =========================== */
.admin-login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-container {
  width: 100%;
  padding: 1rem;
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 2.5rem;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.login-card > p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.back-link {
  display: block;
  margin-top: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.back-link:hover { color: var(--primary); }

/* ===========================
   INFO BOXES (settings)
   =========================== */
.info-box {
  background: #f8f9ff;
  border: 1px solid #ddd6ff;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1rem 0;
}

.info-box h3 { margin-bottom: 0.5rem; }
.info-box p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.info-box ol { padding-left: 1.25rem; }
.info-box ol li { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.4rem; }

.info-tip {
  background: #fffbeb;
  border-color: #fde68a;
}

.install-steps {
  padding-left: 1.5rem;
}

.install-steps li {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.config-table { margin-top: 1rem; }

.config-row {
  display: flex;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 1rem;
}

.config-key { font-weight: 500; width: 180px; flex-shrink: 0; }
.config-val { color: var(--text-muted); }

/* ===========================
   FIND CARD (opción secundaria)
   =========================== */
.find-card-section {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.find-divider {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1rem;
  position: relative;
}

.find-divider::before,
.find-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 28%;
  height: 1px;
  background: var(--border);
}

.find-divider::before { left: 0; }
.find-divider::after  { right: 0; }

.find-form {}

.find-row {
  display: flex;
  gap: 0.5rem;
}

.find-row input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, background 0.2s;
}

.find-row input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.btn-find {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  letter-spacing: 0.2px;
}

.btn-find:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108,60,225,0.3);
}

.hint-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  text-align: center;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 600px) {
  .public-page { padding: 0; }
  .hero-card { border-radius: 0; min-height: 100vh; }
  .stamps-grid { grid-template-columns: repeat(5, 1fr); gap: 0.35rem; }
  .wallet-btn { display: flex; margin: 0.25rem 0; width: 100%; justify-content: center; }
  .wallet-buttons { text-align: center; }
}
