/* ============================================================
   Trooply Translator — Dark Theme (matching trooply.in)
   ============================================================ */

:root {
  --bg: #06060e;
  --bg-card: #0d0d1a;
  --bg-card-hover: #12122a;
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --accent: #06b6d4;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: #1e293b;
  --border-focus: #4f46e5;
  --glass-bg: rgba(13, 13, 26, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --radius: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Navbar ---- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: rgba(6, 6, 14, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--glass-border);
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.logo-accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--text); }

.btn {
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  border-radius: 10px;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  padding: 8px 20px;
  font-size: 13px;
}
.btn-primary:hover { opacity: 0.9; }
.btn-sm { padding: 7px 16px; font-size: 13px; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
}

/* ---- Main Container ---- */
.translator-container {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 90px 24px 20px;
}

.translator-wrapper {
  display: flex;
  gap: 0;
  align-items: stretch;
  position: relative;
}

/* ---- Panels ---- */
.translator-panel {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 380px;
  transition: border-color 0.2s;
}
.translator-panel:focus-within {
  border-color: var(--border-focus);
}

#sourcePanel {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}
#targetPanel {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Panel Header */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--glass-border);
}

.lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
.lang-selector:hover {
  background: rgba(255,255,255,0.05);
  border-color: var(--border);
}
.lang-selector svg { color: var(--text-dim); }

/* Textarea */
#sourceText {
  flex: 1;
  width: 100%;
  padding: 20px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
  resize: none;
  outline: none;
}
#sourceText::placeholder { color: var(--text-dim); }

/* Target text */
.target-text {
  flex: 1;
  padding: 20px;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  overflow-y: auto;
}
.target-text.placeholder { color: var(--text-dim); }

/* Panel Footer */
.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--glass-border);
  min-height: 44px;
}
.char-count { font-size: 12px; color: var(--text-dim); }
.target-actions { display: flex; align-items: center; gap: 8px; }
.latency-info { font-size: 11px; color: var(--text-dim); }

.copy-feedback {
  font-size: 11px;
  color: var(--accent);
  animation: fadeIn 0.2s;
}

/* Icon buttons */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: all 0.15s;
}
.icon-btn:hover {
  color: var(--text);
  background: rgba(255,255,255,0.05);
}

/* Swap button */
.swap-btn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.swap-btn:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  background: var(--bg-card-hover);
}

/* ---- Loading ---- */
.loading-indicator {
  text-align: center;
  padding: 12px;
  color: var(--accent);
  font-size: 14px;
}
.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}
@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

/* ---- Popular Pairs ---- */
.popular-pairs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.popular-label { font-size: 13px; color: var(--text-dim); }
.pair-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.pair-chip:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(79, 70, 229, 0.1);
}

/* ---- Language Dropdown ---- */
.lang-dropdown {
  position: fixed;
  z-index: 200;
  width: 320px;
  max-height: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lang-search {
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--glass-border);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
.lang-search::placeholder { color: var(--text-dim); }
.lang-list {
  overflow-y: auto;
  flex: 1;
  max-height: 360px;
}
.lang-group-label {
  padding: 8px 16px 4px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 14px;
  color: var(--text);
}
.lang-option:hover { background: rgba(255,255,255,0.05); }
.lang-option.active { background: rgba(79, 70, 229, 0.15); color: var(--primary-light); }
.lang-code { font-size: 11px; color: var(--text-dim); font-family: monospace; }
.lang-native { font-size: 12px; color: var(--text-dim); margin-left: 8px; }
.lang-quality {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  font-weight: 600;
}

/* ---- Error Toast ---- */
.error-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 30px rgba(239,68,68,0.3);
}
.error-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 18px;
  cursor: pointer;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: 400px;
  max-width: 90vw;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  cursor: pointer;
}
.input-full {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
}
.input-full:focus { border-color: var(--primary); }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--glass-border);
  margin-top: auto;
}
.footer-features {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 8px;
}
.footer-copyright {
  font-size: 12px;
  color: var(--text-dim);
}
.footer-link {
  color: var(--accent);
  text-decoration: none;
}
.footer-link:hover { text-decoration: underline; }

/* ---- Utilities ---- */
.hidden { display: none !important; }

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

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .navbar { padding: 12px 16px; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    gap: 12px;
  }
  .hamburger { display: flex; }

  .translator-container { padding: 80px 12px 12px; }

  .translator-wrapper {
    flex-direction: column;
    gap: 12px;
  }
  #sourcePanel, #targetPanel {
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
  }
  .translator-panel { min-height: 200px; }

  .swap-btn {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    margin: -8px auto;
  }
  .swap-btn svg { transform: rotate(90deg); }

  .lang-dropdown { width: calc(100vw - 24px); left: 12px !important; }

  .popular-pairs { gap: 6px; }
  .pair-chip { font-size: 11px; padding: 5px 10px; }
}

/* ---- Moderation ---- */
.moderation-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 0 4px;
}
.mod-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
}
.mod-toggle-label input { display: none; }
.mod-toggle-switch {
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}
.mod-toggle-switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
}
.mod-toggle-label input:checked + .mod-toggle-switch {
  background: var(--primary);
}
.mod-toggle-label input:checked + .mod-toggle-switch::after {
  left: 18px;
  background: #fff;
}
.mod-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
}
.mod-select:disabled { opacity: 0.4; cursor: not-allowed; }
.mod-select:not(:disabled):focus { border-color: var(--primary); }

.moderation-results {
  max-width: 1200px;
  margin: 8px auto 0;
  padding: 16px 20px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  animation: fadeIn 0.3s;
}
.mod-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mod-severity-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mod-severity-safe { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.mod-severity-low { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.mod-severity-medium { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.mod-severity-high { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.mod-severity-critical { background: rgba(239, 68, 68, 0.3); color: #ef4444; }

.mod-latency { font-size: 11px; color: var(--text-dim); }

.mod-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.mod-check-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 12px;
}
.mod-check-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mod-check-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.mod-status-ok { background: #10b981; }
.mod-status-warn { background: #eab308; }
.mod-status-danger { background: #ef4444; }
.mod-status-info { background: #3b82f6; }

.mod-check-detail {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.mod-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  margin: 2px 2px 0 0;
}
.mod-tag-red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.mod-tag-yellow { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.mod-tag-green { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.mod-tag-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

/* ---- Document Upload ---- */
.doc-upload-section {
  max-width: 600px;
  margin: 16px auto;
}
.doc-upload-card {
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-bg);
  overflow: hidden;
}
.doc-upload-area {
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px dashed transparent;
  margin: 8px;
  border-radius: 8px;
}
.doc-upload-area:hover, .doc-upload-area.dragover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.05);
}
.doc-status {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.doc-progress {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.doc-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
  animation: progressPulse 1.5s ease-in-out infinite;
}
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.doc-result {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}
