:root {
  --primary: #7e57c2;
  --primary-light: #b085f5;
  --primary-dark: #4d2c91;
  --secondary: #26a69a;
  --accent: #ff6b6b;
  --text-on-primary: #ffffff;
  --text-primary: #37474f;
  --text-secondary: #78909c;
  --bg-light: linear-gradient(135deg, #f5f7ff 0%, #e0e7ff 100%);
  --bg-dark: linear-gradient(135deg, #1a2238 0%, #111827 100%);
  --card-light: rgba(255, 255, 255, 0.9);
  --card-dark: rgba(33, 43, 69, 0.9);
  --success: #66bb6a;
  --warning: #ffa726;
  --error: #ef5350;
  --transition: all 0.3s ease;
}

.dark-mode {
  --bg-primary: var(--bg-dark);
  --card-bg: var(--card-dark);
  --text-primary: #e0e0e0;
  --text-secondary: #b0bec5;
  --border-color: #37474f;
}

.light-mode {
  --bg-primary: var(--bg-light);
  --card-bg: var(--card-light);
  --text-primary: #37474f;
  --text-secondary: #78909c;
  --border-color: #e0e0e0;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  transition: var(--transition);
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background 0.5s ease;
}

.container {
  width: 100%;
  max-width: 900px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.8s ease-out;
  transform-origin: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.app-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-on-primary);
  padding: 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 60%
  );
  animation: rotate 20s linear infinite;
  pointer-events: none;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.app-title {
  font-size: 32px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.app-title i {
  color: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 60px;
  height: 30px;
  border-radius: 30px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 5px;
  z-index: 1;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.theme-toggle::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.theme-toggle.dark::before {
  transform: translateX(30px);
}

.app-body {
  padding: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .app-body {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.panel:nth-child(2) {
  animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
  align-items: center;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.text-counter {
  font-size: 14px;
  color: var(--text-secondary);
  background: rgba(118, 118, 128, 0.12);
  padding: 6px 12px;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

.text-counter:hover {
  transform: scale(1.05);
}

textarea {
  width: 100%;
  flex: 1;
  padding: 18px;
  border-radius: 16px;
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  resize: none;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 4px rgba(126, 87, 194, 0.2);
  transform: translateY(-2px);
}

.output {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  padding: 18px;
  flex: 1;
  overflow-y: auto;
  font-size: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.output:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 15px;
  margin: 25px 0;
}

.btn {
  padding: 14px 18px;
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.7s ease;
}

.btn:hover::before {
  left: 100%;
}

.btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.btn-primary {
  background: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
}

.btn-secondary:hover {
  background: #20897f;
}

.btn-warning {
  background: var(--warning);
}

.btn-warning:hover {
  background: #f57c00;
}

.utility-buttons {
  display: flex;
  gap: 15px;
  margin-top: 20px;
}

.utility-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: rgba(118, 118, 128, 0.12);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.utility-btn:hover {
  background: rgba(118, 118, 128, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.notification {
  position: fixed;
  bottom: 25px;
  right: 25px;
  padding: 18px 28px;
  border-radius: 14px;
  background: var(--card-bg);
  color: var(--text-primary);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(100px) scale(0.9);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
  z-index: 1000;
}

.notification.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.pulse {
  animation: pulse 1.5s infinite;
}

.feature-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--accent);
  color: white;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: bold;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-8px);
  }
  60% {
    transform: translateY(-4px);
  }
}

.btn-speech {
  position: relative;
}

.floating-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0.3;
  animation: float 20s infinite linear;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  100% {
    transform: translateY(-100vh) rotate(360deg);
  }
}

.transform-effect {
  position: absolute;
  pointer-events: none;
  z-index: 10;
  background: rgba(126, 87, 194, 0.3);
  border-radius: 50%;
  transform: scale(0);
  opacity: 0;
}

@keyframes transform {
  0% {
    transform: scale(0);
    opacity: 0.7;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background-color: var(--primary);
  margin-left: 2px;
  animation: blink 1s infinite;
  vertical-align: middle;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* NEW: Real-time transformation controls */
.live-transform-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding: 12px 15px;
  background: rgba(118, 118, 128, 0.08);
  border-radius: 12px;
  animation: slideInDown 0.5s ease-out;
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.live-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  width: 50px;
  height: 24px;
  background: rgba(118, 118, 128, 0.3);
  border-radius: 34px;
  transition: background 0.3s;
}

.toggle-switch::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  background: white;
  transition: transform 0.3s;
}

.toggle-switch.active {
  background: var(--primary);
}

.toggle-switch.active::before {
  transform: translateX(26px);
}

.transform-selector {
  display: flex;
  gap: 8px;
}

.transform-option {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(118, 118, 128, 0.12);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.transform-option:hover {
  background: rgba(118, 118, 128, 0.2);
}

.transform-option.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(126, 87, 194, 0.3);
}

/* NEW: Live preview highlight effect */
.live-preview-highlight {
  position: absolute;
  background: rgba(126, 87, 194, 0.1);
  border-radius: 4px;
  z-index: -1;
  transition: all 0.3s ease;
}
