/* ========================================
   LOYALTYHOOK REGISTRATION - ENHANCED UI
   Modern, clean design inspired by best practices
   ======================================== */

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

:root {
  /* Primary Colors */
  --primary: #2d7a5f;
  --primary-light: #3a9b7a;
  --primary-dark: #1f5945;
  --primary-hover: #236650;

  /* Accent Colors */
  --accent-success: #10b981;
  --accent-error: #ef4444;
  --accent-warning: #f59e0b;
  --accent-info: #3b82f6;

  /* Neutral Colors */
  --white: #ffffff;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #e0f2f1 0%, #f0f4f8 100%);
  color: var(--gray-900);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  line-height: 1.6;
}

/* ========================================
   CONTAINER & CARD
   ======================================== */
.container {
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  max-width: 460px;
  width: 100%;
  overflow: hidden;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   HEADER
   ======================================== */
.header {
  background: linear-gradient(135deg, #2d7a5f 0%, #3a9b7a 100%);
  color: white;
  padding: 40px 28px 36px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
}

.header h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
  position: relative;
  z-index: 1;
}

.header p {
  font-size: 15px;
  opacity: 0.92;
  font-weight: 400;
  position: relative;
  z-index: 1;
}

/* ========================================
   CONTENT & SCREENS
   ======================================== */
.content {
  padding: 32px 28px 36px;
  background: var(--white);
}

.screen {
  display: none;
  animation: fadeSlide 0.3s ease-out;
}

.screen.active {
  display: block;
}

@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--gray-900);
  letter-spacing: -0.3px;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.subtitle {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ========================================
   STEP INDICATOR
   ======================================== */
.step-indicator {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 32px;
}

.step-dot {
  height: 6px;
  width: 6px;
  border-radius: var(--radius-full);
  background: var(--gray-300);
  transition: var(--transition);
}

.step-dot.active {
  width: 24px;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 122, 95, 0.15);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.btn {
  padding: 13px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--gray-900);
  color: white;
  box-shadow: var(--shadow);
}

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

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 1.5px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ========================================
   FORM INPUTS
   ======================================== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--gray-700);
}

input[type="text"],
input[type="tel"],
input[type="password"],
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--gray-900);
  transition: var(--transition);
  font-family: inherit;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 122, 95, 0.08);
}

input::placeholder {
  color: var(--gray-400);
}

.input-hint {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 6px;
}

input[type="password"] {
  letter-spacing: 2px;
}

/* ========================================
   ERROR & SUCCESS MESSAGES
   ======================================== */
.error-message {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #dc2626;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
  animation: shake 0.4s ease-in-out;
}

.error-message.show {
  display: block;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}

.success-message {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
  color: #166534;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 16px;
  animation: slideDown 0.3s ease-out;
}

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

/* ========================================
   INFO BOX & SHOP CARD
   ======================================== */
.info-box,
.shop-card {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  border: 1px solid var(--gray-200);
}

.info-box h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--gray-900);
}

.shop-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
}

.info-box p {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 8px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.shop-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-info-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-700);
}

.shop-info-item span:first-child {
  font-weight: 500;
  color: var(--gray-600);
}

.reward-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-weight: 600;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

/* ========================================
   CONSENT SUMMARY
   ======================================== */
.consent-summary {
  padding: 20px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.consent-summary h4 {
  margin: 0 0 16px 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.consent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  color: var(--gray-700);
}

.consent-item .icon {
  width: 20px;
  height: 20px;
  background: var(--accent-success);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ========================================
   CHECKBOXES
   ======================================== */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: 1.5px solid transparent;
}

.checkbox-item:hover {
  background: #f3f9f6;
  border-color: var(--primary-light);
}

.checkbox-item.checked {
  background: #f0fdf4;
  border-color: var(--primary);
}

.checkbox-item input[type="checkbox"] {
  margin-right: 12px;
  margin-top: 2px;
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-item input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-content {
  flex: 1;
}

.checkbox-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  display: block;
  margin-bottom: 4px;
}

.checkbox-description {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.5;
  display: block;
}

.required-badge,
.optional-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.3px;
}

.required-badge {
  background: var(--accent-error);
  color: white;
}

.optional-badge {
  background: var(--gray-400);
  color: white;
}

/* ========================================
   OTP INPUTS
   ======================================== */
.otp-input-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
}

.otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: var(--gray-900);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: var(--transition);
  font-family: inherit;
}

.otp-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45, 122, 95, 0.1);
  outline: none;
}

.timer {
  text-align: center;
  font-size: 14px;
  color: var(--gray-600);
  margin: 16px 0 20px;
  font-weight: 500;
}

.timer strong {
  color: var(--primary);
  font-weight: 600;
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.2s;
  font-family: inherit;
}

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

