/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@600;700;800&display=swap');

:root {
  --bg-dark: #090d16;
  --bg-gradient: radial-gradient(circle at center, #131a35 0%, #070a12 100%);
  --accent-primary: #6366f1; /* Indigo */
  --accent-secondary: #a855f7; /* Purple */
  --accent-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  --accent-glow: rgba(99, 102, 241, 0.35);
  
  --card-bg: rgba(17, 24, 39, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-glow: rgba(99, 102, 241, 0.05);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-x: hidden;
}

/* App Layout */
.app-container {
  width: 100%;
  max-width: 520px;
  perspective: 1000px;
}

/* Glassmorphism Card */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 
    0 10px 40px -10px rgba(0, 0, 0, 0.5),
    0 0 50px 0 var(--card-glow);
  transition: var(--transition-smooth);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 
    0 15px 45px -5px rgba(0, 0, 0, 0.6),
    0 0 60px 0 rgba(99, 102, 241, 0.08);
}

/* Header styling */
.header {
  text-align: center;
  margin-bottom: 32px;
}

.header h1 {
  font-family: var(--font-heading);
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 8px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.header .subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

/* Input Section & Animation Classes */
.section {
  transition: opacity 0.3s ease, transform 0.3s ease;
  width: 100%;
}

.section.active {
  opacity: 1;
  transform: scale(1);
  display: block;
}

.section.hidden {
  opacity: 0;
  transform: scale(0.95);
  display: none;
}

/* Form Styles */
.input-group {
  margin-bottom: 24px;
  position: relative;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-primary);
  resize: none;
  outline: none;
  transition: var(--transition-smooth);
}

textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 20px var(--accent-glow);
  background: rgba(15, 23, 42, 0.8);
}

textarea::placeholder {
  color: var(--text-muted);
}

.char-count {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding-right: 4px;
}

/* Custom Scrollbar for Textarea */
textarea::-webkit-scrollbar {
  width: 6px;
}
textarea::-webkit-scrollbar-track {
  background: transparent;
}
textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}
textarea::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Button Design */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 28px;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 16px;
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
  user-select: none;
}

.primary-btn {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 24px rgba(168, 85, 247, 0.45),
    0 0 20px rgba(99, 102, 241, 0.3);
}

.primary-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 10px rgba(168, 85, 247, 0.2);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.secondary-btn:active {
  transform: translateY(1px);
}

.outline-btn {
  background: transparent;
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: var(--accent-primary);
}

.outline-btn:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.outline-btn:active {
  transform: translateY(1px);
}

/* Icon Support */
.icon {
  width: 20px;
  height: 20px;
  stroke-width: 2.25;
}

/* Result Area styling */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.qr-wrapper {
  background: #ffffff;
  padding: 16px;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  margin-bottom: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: var(--transition-smooth);
}

.qr-wrapper:hover {
  transform: scale(1.02);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.qr-wrapper img {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  border-radius: 8px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

/* Button Loading State */
.loading {
  position: relative;
  color: transparent !important;
}

.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-top: -10px;
  margin-left: -10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s ease-in-out infinite;
}

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

/* Responsive adjustment */
@media (max-width: 480px) {
  .card {
    padding: 30px 20px;
  }
  
  .header h1 {
    font-size: 1.85rem;
  }
  
  .actions {
    grid-template-columns: 1fr;
  }
}
