/* Core variables and base layout */
:root {
  /* Light mode colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f4;
  --bg-glass: rgba(255, 255, 255, 0.98);
  --bg-card: rgba(255, 255, 255, 0.95);
  
  --text-primary: #1d1d1f;
  --text-secondary: #424245;
  --text-muted: #86868b;
  
  --border-light: rgba(0, 0, 0, 0.04);
  --border-medium: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  
  --shadow-light: rgba(0, 0, 0, 0.02);
  --shadow-medium: rgba(0, 0, 0, 0.04);
  --shadow-strong: rgba(0, 0, 0, 0.08);
  
  /* Typeform-inspired colors (Clean, minimal) */
  --brand-50:  #f8fafc;
  --brand-100: #f1f5f9;
  --brand-200: #e2e8f0;
  --brand-300: #cbd5e1;
  --brand-400: #94a3b8;
  --brand-500: #64748b;
  --brand-600: #475569;
  --brand-700: #334155;
  --brand-800: #1e293b;
  --brand-900: #0f172a;

  /* Purple/Violet accent */
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-light: rgba(139, 92, 246, 0.1);
  
  /* Clean greys */
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-600: #64748b;
  --slate-700: #475569;
  --slate-800: #334155;
  --slate-900: #0f172a;

  /* Minimal gradients */
  --grad-brand: var(--accent);
  --grad-bg: linear-gradient(135deg, #f8f9fa 0%, #f1f3f4 50%, #e8eaed 100%);
  --grad-card: #ffffff;
}

/* Welcome message styling */
.welcome-text {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  margin-right: 12px;
}

.welcome-text span {
  color: var(--accent);
  font-weight: 600;
}

/* Dark mode variables */
[data-theme="dark"] {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2a2a2a;
  --bg-tertiary: #3a3a3a;
  --bg-glass: rgba(42, 42, 42, 0.95);
  --bg-card: rgba(50, 50, 50, 0.9);
  
  --text-primary: #ffffff;
  --text-secondary: #e5e5e7;
  --text-muted: #98989d;
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.16);
  
  --shadow-light: rgba(0, 0, 0, 0.3);
  --shadow-medium: rgba(0, 0, 0, 0.4);
  --shadow-strong: rgba(0, 0, 0, 0.6);
  
  --accent: #a855f7;
  --accent-hover: #9333ea;
  --accent-light: rgba(168, 85, 247, 0.15);
  
  --grad-bg: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 50%, #1e1e1e 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--grad-bg);
  min-height: 100vh;
  letter-spacing: -0.003em;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-height: calc(100vh - 80px);
}

.row { 
  display: flex; 
  gap: 16px; 
  align-items: center; 
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Main content layout */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.input-section {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.history-bottom {
  margin-top: 32px;
}

.history-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .history-grid {
    grid-template-columns: 1fr;
  }
  
  .container {
    padding: 16px;
  }
}

/* Enhanced visual hierarchy */
.card h2 { 
  margin: 0 0 20px; 
  font-weight: 600;
  color: var(--text-secondary); 
  letter-spacing: 0.05em;
  line-height: 1.3;
  text-transform: uppercase;
  font-size: 13px;
  opacity: 0.8;
  position: relative;
}

.card h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 24px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 1px;
}

