/* ==========================================================================
   CIFRATGE WEB - DESIGN SYSTEM & STYLESHEET
   Aesthetics: Deep Dark Cyber-Cryptographic Glassmorphism
   Typography: Inter & JetBrains Mono
   ========================================================================== */

:root {
  /* Color Palette */
  --bg-core: #090d16;
  --bg-surface-1: rgba(16, 23, 38, 0.75);
  --bg-surface-2: rgba(23, 33, 54, 0.85);
  --bg-surface-hover: rgba(33, 47, 75, 0.9);
  --bg-input: rgba(10, 15, 26, 0.85);

  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(0, 229, 255, 0.35);

  /* Primary Neon & Accent Tokens */
  --cyan-neon: #00e5ff;
  --cyan-glow: rgba(0, 229, 255, 0.25);
  --blue-accent: #3b82f6;
  --purple-neon: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.25);
  --emerald-neon: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  --amber-neon: #f59e0b;
  --rose-neon: #f43f5e;

  /* Typography Colors */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 45px -10px rgba(0, 0, 0, 0.6), 0 0 35px rgba(0, 229, 255, 0.08);
  --shadow-glow: 0 0 20px var(--cyan-glow);

  /* Transitions & Animation Timings */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-core);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Ambient Glowing Background Orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.45;
  will-change: transform;
}

.orb-1 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, rgba(0, 229, 255, 0.35) 0%, rgba(59, 130, 246, 0) 70%);
  top: -120px;
  left: -80px;
  animation: floatOrb 22s ease-in-out infinite alternate;
}

.orb-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.3) 0%, rgba(139, 92, 246, 0) 70%);
  bottom: 5%;
  right: -100px;
  animation: floatOrb 28s ease-in-out infinite alternate-reverse;
}

.orb-3 {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, rgba(16, 185, 129, 0) 70%);
  top: 40%;
  left: 30%;
  animation: floatOrb 35s ease-in-out infinite alternate;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 40px) scale(1.08); }
  100% { transform: translate(-25px, -35px) scale(0.95); }
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.code-font {
  font-family: 'JetBrains Mono', monospace;
}

/* Typography & Gradient Accents */
.gradient-text {
  background: linear-gradient(135deg, var(--cyan-neon) 0%, var(--purple-neon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.85rem 0;
}

.header-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.15), rgba(168, 85, 247, 0.25));
  border: 1px solid var(--border-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan-neon);
  box-shadow: 0 0 18px var(--cyan-glow);
  transition: transform var(--transition-normal);
}

.brand:hover .brand-icon {
  transform: rotate(-6deg) scale(1.05);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Badges */
.badge {
  background: var(--cyan-neon);
  color: #000;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
}

.pill-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.pill-safe {
  background: rgba(16, 185, 129, 0.1);
  color: var(--emerald-neon);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan-neon) 0%, #2563eb 100%);
  color: #000;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.45);
}

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

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-light);
  color: #fff;
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

.btn-chip {
  padding: 0.3rem 0.65rem;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-chip:hover {
  background: var(--bg-surface-hover);
  color: var(--cyan-neon);
  border-color: var(--border-accent);
}

.btn-chip-accent {
  background: rgba(168, 85, 247, 0.12);
  color: var(--purple-neon);
  border-color: rgba(168, 85, 247, 0.3);
}

.btn-chip-accent:hover {
  background: rgba(168, 85, 247, 0.25);
  color: #fff;
}

.btn-chip-danger {
  color: var(--rose-neon);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-chip-danger:hover {
  background: rgba(244, 63, 94, 0.15);
  color: #fff;
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-color: var(--border-light);
}

.btn-icon-danger:hover {
  background: rgba(244, 63, 94, 0.2);
  color: var(--rose-neon);
  border-color: rgba(244, 63, 94, 0.4);
}

.btn-icon-copy:hover {
  color: var(--cyan-neon);
}

.btn-tooltip {
  position: absolute;
  top: -28px;
  right: 0;
  background: var(--cyan-neon);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-icon-copy.copied .btn-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 2.5rem 0 3.5rem;
}

/* Algorithm Navigation Tabs */
.algo-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  background: var(--bg-surface-1);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  color: var(--text-muted);
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan-neon), var(--purple-neon));
  transform: scaleX(0);
  transition: transform var(--transition-normal);
}

