:root {
  /* Color Tokens - Light Theme */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-border: rgba(226, 232, 240, 0.8);
  --bg-textarea: #ffffff;
  --bg-textarea-output: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #10b981;
  
  /* Brand Accents (Esperanto Green & Fresh Palette) */
  --accent-primary: #059669;
  --accent-primary-hover: #047857;
  --accent-primary-light: #ecfdf5;
  --accent-glow: rgba(16, 185, 129, 0.15);
  
  /* Badge Colors */
  --badge-input-bg: #e0f2fe;
  --badge-input-text: #0369a1;
  --badge-output-bg: #d1fae5;
  --badge-output-text: #065f46;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 25px rgba(16, 185, 129, 0.2);

  /* Dimensions & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  /* Color Tokens - Dark Theme */
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-textarea: #0f172a;
  --bg-textarea-output: #0c1222;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #34d399;
  
  /* Brand Accents */
  --accent-primary: #10b981;
  --accent-primary-hover: #059669;
  --accent-primary-light: rgba(16, 185, 129, 0.15);
  --accent-glow: rgba(16, 185, 129, 0.25);
  
  /* Badge Colors */
  --badge-input-bg: rgba(56, 189, 248, 0.15);
  --badge-input-text: #38bdf8;
  --badge-output-bg: rgba(52, 211, 153, 0.15);
  --badge-output-text: #34d399;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 35px rgba(16, 185, 129, 0.3);
}

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

html, body {
  min-height: 100vh;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Background Ambient Lighting */
.background-decorations {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.4;
  transition: opacity 0.5s ease;
}

.glow-1 {
  top: -100px;
  left: 10%;
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #10b981 0%, rgba(16, 185, 129, 0) 70%);
}

.glow-2 {
  bottom: -100px;
  right: 10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0284c7 0%, rgba(2, 132, 199, 0) 70%);
}

[data-theme="dark"] .glow-circle {
  opacity: 0.25;
}

/* Main Container Layout */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.esperanto-star {
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
}

.header-text {
  display: flex;
  flex-direction: column;
}

.app-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

/* Grid Layout */
.converter-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  gap: 16px;
}

/* Panels */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.panel-card:focus-within {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-glow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.015);
}

.panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-input {
  background-color: var(--badge-input-bg);
  color: var(--badge-input-text);
}

.badge-output {
  background-color: var(--badge-output-bg);
  color: var(--badge-output-text);
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.text-btn {
  background: transparent;
  color: var(--text-secondary);
}

.text-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.primary-action-btn {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.primary-action-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.primary-action-btn:active {
  transform: translateY(0);
}

.install-btn {
  background: var(--bg-card);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  backdrop-filter: blur(12px);
}

.install-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Textareas */
.textarea-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  min-height: 380px;
}

.converter-textarea {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.7;
  resize: none;
  outline: none;
}

.converter-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.output-textarea {
  cursor: default;
}

/* Center Arrow */
.converter-arrow-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.converter-arrow-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s ease;
}

.arrow-line-mobile,
.arrow-head-mobile {
  display: none;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 0.825rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
}

[data-theme="dark"] .toast {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

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

.toast svg {
  color: #34d399;
}

.hidden {
  display: none !important;
}

/* Responsive Styles */
@media (max-width: 900px) {
  .converter-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }

  .arrow-line-desktop,
  .arrow-head-desktop {
    display: none;
  }

  .arrow-line-mobile,
  .arrow-head-mobile {
    display: inline;
  }

  .converter-arrow-container {
    padding: 4px 0;
  }

  .textarea-wrapper {
    min-height: 240px;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 16px 12px;
  }

  .app-title {
    font-size: 1.25rem;
  }

  .panel-header {
    padding: 12px 16px;
  }

  .textarea-wrapper {
    padding: 12px 16px;
    min-height: 200px;
  }
}
