/* ========== VARIABLES & RESET ========== */
:root {
  --orange: #FF6B35;
  --orange-dark: #E55A2B;
  --orange-light: #FF8C5A;
  --yellow: #FFB800;
  --green: #2ECC71;
  --green-dark: #27AE60;
  --blue: #3498DB;
  --purple: #9B59B6;
  --dark: #1A1A2E;
  --dark-2: #16213E;
  --gray: #6B7280;
  --gray-light: #F3F4F6;
  --white: #FFFFFF;
  --shadow: 0 10px 40px rgba(0,0,0,0.1);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.15);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--gray-light);
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-weight: 700;
}

/* ========== TOAST ========== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn 0.4s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
}

.toast.success { background: linear-gradient(135deg, var(--green), var(--green-dark)); }
.toast.error { background: linear-gradient(135deg, #E74C3C, #C0392B); }
.toast.info { background: linear-gradient(135deg, var(--blue), #2980B9); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-20px); }
}

/* ========== SECTIONS ========== */
.section {
  display: none;
  min-height: 100vh;
}

.section.active {
  display: block;
}

/* ========== AUTH SECTION ========== */
.auth-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #1A1A2E 0%, #16213E 40%, #0F3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.floating-shapes .shape {
  position: absolute;
  border-radius: 50%;
  opacity: 0.15;
  animation: float 8s ease-in-out infinite;
}

.shape-1 {
  width: 300px; height: 300px;
  background: var(--orange);
  top: -50px; left: -50px;
  animation-delay: 0s;
}

.shape-2 {
  width: 200px; height: 200px;
  background: var(--yellow);
  bottom: 10%; right: 10%;
  animation-delay: 2s;
}

.shape-3 {
  width: 150px; height: 150px;
  background: var(--green);
  top: 40%; left: 5%;
  animation-delay: 4s;
}

.shape-4 {
  width: 100px; height: 100px;
  background: var(--orange-light);
  top: 20%; right: 20%;
  animation-delay: 1s;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-30px) rotate(10deg); }
}

.auth-container {
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.brand {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  color: white;
  box-shadow: 0 8px 24px rgba(255,107,53,0.4);
}

.brand h1 {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--dark);
  margin-bottom: 4px;
}

.tagline {
  font-size: 18px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.subtitle {
  color: var(--gray);
  font-size: 14px;
  margin-top: 8px;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.auth-form h2 {
  font-size: 22px;
  margin-bottom: 24px;
  text-align: center;
}

.input-group {
  position: relative;
  margin-bottom: 16px;
}

.input-group i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
  font-size: 14px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 14px 16px 14px 44px;
  border: 2px solid #E5E7EB;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition);
  background: white;
  color: var(--dark);
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(255,107,53,0.15);
}

.input-group.large input {
  padding: 18px 16px 18px 50px;
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white;
  width: 100%;
  padding: 14px;
  box-shadow: 0 4px 16px rgba(255,107,53,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255,107,53,0.45);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-secondary {
  background: white;
  color: var(--dark);
  border: 2px solid #E5E7EB;
}

.btn-secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.btn-whatsapp {
  background: #25D366;
  color: white;
}

.btn-whatsapp:hover {
  background: #1EBE57;
  transform: translateY(-2px);
}

.btn-danger {
  background: #E74C3C;
  color: white;
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--gray);
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--gray-light);
  color: var(--orange);
}

.switch-form {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--gray);
}

.switch-form a {
  color: var(--orange);
  font-weight: 600;
  text-decoration: none;
}

.switch-form a:hover {
  text-decoration: underline;
}

.admin-hint {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--gray);
  background: #FEF3C7;
  padding: 8px 12px;
  border-radius: 8px;
}