.tab-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-light);
  color: var(--text-main);
  transform: translateY(-2px);
}

.tab-btn.active {
  background: var(--bg-surface-2);
  border-color: var(--border-accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35), 0 0 16px rgba(0, 229, 255, 0.12);
}

.tab-btn.active::after {
  transform: scaleX(1);
}

.tab-icon {
  font-size: 1.35rem;
}

.tab-label {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tab-tag {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.tab-btn.active .tab-tag {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan-neon);
}

/* Workbench Card */
.workbench-card {
  background: var(--bg-surface-1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  transition: border-color var(--transition-normal);
}

.workbench-card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

/* Algo Info Bar */
.algo-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.algo-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 0.2rem;
}

.algo-description {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.algo-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Action Bar & Mode Switcher */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.mode-toggle-group {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}

.mode-btn:hover {
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--cyan-neon);
  color: #000;
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.35);
}

/* Toggle Switch (Live conversion) */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-switch .slider {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--transition-normal);
}

.toggle-switch .slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform var(--transition-bounce);
}

.toggle-switch input:checked + .slider {
  background: var(--cyan-neon);
}

.toggle-switch input:checked + .slider::before {
  transform: translateX(18px);
  background: #000;
}

.toggle-text {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Parameters Section */
.params-section {
  margin-bottom: 1.5rem;
}

.algo-params-panel {
  background: rgba(23, 33, 54, 0.5);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.param-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.param-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.param-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.highlight-val {
  color: var(--cyan-neon);
  font-size: 1.05rem;
}

.caesar-quick-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.slider-min, .slider-max {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dim);
}

/* Custom Range Input */
.custom-range {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cyan-neon);
  cursor: pointer;
  box-shadow: 0 0 12px var(--cyan-glow);
  transition: transform var(--transition-fast);
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.num-input {
  width: 54px;
  padding: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--cyan-neon);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  outline: none;
}

.num-input:focus {
  border-color: var(--cyan-neon);
}

/* Interactive Caesar Alphabet Mapping Strip */
.caesar-strip-container {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--border-subtle);
}

.strip-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.alphabet-track-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
}

.alphabet-strip {
  display: flex;
  gap: 4px;
}

.alpha-cell {
  width: 26px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
  user-select: none;
}

.alphabet-cipher .alpha-cell {
  background: rgba(0, 229, 255, 0.1);
  color: var(--cyan-neon);
  border-color: rgba(0, 229, 255, 0.25);
}

.alphabet-arrow {
  color: var(--purple-neon);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Morse Controls Bar */
.morse-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.morse-playback-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.morse-light-container {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.morse-led {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #334155;
  border: 2px solid #475569;
  transition: all 0.05s ease;
}

.morse-led.active {
  background: #facc15;
  border-color: #fef08a;
  box-shadow: 0 0 20px #facc15, 0 0 40px #f59e0b;
}

.morse-led-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.morse-audio-settings {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.audio-setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.range-sm {
  width: 120px;
}

.morse-tip {
  margin-top: 0.85rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.morse-tip code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--cyan-neon);
}

/* Inversion Radio Options */
.inversion-options {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.radio-options-group {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.radio-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radio-chip:hover {
  border-color: var(--border-light);
  color: var(--text-main);
}

.radio-chip input:checked + span {
  color: var(--cyan-neon);
  font-weight: 600;
}

/* Multi-cipher notice */
.multi-notice {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Conversion Grid (Two-column layout) */
.conversion-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
}

.io-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.io-card:focus-within {
  border-color: var(--cyan-neon);
  box-shadow: 0 0 18px var(--cyan-glow);
}

.io-card-output {
  background: rgba(14, 21, 37, 0.85);
  border-color: rgba(168, 85, 247, 0.25);
}

.io-card-output:focus-within {
  border-color: var(--purple-neon);
  box-shadow: 0 0 18px var(--purple-glow);
}

.io-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border-subtle);
}

.io-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.io-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.io-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.input-badge {
  background: rgba(0, 229, 255, 0.15);
  color: var(--cyan-neon);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.output-badge {
  background: rgba(168, 85, 247, 0.15);
  color: var(--purple-neon);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.io-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.io-textarea-wrap {
  flex: 1;
  display: flex;
}

.io-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 1.15rem;
  font-size: 0.95rem;
  color: var(--text-main);
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

.io-textarea::placeholder {
  color: var(--text-dim);
}

.output-textarea {
  color: #a5f3fc;
  cursor: text;
}

.io-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.15rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-dim);
}

.text-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dot-separator {
  opacity: 0.4;
}

.output-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: var(--emerald-neon);
}

.status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald-neon);
  box-shadow: 0 0 8px var(--emerald-neon);
}