.link-button:disabled {
  color: var(--gray-400);
  cursor: not-allowed;
  text-decoration: none;
}

/* ========================================
   SUCCESS SCREEN
   ======================================== */
.success-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 24px;
  background: var(--accent-success);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: white;
  animation: scaleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.25);
}

@keyframes scaleIn {
  0% {
    transform: scale(0);
  }
  60% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* ========================================
   BACK BUTTON
   ======================================== */
.back-button {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  font-family: inherit;
}

.back-button:hover {
  color: var(--primary-dark);
  gap: 8px;
}

.back-button::before {
  content: "←";
  font-size: 16px;
}

/* ========================================
   HELP MODAL - FIXED
   ======================================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal.show {
  display: flex;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h2 {
  padding: 24px 24px 20px;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  border-bottom: 1px solid var(--gray-200);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--gray-100);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  color: var(--gray-600);
  line-height: 1;
  font-weight: 400;
}

.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-900);
}

.help-section {
  padding: 20px 24px;
}

.help-item {
  padding: 16px;
  margin-bottom: 12px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

.help-item:last-child {
  margin-bottom: 0;
}

.help-item.expandable {
  cursor: default;
  padding: 0;
  transition: var(--transition);
}

.help-item.expandable:hover {
  border-color: var(--gray-300);
}

.help-item.expandable.expanded {
  border-color: var(--primary);
  background: white;
}

.help-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
}

.help-item-header:hover {
  background: var(--white);
}

.help-item.expandable.expanded .help-item-header {
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.help-item-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
}

.expand-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-600);
  transition: var(--transition);
  flex-shrink: 0;
}

.help-item.expandable.expanded .expand-icon {
  background: var(--primary);
  color: white;
  transform: rotate(180deg);
}

.help-item-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.help-item.expandable.expanded .help-item-content {
  max-height: 1000px;
  padding: 16px;
}

.help-item-content p {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 12px;
}

.help-item-content p:last-child {
  margin-bottom: 0;
}

.help-item-content p strong {
  color: var(--gray-900);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.help-item p {
  font-size: 14px;
  color: var(--gray-700);
  line-height: 1.6;
}

.help-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.help-item a:hover {
  text-decoration: underline;
}

/* ========================================
   SHOP SELECTION - BEAUTIFUL CARD LIST
   ======================================== */

.shop-selection-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 24px 0;
}

.shop-selection-card {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1.5px solid var(--gray-200);
  transition: all 0.25s ease;
  position: relative;
}

.shop-selection-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.shop-selection-card.main-branch {
  border-color: var(--primary);
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
}

/* Header */
.shop-card-header {
  padding: 18px 20px 14px;
  background: var(--gray-50);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.shop-card-header h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: inherit;
}

.main-branch-badge,
.sub-branch-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.5px;
}

.main-branch-badge {
  background: #fbbf24;
  color: #451a03;
  box-shadow: 0 2px 6px rgba(251, 191, 36, 0.3);
}

.sub-branch-badge {
  background: var(--gray-300);
  color: var(--gray-700);
}

/* Body */
.shop-card-body {
  padding: 16px 20px;
}

.shop-info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 14.5px;
}

.shop-info-row:last-child {
  margin-bottom: 0;
}

.info-label {
  color: var(--gray-600);
  font-weight: 500;
}

.info-value {
  color: var(--gray-900);
  font-weight: 600;
}

/* Button */
.shop-selection-card .select-shop-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  font-size: 15.5px;
  font-weight: 600;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border: none;
}

.shop-selection-card.main-branch .select-shop-btn {
  background: var(--primary);
  color: white;
}

.shop-selection-card:not(.main-branch) .select-shop-btn {
  background: var(--gray-900);
  color: white;
}

.shop-selection-card .select-shop-btn:hover {
  opacity: 0.92;
  transform: scale(1.01);
}

/* Loading state inside card button */
.shop-selection-card .select-shop-btn:disabled {
  background: var(--gray-500) !important;
  cursor: not-allowed;
}

/* Optional: Add a subtle icon to main branch */
.main-branch-badge::before {
  content: "★";
  margin-right: 4px;
  font-size: 13px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 480px) {
  body {
    padding: 0;
    align-items: flex-start;
  }

  .container {
    border-radius: 0;
    min-height: 100vh;
    max-width: 100%;
  }

  .content {
    padding: 28px 20px 32px;
  }

  .otp-input {
    width: 44px;
    height: 52px;
    font-size: 20px;
  }

  h2 {
    font-size: 22px;
  }

  .header h1 {
    font-size: 28px;
  }

  .modal-content {
    border-radius: var(--radius-lg);
    margin: 0 12px;
  }
}

/* ========================================
   LOADING STATES
   ======================================== */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading {
  pointer-events: none;
  opacity: 0.6;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}
