@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
@tailwind utilities;

/* ============================================================
   SleekTranslator Design System — Premium Translation UI
   ============================================================ */

/* --- Design Tokens --- */
:root {
  --color-primary: #6366f1;
  --color-primary-dark: #4f46e5;
  --color-primary-light: #a5b4fc;
  --color-primary-subtle: #eef2ff;
  --color-surface: #ffffff;
  --color-bg: #f1f5f9;
  --color-text: #0f172a;
  --color-text-secondary: #64748b;
  --color-border: #e2e8f0;

  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --glass-blur: 16px;

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --card-shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
  --card-radius: 16px;
  --btn-radius: 10px;
  --input-radius: 10px;
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  --indigo-50: #eef2ff;
  --indigo-100: #e0e7ff;
  --indigo-200: #c7d2fe;
  --indigo-300: #a5b4fc;
  --indigo-400: #818cf8;
  --indigo-500: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-700: #4338ca;
  --indigo-800: #3730a3;
}

.dark {
  --color-primary: #818cf8;
  --color-primary-dark: #6366f1;
  --color-primary-light: #a5b4fc;
  --color-primary-subtle: rgba(99, 102, 241, 0.12);
  --color-surface: #1e293b;
  --color-bg: #020617;
  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-border: #334155;

  --glass-bg: rgba(30, 41, 59, 0.75);
  --glass-border: rgba(51, 65, 85, 0.6);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* --- Base --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.01em;
}

::selection {
  background: var(--color-primary);
  color: #fff;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
  transition: background 0.2s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* --- Glass Card --- */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--card-radius);
  transition: all 0.25s var(--transition-smooth);
}
.glass-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}

/* --- Glass Navbar --- */
.nav-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
  transition: background 0.3s ease;
}

/* --- Card hover lift (removed — too fancy) --- */

/* --- Gradient hero --- */
.hero-gradient {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 50%, #4338ca 100%);
}
.dark .hero-gradient {
  background: linear-gradient(135deg, #312e81 0%, #3730a3 50%, #1e1b4b 100%);
}

/* --- Mesh gradient bg for auth pages --- */
.mesh-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(129, 140, 248, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
}
.dark .mesh-bg {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(129, 140, 248, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(99, 102, 241, 0.08) 0%, transparent 50%);
}

/* --- Inputs --- */
.input-field {
  transition: all 0.2s var(--transition-smooth);
  border-radius: var(--input-radius);
}
.input-field:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* --- Buttons --- */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--btn-radius);
  transition: all 0.2s var(--transition-smooth);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  border-radius: var(--btn-radius);
  transition: all 0.2s var(--transition-smooth);
}
.btn-secondary:hover {
  background: var(--indigo-50);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.dark .btn-secondary:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--color-primary);
  color: var(--color-primary-light);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  border-radius: var(--btn-radius);
  transition: all 0.15s var(--transition-smooth);
}
.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--color-text);
}
.dark .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
}