/* Swap Button & Divider */
.swap-divider {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-swap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
}

.btn-swap:hover {
  background: var(--cyan-neon);
  color: #000;
  transform: rotate(180deg) scale(1.1);
  box-shadow: 0 0 20px var(--cyan-glow);
}

/* Multi-cipher Comparison Grid */
.multi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.multi-result-card {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.multi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.multi-icon {
  font-size: 1.15rem;
}

.multi-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  flex: 1;
  margin-left: 0.5rem;
}

.btn-icon-xs {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.btn-icon-xs:hover {
  opacity: 1;
}

.multi-code-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  font-size: 0.85rem;
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  word-break: break-all;
  white-space: pre-wrap;
  color: var(--cyan-neon);
}

/* Educational Info Section */
.info-section {
  margin-top: 1rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  color: #fff;
}

.cards-deck {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.info-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(14px);
  transition: transform var(--transition-normal);
}

.info-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
}

.info-card-icon {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.info-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #fff;
}

.info-card-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.formula-box {
  background: rgba(0, 0, 0, 0.4);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--cyan-neon);
  margin-bottom: 0.75rem;
}

.info-card-sub {
  font-size: 0.76rem;
  color: var(--text-dim);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 14, 0.78);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-window {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-wide {
  max-width: 840px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Brute Force List */
.bruteforce-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bf-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.bf-item:hover {
  background: rgba(0, 229, 255, 0.1);
  border-color: var(--border-accent);
  transform: translateX(4px);
}

.bf-shift-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--cyan-neon);
  font-family: 'JetBrains Mono', monospace;
  min-width: 70px;
}

.bf-text-preview {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-main);
  flex: 1;
  margin: 0 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bf-select-btn {
  font-size: 0.74rem;
  padding: 0.2rem 0.5rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

/* Morse Table Modal Content */
.morse-table-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.cat-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--cyan-neon);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.35rem;
}

.morse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
  gap: 0.5rem;
}

.morse-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
}

.morse-char {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.morse-code {
  color: var(--cyan-neon);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
}

/* History Drawer */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: var(--bg-surface-2);
  border-left: 1px solid var(--border-subtle);
  backdrop-filter: blur(25px);
  z-index: 90;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.drawer-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.drawer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.76rem;
  color: var(--text-dim);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-card {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-card:hover {
  border-color: var(--border-accent);
  background: rgba(0, 229, 255, 0.05);
}

.hist-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.hist-algo {
  color: var(--cyan-neon);
  font-weight: 700;
}

.hist-text {
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-arrow {
  font-size: 0.7rem;
  color: var(--purple-neon);
}

.empty-history-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-surface-2);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  padding: 0.65rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--cyan-glow);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

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

.toast-icon {
  color: var(--emerald-neon);
  font-weight: 800;
}

.toast-message {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

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

/* Footer */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(9, 13, 22, 0.95);
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.footer-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  text-align: center;
}

.footer-links {
  display: flex;
  gap: 0.75rem;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .algo-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .conversion-grid {
    grid-template-columns: 1fr;
  }

  .swap-divider {
    padding: 0.5rem 0;
  }

  .btn-swap {
    transform: rotate(90deg);
  }

  .btn-swap:hover {
    transform: rotate(270deg) scale(1.1);
  }

  .multi-grid {
    grid-template-columns: 1fr;
  }

  .cards-deck {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .algo-tabs {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .mode-toggle-group {
    width: 100%;
  }

  .mode-btn {
    flex: 1;
    justify-content: center;
  }

  .drawer {
    width: 100%;
  }
}
