/* Modern Professional Theme */
:root {
  /* Brand Colors */
  --brand-primary: #00A884;
  /* WhatsApp Web Green */
  --brand-secondary: #005C4B;
  --brand-accent: #25D366;

  /* Backgrounds */
  --bg-app: #111B21;
  /* WhatsApp Deep Dark */
  --bg-panel: #202C33;
  /* Panel Background */
  --bg-subtle: #2A3942;
  /* Hover/Input Background */
  --bg-modal: #3B4A54;

  /* Text */
  --text-primary: #E9EDEF;
  --text-secondary: #8696A0;
  --text-muted: #54656F;
  --text-on-brand: #FFFFFF;

  /* State */
  --state-success: #00A884;
  --state-warning: #FFD279;
  --state-error: #F15C6D;
  --state-info: #53BDEB;

  /* UI Elements */
  --border-subtle: rgba(134, 150, 160, 0.15);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(17, 27, 33, 0.6);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2.5rem;
}

/* Base & Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* Layout */
.app-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  transition: all 0.3s ease;
}

.status-connected .status-dot {
  background-color: var(--brand-primary);
  box-shadow: 0 0 8px rgba(0, 168, 132, 0.4);
}

.status-qr_ready .status-dot {
  background-color: var(--state-warning);
  box-shadow: 0 0 8px rgba(255, 210, 121, 0.4);
}

.status-connecting .status-dot {
  background-color: var(--state-info);
  animation: pulse 1.5s infinite;
}

.status-disconnected .status-dot {
  background-color: var(--state-error);
}

.status-label {
  color: var(--text-primary);
}

/* Cards */
.card {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-bottom: var(--space-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(134, 150, 160, 0.3);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.card-title i,
.card-title svg {
  color: var(--brand-primary);
  font-size: 1.25em;
}

.card-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.card-body {
  padding: var(--space-lg);
}

/* QR Section */
.qr-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
}

.qr-code-wrapper {
  background: white;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.2);
}

.qr-code-img {
  display: block;
  width: 264px;
  height: 264px;
}

.instruction-list {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 2;
  counter-reset: item;
  list-style-type: none;
}

.instruction-list li {
  position: relative;
  padding-left: var(--space-xl);
}

.instruction-list li::before {
  counter-increment: item;
  content: counter(item);
  position: absolute;
  left: 0;
  top: 6px;
  background: var(--bg-subtle);
  color: var(--text-primary);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.instruction-list strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9rem;
}

.text-input {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}

.text-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
}

.char-counter {
  display: block;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* File Dropzone */
.file-dropzone {
  position: relative;
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  transition: all 0.2s ease;
  background: var(--bg-app);
  cursor: pointer;
}

.file-dropzone:hover,
.file-dropzone.drag-active {
  border-color: var(--brand-primary);
  background: rgba(0, 168, 132, 0.05);
}

.dropzone-content {
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
}

.dropzone-icon {
  font-size: 2.5rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.dropzone-text {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.dropzone-subtext {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-selected-info {
  margin-top: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(0, 168, 132, 0.1);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.9rem;
  color: var(--brand-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: var(--text-on-brand);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--brand-secondary);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

/* Progress Area */
.progress-area {
  margin-top: var(--space-xl);
  padding: var(--space-lg);
  background: var(--bg-app);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  font-size: 0.95rem;
  font-weight: 500;
}

.progress-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.progress-fill {
  height: 100%;
  background: var(--brand-primary);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: var(--radius-pill);
}

.progress-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* Code Snippets */
.snippet {
  background: var(--bg-app);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  margin: var(--space-sm) 0;
  display: block;
}

/* Footer */
.app-footer {
  margin-top: auto;
  text-align: center;
  padding-top: var(--space-xl);
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Animations */
@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 1;
  }
}

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

.spinner-icon {
  animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 640px) {
  .app-container {
    padding: var(--space-md);
  }

  .card-body {
    padding: var(--space-md);
  }

  .qr-code-img {
    width: 100%;
    height: auto;
    max-width: 280px;
  }
}