/* ===== CSS VARIABLES ===== */
:root {
  /* Primary */
  --purple: #8B5CF6;
  --pink: #EC4899;
  --cyan: #06B6D4;

  /* Supporting */
  --yellow: #FBBF24;
  --green: #10B981;
  --deep-purple: #6D28D9;
  --soft-white: #F9FAFB;
  --dark: #1F2937;
  --red: #EF4444;

  /* Grays */
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #8B5CF6, #EC4899);
  --gradient-secondary: linear-gradient(135deg, #06B6D4, #8B5CF6);
  --gradient-alert: linear-gradient(135deg, #FBBF24, #F97316);
  --gradient-bg: linear-gradient(135deg, #f5f3ff 0%, #fdf2f8 50%, #ecfeff 100%);

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(139, 92, 246, 0.08);
  --shadow-md: 0 4px 16px rgba(139, 92, 246, 0.12);
  --shadow-lg: 0 8px 32px rgba(139, 92, 246, 0.16);
  --shadow-glow: 0 0 24px rgba(139, 92, 246, 0.25);
}

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

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

body {
  font-family: 'Inter', 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--dark);
  background: var(--gradient-bg);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: var(--purple);
}

a:hover {
  color: var(--deep-purple);
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  font-size: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ===== LAYOUT ===== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
}

.container {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.card {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: 40px;
}

/* ===== TYPOGRAPHY ===== */
.logo {
  font-family: 'Poppins', 'Fredoka', sans-serif;
  font-size: 3.5rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.tagline {
  font-size: 1.2rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.heading {
  font-family: 'Poppins', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.subheading {
  font-size: 1.1rem;
  color: var(--gray-500);
  margin-bottom: 24px;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  width: 100%;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: white;
  color: var(--purple);
  border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
  border-color: var(--purple);
  background: var(--soft-white);
}

.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, 0.4);
}

.btn-gradient-cyan {
  background: var(--gradient-secondary);
  color: white;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}

.btn-gradient-cyan:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.4);
}

/* ===== FORM ELEMENTS ===== */
.input-field {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.input-field:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.input-field.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-field.success {
  border-color: var(--green);
}

textarea.input-field {
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

.password-wrapper {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
}

.password-toggle:hover {
  color: var(--purple);
}

.char-counter {
  text-align: right;
  font-size: 0.85rem;
  color: var(--gray-400);
  margin-top: 6px;
}

.char-counter.warning {
  color: #F97316;
}

.char-counter.limit {
  color: var(--red);
}

.helper-text {
  font-size: 0.85rem;
  color: #F59E0B;
  margin-top: 8px;
}

.error-text {
  font-size: 0.85rem;
  color: var(--red);
  margin-top: 8px;
}

/* ===== BADGES ===== */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
}

.badge-yellow { background: #F59E0B; }
.badge-purple { background: var(--purple); }
.badge-pink { background: var(--pink); }
.badge-green { background: var(--green); }
.badge-cyan { background: var(--cyan); }

/* ===== ALERT BOXES ===== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin: 16px 0;
}

.alert-warning {
  background: #FEF3C7;
  border-left: 4px solid #F59E0B;
  color: #92400E;
}

.alert-danger {
  background: #FEE2E2;
  border-left: 4px solid var(--red);
  color: #991B1B;
}

.alert-info {
  background: #DBEAFE;
  border-left: 4px solid #3B82F6;
  color: #1E40AF;
}

/* ===== OPTION CARDS (for selectors) ===== */
.option-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.option-card {
  border: 3px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.option-card:hover {
  border-color: var(--purple);
  background: #F5F3FF;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.option-card.active {
  border-color: var(--purple);
  background: #F5F3FF;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.option-card .icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.option-card .title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--purple);
  margin-bottom: 4px;
}

.option-card .subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
}

/* ===== PILLS (for expiration) ===== */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.pill {
  padding: 10px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-align: center;
  flex: 1;
  min-width: 0;
}

.pill:hover {
  border-color: var(--purple);
  background: #F5F3FF;
}

.pill.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.pill .pill-icon {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.pill .pill-label {
  display: block;
  font-weight: 700;
}

.pill .pill-sub {
  display: block;
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ===== SECTION LABELS ===== */
.section-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--dark);
  margin-bottom: 10px;
  margin-top: 24px;
}

/* ===== LINK DISPLAY ===== */
.link-box {
  background: var(--gray-100);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px 0;
}

.link-text {
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--purple);
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 12px;
}

.key-display {
  background: white;
  border: 3px dashed var(--purple);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  margin: 16px 0;
}

.key-value {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--purple);
  letter-spacing: 2px;
  background: var(--gray-100);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin: 8px 0;
}

/* ===== INSTRUCTIONS ===== */
.instructions {
  margin: 20px 0;
  padding: 20px;
  background: var(--soft-white);
  border-radius: var(--radius-md);
}

.instructions h3 {
  font-size: 1.05rem;
  color: var(--purple);
  margin-bottom: 12px;
}

.instructions ol {
  padding-left: 24px;
}

.instructions li {
  margin-bottom: 8px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.instructions .highlight {
  background: var(--purple);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
}

/* ===== BACK LINK ===== */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--gray-500);
  margin-bottom: 24px;
  transition: color 0.2s;
}

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

/* ===== BUTTON ROW ===== */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.btn-row .btn {
  flex: 1;
}

/* ===== LOADING SPINNER ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

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

/* ===== CODE PICKER ===== */
.picker-group {
  margin-bottom: 14px;
}

.picker-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 8px;
  font-weight: 500;
}

.picker-row {
  display: flex;
  gap: 10px;
}

.picker-chip {
  flex: 1;
  padding: 14px 8px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: white;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.picker-chip:hover {
  border-color: var(--purple);
  background: #F5F3FF;
  transform: translateY(-2px);
}

.picker-chip.selected {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
  transform: translateY(-2px);
}

.code-preview {
  text-align: center;
  padding: 16px;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 16px 0 12px;
  color: var(--gray-300);
  letter-spacing: 1px;
  transition: color 0.3s;
}

.code-preview:has(.active) {
  color: var(--purple);
}

.code-part {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}

.code-part.active.adj {
  background: rgba(139, 92, 246, 0.12);
  color: var(--purple);
}

.code-part.active.animal {
  background: rgba(236, 72, 153, 0.12);
  color: var(--pink);
}

.code-part.active.num {
  background: rgba(6, 182, 212, 0.12);
  color: var(--cyan);
}

.code-sep {
  color: var(--gray-400);
  margin: 0 2px;
}

.shuffle-btn {
  width: auto !important;
  margin: 0 auto !important;
  display: block !important;
  padding: 10px 24px !important;
  font-size: 0.9rem !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .page-wrapper {
    padding: 24px 16px;
  }

  .card {
    padding: 28px 20px;
  }

  .logo {
    font-size: 2.8rem;
  }

  .heading {
    font-size: 1.6rem;
  }

  .option-cards {
    grid-template-columns: 1fr;
  }

  .pill-row {
    flex-wrap: wrap;
  }

  .pill {
    flex: 0 0 calc(50% - 4px);
  }

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

  .picker-chip {
    padding: 12px 6px;
    font-size: 0.9rem;
  }

  .code-preview {
    font-size: 1.2rem;
  }
}