.admin-hint code {
  background: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* ========== NAVBAR ========== */
.navbar {
  background: white;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 18px;
}

.nav-brand i {
  font-size: 24px;
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 20px;
}

.points-badge {
  background: linear-gradient(135deg, var(--orange), var(--yellow));
  color: white;
  padding: 8px 16px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(255,107,53,0.3);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* ========== DASHBOARD ========== */
.dashboard-container {
  display: flex;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 240px;
  background: white;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid #E5E7EB;
  flex-shrink: 0;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.side-btn:hover {
  background: #FFF5F0;
  color: var(--orange);
}

.side-btn.active {
  background: linear-gradient(135deg, rgba(255,107,53,0.12), rgba(255,184,0,0.12));
  color: var(--orange);
  font-weight: 600;
}

.side-btn i {
  width: 20px;
  text-align: center;
}

.main-content {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

/* ========== HOME ========== */
.welcome-card {
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white;
  padding: 32px;
  border-radius: var(--radius);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.welcome-card::after {
  content: '🍊';
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 80px;
  opacity: 0.3;
}

.welcome-card h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.welcome-card p {
  opacity: 0.9;
  font-size: 15px;
  max-width: 500px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
}

.stat-icon.orange { background: linear-gradient(135deg, var(--orange), var(--orange-dark)); }
.stat-icon.green { background: linear-gradient(135deg, var(--green), var(--green-dark)); }
.stat-icon.blue { background: linear-gradient(135deg, var(--blue), #2980B9); }
.stat-icon.purple { background: linear-gradient(135deg, var(--purple), #8E44AD); }

.stat-info h3 {
  font-size: 28px;
  color: var(--dark);
}

.stat-info p {
  font-size: 13px;
  color: var(--gray);
}

.quick-actions h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.action-card {
  background: white;
  border: 2px solid #E5E7EB;
  border-radius: var(--radius);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark);
}

.action-card i {
  font-size: 28px;
  color: var(--orange);
}

.action-card:hover {
  border-color: var(--orange);
  background: #FFF5F0;
  transform: translateY(-4px);
}

/* ========== PAGE HEADER ========== */
.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.page-header h2 i {
  color: var(--orange);
}

.page-header p {
  color: var(--gray);
  font-size: 14px;
}

/* ========== REDEEM ========== */
.redeem-card {
  background: white;
  border-radius: var(--radius);
  padding: 40px;
  box-shadow: var(--shadow);
  max-width: 480px;
  margin-bottom: 24px;
}

.redeem-card .btn {
  margin-top: 16px;
}

.info-box {
  background: #EFF6FF;
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 480px;
}

.info-box i {
  color: var(--blue);
  margin-top: 2px;
}

.info-box p {
  font-size: 14px;
  color: #1E40AF;
}

/* ========== REWARDS ========== */
.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.reward-card {
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.reward-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.reward-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reward-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.reward-icon.descuento { background: linear-gradient(135deg, var(--blue), #2980B9); }
.reward-icon.premio { background: linear-gradient(135deg, var(--orange), var(--yellow)); }
.reward-icon.experiencia { background: linear-gradient(135deg, var(--purple), #8E44AD); }

.reward-body {
  padding: 0 20px 16px;
  flex: 1;
}

.reward-body h3 {
  font-size: 16px;
  margin-bottom: 6px;
}

.reward-body p {
  font-size: 13px;
  color: var(--gray);
  line-height: 1.5;
}

.reward-footer {
  padding: 16px 20px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reward-cost {
  font-weight: 700;
  color: var(--orange);
  font-size: 16px;
}

.reward-cost i {
  margin-right: 4px;
}

.btn-claim {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-claim:hover {
  transform: scale(1.05);
}

.btn-claim:disabled {
  background: #D1D5DB;
  cursor: not-allowed;
  transform: none;
}

/* ========== REFERRALS ========== */
.referral-card {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.referral-bonus {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A);
  padding: 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.referral-bonus i {
  font-size: 32px;
  color: var(--yellow);
}

.referral-bonus h3 {
  font-size: 22px;
  color: #92400E;
}

.referral-bonus p {
  font-size: 14px;
  color: #A16207;
}

.referral-code-box label {
  font-size: 13px;
  color: var(--gray);
  font-weight: 500;
  display: block;
  margin-bottom: 8px;
}

.code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--gray-light);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.code-display span {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--orange);
  flex: 1;
}

.share-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.share-buttons .btn {
  flex: 1;
  min-width: 180px;
}

.referrals-list h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.empty-state {
  text-align: center;
  color: var(--gray);
  padding: 40px;
  background: white;
  border-radius: var(--radius);
  font-size: 14px;
}

.referral-item {
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.referral-item .name {
  font-weight: 600;
}

.referral-item .date {
  font-size: 12px;
  color: var(--gray);
}

.referral-item .badge {
  background: #D1FAE5;
  color: #065F46;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ========== HISTORY ========== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: white;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.history-icon.earn { background: var(--green); }
.history-icon.spend { background: var(--orange); }

.history-info {
  flex: 1;
}

.history-info .desc {
  font-weight: 500;
  font-size: 14px;
}

.history-info .date {
  font-size: 12px;
  color: var(--gray);
}

.history-amount {
  font-weight: 700;
  font-size: 16px;
}

.history-amount.positive { color: var(--green); }
.history-amount.negative { color: var(--orange); }

/* ========== ADMIN ========== */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.admin-tab-btn {
  padding: 10px 20px;
  border: 2px solid #E5E7EB;
  background: white;
  border-radius: 50px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--gray);
}

.admin-tab-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.admin-tab-btn.active {
  background: var(--orange);
  border-color: var(--orange);
  color: white;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.admin-form-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.admin-form-card h3 {
  margin-bottom: 20px;
  font-size: 18px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.form-row .input-group {
  flex: 1;
  min-width: 160px;
  margin-bottom: 0;
}

.form-row .btn {
  width: auto;
  white-space: nowrap;
  height: 50px;
}

.admin-table-card {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.admin-table-card h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #F3F4F6;
  font-size: 14px;
}

th {
  font-weight: 600;
  color: var(--gray);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  color: var(--dark);
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.active {
  background: #D1FAE5;
  color: #065F46;
}

.status-badge.used {
  background: #FEE2E2;
  color: #991B1B;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .dashboard-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid #E5E7EB;
  }

  .side-btn {
    white-space: nowrap;
    padding: 10px 14px;
    font-size: 13px;
  }

  .side-btn span {
    display: none;
  }

  .main-content {
    padding: 20px 16px;
  }

  .navbar {
    padding: 12px 16px;
  }

  .nav-brand span {
    display: none;
  }

  .auth-container {
    padding: 32px 24px;
  }

  .welcome-card::after {
    font-size: 50px;
  }

  .form-row {
    flex-direction: column;
  }

  .form-row .btn {
    width: 100%;
  }

  .share-buttons {
    flex-direction: column;
  }

  .share-buttons .btn {
    width: 100%;
  }
}
