/* ═══════════════════════════════════════════════════════
   AI HUMANIZER TOOL — Premium Dark Design System
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Variables ── */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(18, 18, 30, 0.85);
  --bg-card-hover: rgba(25, 25, 40, 0.9);
  --bg-input: rgba(15, 15, 25, 0.9);
  --bg-input-focus: rgba(20, 20, 35, 0.95);

  --text-primary: #e8e8ef;
  --text-secondary: #8b8ba0;
  --text-muted: #5a5a72;
  --text-accent: #a78bfa;

  --accent-1: #8b5cf6;
  --accent-2: #6366f1;
  --accent-3: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.3);
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #6366f1, #818cf8);
  --accent-gradient-hover: linear-gradient(135deg, #a78bfa, #818cf8, #93c5fd);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);

  --border: rgba(139, 92, 246, 0.12);
  --border-hover: rgba(139, 92, 246, 0.25);
  --border-focus: rgba(139, 92, 246, 0.5);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Light Theme Variables ── */
body.light-theme {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: rgba(241, 245, 249, 0.8);
  --bg-input-focus: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --border: rgba(139, 92, 246, 0.2);
  --border-hover: rgba(139, 92, 246, 0.4);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── Background Art ── */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(167, 139, 250, 0.04) 0%, transparent 50%);
  animation: bgDrift 30s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

@keyframes bgDrift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }

  100% {
    transform: translate(-3%, -3%) rotate(2deg);
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.25);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.45);
}

/* ═══════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════ */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.app-header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
}

.app-title {
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.app-subtitle span {
  color: var(--accent-3);
  font-weight: 500;
}

/* ── Top Controls Bar ── */
.controls-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* Select */
.styled-select {
  appearance: none;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 7px 32px 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8ba0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.styled-select:focus {
  border-color: var(--border-focus);
}

/* Toggle Switch */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(90, 90, 114, 0.4);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: var(--transition-normal);
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent-1);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(18px);
  background: white;
}

.mode-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-normal);
}

.mode-label.gemini-active {
  color: var(--accent-3);
}

.controls-spacer {
  flex: 1;
}

/* Settings Gear */
.settings-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
}

.settings-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.08);
}

/* ── Settings Panel ── */
.settings-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, margin 0.4s ease, opacity 0.3s ease;
  opacity: 0;
  margin-bottom: 0;
}

.settings-panel.open {
  max-height: 200px;
  opacity: 1;
  margin-bottom: 16px;
}

.settings-content {
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-content label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.api-key-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.api-key-input:focus {
  border-color: var(--border-focus);
}

.save-key-btn {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

.save-key-btn:hover {
  opacity: 0.9;
}

/* ── Progress Bar ── */
.progress-container {
  margin-bottom: 12px;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.progress-container.active {
  opacity: 1;
  max-height: 60px;
}

.progress-track {
  width: 100%;
  height: 4px;
  background: rgba(139, 92, 246, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.4s ease;
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

.status-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: center;
  min-height: 18px;
}

/* ═══════════════════════════════════════════
   MAIN PANELS
   ═══════════════════════════════════════════ */
.panels-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.panel {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  overflow: hidden;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.panel:hover {
  border-color: var(--border-hover);
}

.panel.dragover {
  border-color: var(--accent-1);
  box-shadow: var(--shadow-glow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title .icon {
  font-size: 1rem;
}

.panel-stats {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Textareas */
.text-area {
  flex: 1;
  width: 100%;
  min-height: 380px;
  padding: 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.92rem;
  line-height: 1.75;
  resize: none;
  outline: none;
}

.text-area::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.text-area:focus {
  background: var(--bg-input-focus);
}

/* Keywords Input */
.keywords-section {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.keywords-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.keywords-input {
  width: 100%;
  padding: 8px 0;
  background: transparent;
  border: none;
  color: var(--accent-3);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  outline: none;
}

.keywords-input::placeholder {
  color: var(--text-muted);
}

/* ── Panel Actions ── */
.panel-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

/* Humanize Button */
.humanize-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 24px;
  margin: 12px 0;
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.humanize-btn:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 30px rgba(139, 92, 246, 0.45);
  transform: translateY(-1px);
}

.humanize-btn:active:not(:disabled) {
  transform: translateY(0);
}

.humanize-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.humanize-btn.processing {
  animation: pulseBtn 1.5s ease infinite;
}

@keyframes pulseBtn {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
  }

  50% {
    box-shadow: 0 6px 35px rgba(139, 92, 246, 0.55);
  }
}

.humanize-btn .btn-icon {
  font-size: 1.2rem;
}

/* Small Buttons */
.btn-sm {
  padding: 6px 14px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-sm:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-sm.copy-btn.copied {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* ═══════════════════════════════════════════
   NOTIFICATION
   ═══════════════════════════════════════════ */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 1000;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

.notification.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fcd34d;
}

.notification.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.notification.info {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-3);
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */
.app-footer {
  text-align: center;
  padding: 20px 0 0;
  margin-top: 12px;
}

.footer-text {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-text a {
  color: var(--accent-3);
  text-decoration: none;
}

.footer-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 900px) {
  .panels-container {
    grid-template-columns: 1fr;
  }

  .text-area {
    min-height: 250px;
  }

  .app-title {
    font-size: 1.8rem;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .controls-spacer {
    display: none;
  }

  .control-group {
    justify-content: space-between;
  }
}

@media (max-width: 420px) {
  .app-container {
    padding: 14px 10px 30px;
  }

  .app-title {
    font-size: 1.5rem;
  }

  .app-subtitle {
    font-size: 0.82rem;
  }

  .text-area {
    min-height: 200px;
    font-size: 0.85rem;
    padding: 12px;
  }

  .seo-content {
    padding: 1rem !important;
  }

  .seo-content h2 {
    font-size: 1.25rem !important;
  }

  .seo-content h3 {
    font-size: 1.1rem !important;
  }

  .humanize-btn {
    padding: 12px 18px;
    font-size: 0.92rem;
  }

  .panel-header {
    padding: 10px 12px;
  }

  .panel-stats {
    font-size: 0.7rem;
    gap: 8px;
  }

  .settings-content {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  .notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

/* ── Selection ── */
::selection {
  background: rgba(139, 92, 246, 0.3);
  color: white;
}

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════
   AI BRAIN STATUS
   ═══════════════════════════════════════════ */
.ai-toggle-group {
  position: relative;
}

.ai-slider {
  background: rgba(239, 68, 68, 0.3) !important;
}

.toggle-switch input:checked+.ai-slider {
  background: linear-gradient(135deg, #10b981, #059669) !important;
}

.ai-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-normal);
}

.ai-status.loading {
  color: var(--warning);
  background: var(--warning-bg);
  animation: aiPulse 1.5s ease infinite;
}

.ai-status.ready {
  color: var(--success);
  background: var(--success-bg);
}

.ai-status.error {
  color: var(--error);
  background: var(--error-bg);
}

@keyframes aiPulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}