/**
 * WhatsApp Flow - Design System
 * Beautiful WhatsApp-themed UI
 */

:root {
  /* WhatsApp Colors */
  --whatsapp-green: #25D366;
  --whatsapp-dark: #128C7E;
  --whatsapp-darker: #075E54;
  --whatsapp-light: #DCF8C6;
  
  /* UI Colors */
  --text-primary: #1a202c;
  --text-secondary: #4a5568;
  --text-tertiary: #a0aec0;
  
  --success: #4bce97;
  --warning: #f5a623;
  --error: #eb5757;
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  max-width: 600px;
  margin: 20px auto;
  padding: 40px 24px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-height: auto;
}

/* Header */
.header {
  background: linear-gradient(135deg, var(--whatsapp-dark) 0%, var(--whatsapp-darker) 100%);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  color: white;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: white;
  text-decoration: none;
  font-size: 20px;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateX(-2px);
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  color: white;
  margin: 0 0 4px 0;
}

.header p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.status-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(75, 206, 151, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

/* Progress Steps */
.progress-container {
  margin-bottom: 24px;
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.step-number {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-tertiary);
  transition: all 0.3s;
}

.step.active .step-number {
  background: var(--whatsapp-green);
  border-color: var(--whatsapp-green);
  color: white;
}

.step.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.step.active .step-label {
  color: var(--whatsapp-green);
}

.step-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  margin-bottom: 20px;
}

/* Sections */
.setup-section,
.settings-section {
  background: #f8fafb;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: all 0.2s;
}

.setup-section:hover,
.settings-section:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.section-icon {
  font-size: 28px;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 2px solid #bbf7d0;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Inputs */
.input-group {
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.2s;
}

.input-group:focus-within {
  border-color: var(--whatsapp-green);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
}

.input-prefix {
  padding: 12px 16px;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-weight: 600;
  border-right: 2px solid #e2e8f0;
}

.input-field {
  flex: 1;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  outline: none;
}

.input-field::placeholder {
  color: #cbd5e1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-dark) 100%);
}

.btn-secondary {
  background: white;
  border: 2px solid #e2e8f0;
  color: var(--text-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  background: #f8fafb;
  border-color: var(--whatsapp-green);
  color: var(--whatsapp-green);
}

.btn-danger {
  background: var(--error);
  box-shadow: 0 4px 15px rgba(235, 87, 87, 0.3);
}

.btn-danger:hover {
  background: #d63031;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.btn-small {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-group .btn {
  flex: 1;
}

.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.action-buttons .btn {
  flex: 1;
}

.quick-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* Event Categories */
.event-category {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  overflow: hidden;
  transition: all 0.2s;
}

.event-category:hover {
  border-color: #cbd5e1;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  background: #f8fafb;
}

.category-header:hover {
  background: #f1f5f9;
}

.category-icon {
  font-size: 20px;
}

.category-title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.category-toggle {
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.category-content {
  display: none;
  padding: 12px 16px;
  border-top: 2px solid #e2e8f0;
  background: white;
}

.category-content.expanded {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

/* Event Items */
.event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafb;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  color: var(--text-primary);
}

.event-item:hover {
  background: #f1f5f9;
  transform: translateX(4px);
}

.event-item input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checkmark::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s;
}

.event-item input:checked + .checkmark {
  background: var(--whatsapp-green);
  border-color: var(--whatsapp-green);
}

.event-item input:checked + .checkmark::after {
  opacity: 1;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  border: 2px solid #cbd5e1;
  border-radius: 50px;
  transition: all 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--whatsapp-green);
  border-color: var(--whatsapp-green);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
  background: white;
}

/* Settings Items */
.setting-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f8fafb;
  border-radius: var(--radius-md);
  border: 2px solid #e2e8f0;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.setting-item:hover {
  border-color: #cbd5e1;
  transform: translateX(4px);
}

.setting-label {
  flex: 1;
  margin-right: 16px;
}

.setting-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.setting-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Status Card */
.status-card {
  background: #f8fafb;
  border-radius: var(--radius-md);
  padding: 16px;
}

.status-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.status-item:last-child {
  border-bottom: none;
}

.status-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.status-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Time Range */
.time-range {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.time-input {
  flex: 1;
}

.time-input label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.time-input input {
  width: 100%;
  padding: 10px 12px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
}

/* Help Box */
.help-box {
  background: rgba(37, 211, 102, 0.1);
  border: 2px solid rgba(37, 211, 102, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 16px;
}

.help-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--whatsapp-dark);
  margin-bottom: 6px;
}

.help-text {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.help-text code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-primary);
}

/* Help List */
.help-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.help-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  background: #f8fafb;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
}

.help-icon {
  font-size: 20px;
}

.help-item strong {
  display: block;
  color: var(--text-primary);
  font-size: 13px;
  margin-bottom: 4px;
}

.help-item span,
.help-item a {
  font-size: 12px;
  color: var(--text-secondary);
}

.help-item a {
  color: var(--whatsapp-green);
  text-decoration: none;
}

.help-item a:hover {
  text-decoration: underline;
}

/* Code Block */
.code-block {
  position: relative;
  background: #1a1a1a;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 12px;
  overflow-x: auto;
}

.code-block code {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 12px;
  color: #e0e0e0;
  line-height: 1.6;
}

.code-block .highlight {
  color: var(--whatsapp-green);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #333;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #e0e0e0;
  transition: all 0.2s;
}

.copy-btn:hover {
  background: #444;
}

/* Webhook URL Box */
.webhook-url-box {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.webhook-url-box .input-field {
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 13px;
}

/* Step Indicator */
.step-indicator {
  margin-bottom: 16px;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--whatsapp-green);
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

/* Alerts */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-top: 16px;
  font-size: 13px;
}

.alert-warning {
  background: rgba(245, 166, 35, 0.15);
  border: 2px solid rgba(245, 166, 35, 0.4);
  color: var(--warning);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: white;
  border: 2px solid var(--whatsapp-green);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-lg);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  animation: slideIn 0.3s ease;
  max-width: 320px;
}

.toast.show {
  display: flex;
}

@keyframes slideIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-icon {
  font-size: 24px;
}

.toast-message {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px 0;
  margin-top: 20px;
}

.footer p {
  font-size: 12px;
  color: var(--text-tertiary);
}

.footer a {
  color: var(--whatsapp-green);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Hidden */
.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 480px) {
  .app-container {
    padding: 12px;
  }
  
  .header {
    padding: 16px;
  }
  
  .header h1 {
    font-size: 18px;
  }
  
  .setup-section,
  .settings-section {
    padding: 16px;
  }
  
  .category-content.expanded {
    grid-template-columns: 1fr;
  }
  
  .btn-group {
    flex-direction: column;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .time-range {
    flex-direction: column;
  }
}