/* --- Status Dots --- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: all 0.3s var(--transition-smooth);
}
.status-dot-translated { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.4); }
.status-dot-confirmed { background: #6366f1; box-shadow: 0 0 6px rgba(99, 102, 241, 0.4); }
.status-dot-untranslated { background: #cbd5e1; }

/* --- Status Badge --- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: all 0.2s var(--transition-smooth);
}
.status-badge-translated {
  background: #d1fae5;
  color: #065f46;
}
.dark .status-badge-translated {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}
.status-badge-confirmed {
  background: #e0e7ff;
  color: #3730a3;
}
.dark .status-badge-confirmed {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}
.status-badge-untranslated {
  background: #f1f5f9;
  color: #64748b;
}
.dark .status-badge-untranslated {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
}

/* --- Role Badge --- */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.role-badge-owner { background: #e0e7ff; color: #3730a3; }
.role-badge-manager { background: #fef3c7; color: #92400e; }
.role-badge-reviewer { background: #ede9fe; color: #5b21b6; }
.role-badge-translator { background: #d1fae5; color: #065f46; }
.role-badge-admin { background: #fee2e2; color: #991b1b; }
.dark .role-badge-owner { background: rgba(99, 102, 241, 0.15); color: #a5b4fc; }
.dark .role-badge-manager { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.dark .role-badge-reviewer { background: rgba(167, 139, 250, 0.15); color: #c4b5fd; }
.dark .role-badge-translator { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.dark .role-badge-admin { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

/* --- Segment Item --- */
.segment-item {
  transition: all 0.2s var(--transition-smooth);
  border-radius: 10px;
  border: 1px solid transparent;
  position: relative;
}
.segment-item:hover {
  border-color: var(--color-border);
  background: rgba(0, 0, 0, 0.02);
}
.dark .segment-item:hover {
  border-color: #334155;
  background: rgba(255, 255, 255, 0.02);
}
.segment-item.active {
  background: var(--indigo-50) !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.dark .segment-item.active {
  background: rgba(99, 102, 241, 0.1) !important;
  border-color: var(--color-primary-light) !important;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.2);
}

/* --- Translation Card --- */
.translation-card {
  border-radius: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: all 0.2s var(--transition-smooth);
}
.translation-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-1px);
}

/* --- Discussion Messages --- */
.discussion-message {
  padding: 8px 12px;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.discussion-message:hover {
  background: rgba(0, 0, 0, 0.02);
}
.dark .discussion-message:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Comments section (chat style) --- */
.comments-section {
  border-left: 2px solid var(--color-border);
  padding-left: 12px;
  margin-left: 4px;
}
.dark .comments-section {
  border-left-color: #334155;
}

/* --- Search highlight --- */
mark.search-highlight {
  background: #c7d2fe;
  padding: 0 3px;
  border-radius: 3px;
}
.dark mark.search-highlight {
  background: rgba(99, 102, 241, 0.3);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  border-radius: 10px;
  background: #e2e8f0;
  overflow: hidden;
}
.dark .progress-bar {
  background: #334155;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--color-primary);
  transition: width 0.6s var(--transition-smooth);
}

/* --- Progress Ring (SVG) --- */
.progress-ring-circle {
  transition: stroke-dashoffset 0.6s var(--transition-smooth);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

/* --- Toast Notification --- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.35s var(--transition-smooth);
  max-width: 380px;
}
.toast-success {
  background: rgba(16, 185, 129, 0.95);
  color: #fff;
}
.toast-error {
  background: rgba(239, 68, 68, 0.95);
  color: #fff;
}
.toast-info {
  background: rgba(99, 102, 241, 0.95);
  color: #fff;
}
.toast-warning {
  background: rgba(245, 158, 11, 0.95);
  color: #fff;
}
.toast-removing {
  animation: toastOut 0.25s var(--transition-smooth) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to { opacity: 0; transform: translateX(40px) scale(0.95); }
}

/* --- Fade In Animation --- */
.fade-in,
.fade-in-up {
  /* no-op: entrance animations removed */
}
.fade-in-stagger > * {
  /* no-op: staggered entrance animations removed */
}

/* --- Skeleton loading shimmer --- */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

/* --- Modal overlay animation --- */
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-overlay {
  animation: overlayIn 0.2s ease;
}
.modal-content {
  animation: modalIn 0.25s var(--transition-smooth);
}

/* --- Pulse dot for live indicator --- */
@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.pulse-dot {
  animation: pulseDot 2s ease-in-out infinite;
}

/* --- Spinner brand --- */
.spinner-brand {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Content loading dimmer --- */
.content-loading {
  opacity: 0.4;
  pointer-events: none;
  user-select: none;
}

/* --- Loading dots --- */
@keyframes loadingDots {
  0%, 20% { opacity: 0; }
  50% { opacity: 1; }
  80%, 100% { opacity: 0; }
}
.loading-dot {
  animation: loadingDots 1.4s ease-in-out infinite;
}
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

/* --- File upload zone --- */
.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.2s var(--transition-smooth);
  cursor: pointer;
}
.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

/* --- Table styles --- */
.table-header {
  background: #f8fafc;
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dark .table-header {
  background: rgba(30, 41, 59, 0.5);
}
.table-row {
  transition: background 0.15s ease;
}
.table-row:hover {
  background: rgba(0, 0, 0, 0.02);
}
.dark .table-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* --- Avatar image --- */
.avatar-img {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Avatar initials --- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 16px; }
.avatar-xl { width: 56px; height: 56px; font-size: 22px; }

/* --- Tooltip --- */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: #1e293b;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.15s var(--transition-smooth);
}
.tooltip:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* --- Editor specific --- */
.editor-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

/* --- Badge counter --- */
.badge-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--color-primary);
  color: #fff;
}
.badge-counter-amber { background: #f59e0b; }
.badge-counter-green { background: #10b981; }

/* --- Nav link active indicator --- */
.nav-link {
  position: relative;
  transition: all 0.2s var(--transition-smooth);
}
.nav-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: transform 0.2s var(--transition-smooth);
}
.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* --- Empty state --- */
.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-size: 24px;
  margin: 0 auto 16px;
}