/* Enhanced card styling */
.card { 
  padding: 40px; 
  border-radius: 20px; 
  border: 1px solid var(--border-light); 
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 
    0 2px 8px var(--shadow-light), 
    0 8px 32px var(--shadow-medium),
    0 0 0 1px var(--border-light) inset;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

/* Input section specific styling */
.input-section {
  padding: 48px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.section-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 16px var(--accent-light);
}

.section-title-group h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.section-subtitle {
  margin: 4px 0 0 0;
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 400;
}

.input-container {
  position: relative;
  margin-bottom: 24px;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.input-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.character-count {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.keyboard-hints {
  display: flex;
  gap: 12px;
}

.hint {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.action-buttons {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
}

.card:hover {
  box-shadow: 
    0 4px 12px var(--shadow-medium), 
    0 12px 32px var(--shadow-strong),
    0 0 0 1px var(--accent-light) inset;
  transform: translateY(-2px);
  border-color: var(--accent-light);
}

/* Apple-style cards */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  box-shadow: 0 1px 3px var(--shadow-light), 0 4px 16px var(--shadow-medium);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.glass:hover {
  box-shadow: 0 2px 8px var(--shadow-medium), 0 8px 24px var(--shadow-strong);
  transform: translateY(-1px);
}

/* Enhanced button styling */
.btn {
  padding: 16px 32px; 
  border: none; 
  border-radius: 12px; 
  font-weight: 600; 
  font-size: 16px;
  letter-spacing: -0.003em;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 140px;
  white-space: nowrap;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
  box-shadow: 
    0 4px 16px var(--accent-light),
    0 2px 8px var(--shadow-light);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 24px var(--accent-light),
    0 4px 16px var(--shadow-medium);
}

.btn-secondary {
  color: var(--accent);
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  box-shadow: 0 2px 8px var(--shadow-light);
}

.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 
    0 6px 24px var(--accent-light),
    0 4px 16px var(--shadow-medium);
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  transition: left 0.6s;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover { 
  background: linear-gradient(135deg, var(--accent-hover) 0%, var(--accent) 100%); 
  transform: translateY(-1px);
  box-shadow: 
    0 4px 16px var(--shadow-medium),
    0 0 0 1px var(--accent-light) inset;
}

.btn:active { 
  transform: translateY(0); 
  box-shadow: 
    0 2px 6px var(--shadow-light),
    0 0 0 1px var(--border-light) inset;
}

/* Apple-style buttons */
.btn-primary { 
  background: var(--accent); 
  border-radius: 10px; 
  padding: 12px 20px; 
  font-weight: 500; 
  color: #fff; 
  font-size: 16px;
  box-shadow: 0 1px 3px var(--shadow-light);
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--shadow-medium);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px var(--shadow-light);
}

/* Apple-style outline buttons */
.btn-outline { 
  background: var(--bg-primary); 
  color: var(--accent); 
  border: 1px solid var(--border-light); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 2px var(--shadow-light); 
  padding: 12px 16px;
  border-radius: 10px;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.btn-outline:hover { 
  border-color: var(--accent); 
  color: var(--accent-hover); 
  background: var(--bg-secondary);
  transform: translateY(-1px); 
  box-shadow: 0 2px 8px var(--shadow-medium);
}
.btn-sm { 
  padding: 8px 16px; 
  font-size: 14px; 
  border-radius: 8px; 
}

/* Enhanced input styling */
textarea, input[type="text"], input[type="search"], input[type="email"], input[type="password"] {
  width: 100%; 
  border: 2px solid var(--border-medium); 
  background: var(--bg-primary); 
  border-radius: 16px; 
  padding: 20px 24px; 
  font-size: 16px; 
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  letter-spacing: -0.003em;
  line-height: 1.6;
  box-shadow: 
    0 2px 8px var(--shadow-light),
    0 0 0 1px var(--border-light) inset;
  min-height: 120px;
  resize: vertical;
}

#common-input {
  min-height: 140px;
  font-size: 17px;
}

/* Placeholder contrast for both themes */
textarea::placeholder,
input::placeholder {
  color: var(--text-muted);
}

/* Improve autofill readability */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  transition: background-color 5000s ease-in-out 0s;
  box-shadow: 0 0 0px 1000px var(--bg-secondary) inset !important;
}

textarea:focus, input:focus { 
  border-color: var(--accent); 
  box-shadow: 
    0 0 0 4px var(--accent-light), 
    0 2px 8px var(--shadow-medium),
    0 0 0 1px var(--border-light) inset;
  background: var(--bg-primary);
  transform: translateY(-1px);
}

textarea:hover, input:hover {
  border-color: var(--accent-light);
  box-shadow: 
    0 2px 6px var(--shadow-light),
    0 0 0 1px var(--border-light) inset;
}

/* Specific textarea styling */
textarea {
  resize: vertical;
  min-height: 120px;
}

/* Enhanced glass effect */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 
    0 2px 8px var(--shadow-light), 
    0 8px 24px var(--shadow-medium),
    0 0 0 1px var(--border-light) inset;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass:hover {
  box-shadow: 
    0 4px 16px var(--shadow-medium), 
    0 12px 32px var(--shadow-strong),
    0 0 0 1px var(--border-light) inset;
  transform: translateY(-1px);
}

/* Loading states */
.btn.loading {
  pointer-events: none;
  opacity: 0.8;
  position: relative;
}

.btn.loading .btn-text {
  opacity: 0;
}

.btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-secondary.loading::after {
  border: 2px solid var(--border-medium);
  border-top-color: var(--accent);
}

/* Enhanced history items */
.history-item {
  padding: 16px 20px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-secondary);
  margin-bottom: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.history-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--accent-light));
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.history-item:hover::before {
  transform: scaleY(1);
}

.history-item:hover { 
  border-color: var(--accent-light); 
  background: var(--bg-primary);
  transform: translateX(4px);
  box-shadow: 
    0 2px 8px var(--shadow-medium),
    0 0 0 1px var(--border-light) inset;
}

/* Apple-style top bar */
.topbar {
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 
    0 1px 0 var(--border-light) inset,
    0 1px 3px var(--shadow-light);
}

/* Navbar branding */
.brand { display:flex; align-items:center; gap:10px; }
.brand img { display:block; height: 40px; width: auto; max-width: 160px; }
.brand-title { 
  margin: 0; 
  font-size: 22px; 
  font-weight: 600; 
  color: var(--text-primary); 
  letter-spacing: -0.022em;
  opacity: 0.9;
}
.brand-title .accent { color: var(--brand-600); }
.brand-sub { margin:0; color: var(--text-muted); font-size:12px; }
.navbar-actions { display:flex; align-items:center; gap:8px; }
header h1 { margin: 0; font-size: 22px; font-weight: 600; color: var(--text-primary); }
header p { margin: 0; color: var(--text-muted); font-size: 14px; font-weight: 500; }

/* Hero banner (brand visual) */
.hero { padding:0; overflow:hidden; border-radius:14px; }
.hero img { display:block; width:100%; height:auto; max-height: 120px; object-fit: cover; }
@media (max-width: 640px){ .hero img { max-height: 100px; } }

/* Section title layout */
.section-title { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  margin-bottom: 20px; 
}
.section-actions { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
}

/* Pills, muted text */
.pill { 
  display: inline-block; 
  padding: 6px 12px; 
  border-radius: 20px; 
  font-size: 12px; 
  background: var(--bg-secondary);
  color: var(--text-secondary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
}
.muted { 
  color: var(--text-muted); 
  font-size: 14px; 
  font-weight: 400; 
  letter-spacing: -0.003em;
}

/* Results */
.results { display: grid; gap: 10px; max-width: 100%; overflow-x: hidden; }
.results pre {
  background: #0B1021;
  color: #E2E8F0;
  border-radius: 12px;
  padding: 12px;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Loading animations */
.spinner { 
  width: 16px; 
  height: 16px; 
  border-radius: 50%; 
  border: 2px solid rgba(255, 255, 255, 0.3); 
  border-top-color: white; 
  animation: spin 0.8s linear infinite; 
  display: inline-block; 
  vertical-align: middle; 
}

.loading-bar {
  display: inline-block;
  width: 20px;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  vertical-align: middle;
}

.loading-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: white;
  animation: slide 1.2s ease-in-out infinite;
}

@keyframes spin { 
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slide {
  0% { left: -100%; }
  50% { left: 100%; }
  100% { left: -100%; }
}

/* Auth */
.auth-wrap { max-width: 520px; margin: 40px auto; padding: 28px; }
.auth-wrap .field { margin-bottom: 20px; }
.auth-wrap .field label { display: block; margin-bottom: 8px; font-weight: 500; }
.auth-wrap input[type="email"], 
.auth-wrap input[type="password"] { 
  min-height: 50px; 
  padding: 16px 20px; 
  font-size: 16px; 
  width: 100%;
}
.actions { display:flex; gap:10px; align-items:center; margin-top:8px }
.divider { display:flex; align-items:center; color:var(--text-muted); font-size:12px; margin:16px 0 }
.divider::before,.divider::after { content:""; flex:1; height:1px; background:var(--border-light) }
.divider span { padding:0 8px }

/* Suggestions */
.suggest-box { 
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 -8px 32px var(--shadow-medium);
  max-height: 300px;
  overflow: auto;
}

.suggest-section { 
  margin-bottom: 12px;
}

.suggest-title { 
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 8px 12px 8px 12px;
  font-weight: 600;
}

.suggest-item { 
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.suggest-item:last-child {
  border-bottom: none;
}

.suggest-item:hover { 
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.suggest-item.selected { 
  background: var(--accent-primary);
  color: white;
}

.suggest-item::before {
  content: "🔍";
  opacity: 0.6;
  font-size: 12px;
}

.suggest-icon { 
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

/* History */
.history { padding: 32px; }
.history-list { 
  list-style: none; 
  margin: 0; 
  padding: 0; 
  display: grid; 
  gap: 12px; 
  max-height: 400px;
  overflow-y: auto;
}

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal.open { display: flex; }
.modal-content { width: min(900px, 95vw); max-height: 85vh; overflow: auto; background: var(--bg-primary); border-radius: 16px; border: 1px solid var(--border-light); box-shadow: 0 4px 16px var(--shadow-medium); }
.modal-header { display:flex; align-items:center; justify-content:space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
.modal-body { 
  margin: 0; 
  white-space: pre-wrap; 
  word-break: break-word; 
  overflow-wrap: anywhere; 
  padding: 16px; 
  max-height: 60vh;
  overflow-y: auto;
}

/* Improved responsive design */
/* Mobile responsive design */
@media (max-width: 768px) {
  .container {
    padding: 16px;
    gap: 24px;
  }
  
  .input-section {
    padding: 32px 24px;
  }
  
  .section-header {
    flex-direction: column;
    text-align: center;
    gap: 16px;
    margin-bottom: 24px;
  }
  
  .section-title-group h1 {
    font-size: 24px;
  }
  
  .input-footer {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
  }
  
  .action-buttons {
    flex-direction: row;
    gap: 8px;
    flex-wrap: nowrap;
  }
  
  .btn {
    flex: 1;
    min-width: 0;
    padding: 18px 12px;
    font-size: 14px;
  }
  
  .keyboard-hints {
    justify-content: center;
  }
  
  .topbar {
    padding: 16px 20px;
  }
  
  textarea, input[type="text"], input[type="search"], input[type="email"], input[type="password"] {
    padding: 18px 20px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  #common-input {
    min-height: 120px;
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .input-section {
    padding: 24px 20px;
  }
  
  .section-title-group h1 {
    font-size: 22px;
  }
  
  .section-icon {
    width: 48px;
    height: 48px;
  }
  
  .btn {
    padding: 16px 20px;
    font-size: 15px;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px;
  min-width: 300px;
  max-width: 400px;
  box-shadow: 0 4px 16px var(--shadow-medium);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toast.toast-show {
  transform: translateX(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
}

.toast-success .toast-icon {
  background: #34d399;
  color: white;
}

.toast-error .toast-icon {
  background: #f87171;
  color: white;
}

.toast-warning .toast-icon {
  background: #fbbf24;
  color: white;
}

.toast-info .toast-icon {
  background: var(--accent);
  color: white;
}

.toast-message {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.toast-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Skeleton Loading */
.skeleton-item {
  padding: 16px 20px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-secondary);
  margin-bottom: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, 
    var(--border-light) 25%, 
    var(--border-medium) 50%, 
    var(--border-light) 75%
  );
  background-size: 200% 100%;
  border-radius: 6px;
  margin-bottom: 8px;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

.skeleton-title {
  height: 16px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-text {
  width: 100%;
}

.skeleton-text.short {
  width: 40%;
}

.skeleton-fade-out {
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Theme Toggle Styling */
#theme-toggle {
  position: relative;
  overflow: hidden;
}

#theme-toggle .theme-icon {
  font-size: 16px;
  transition: transform 0.3s ease;
}

#theme-toggle:hover .theme-icon {
  transform: scale(1.1);
}

/* Enhanced button animations */
.btn, .btn-outline, .btn-primary {
  position: relative;
  overflow: hidden;
}

.btn::after, .btn-outline::after, .btn-primary::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

.btn:active::after, .btn-outline:active::after, .btn-primary:active::after {
  width: 200px;
  height: 200px;
}

/* Auth pages: simplify button visuals to remove heavy/glossy shadows */
.auth-wrap .btn,
.auth-wrap .btn-primary,
.auth-wrap .btn-outline {
  box-shadow: 0 1px 3px var(--shadow-light);
  transform: none;
}
.auth-wrap .btn:hover,
.auth-wrap .btn-primary:hover,
.auth-wrap .btn-outline:hover {
  box-shadow: 0 2px 8px var(--shadow-medium);
  transform: none;
}
.auth-wrap .btn::before,
.auth-wrap .btn::after,
.auth-wrap .btn-primary::before,
.auth-wrap .btn-primary::after,
.auth-wrap .btn-outline::before,
.auth-wrap .btn-outline::after {
  content: none;
}

/* Feather Icons Integration */
.feather {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: middle;
}

.feather-sm {
  width: 16px;
  height: 16px;
}

.feather-lg {
  width: 24px;
  height: 24px;
}

/* Icon buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
}

/* Status and result areas */
.status-message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: none;
}

.status-message:not(:empty) {
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.result-container {
  margin-top: 20px;
}

.result-container:not(:empty) {
  padding: 24px;
  background: var(--bg-secondary);
  border-radius: 16px;
  border: 1px solid var(--border-light);
  max-height: 400px;
  overflow-y: auto;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.btn-icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Enhanced focus states for accessibility */
.btn:focus-visible, 
.btn-outline:focus-visible, 
.btn-primary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Improved mobile touch targets */
@media (max-width: 768px) {
  .btn, .btn-outline, .btn-primary {
    min-height: 44px;
    min-width: 44px;
  }
  
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* Mobile optimizations for top bar */
@media (max-width: 600px) {
  .topbar { padding: 12px 16px; gap: 10px; }
  .brand img { height: 28px; max-width: 120px; }
  .navbar-actions { gap: 6px; }
  /* Hide verbose auth text on mobile */
  #auth-status, #welcome-message { display: none !important; }
  /* Hide button labels in cramped spaces, keep icons */
  .btn .btn-label { display: none; }
  /* Icon-only buttons are already compact */
}