/* ============================================================
   ADTO.AI - Premium Design System v2
   ============================================================ */

/* === RESET === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Pretendard', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-break: keep-all;
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

.dark-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }
.dark-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* === TRANSITIONS === */
a, button, input, textarea, select {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* === SCROLL REVEAL === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(2rem); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal-item { opacity: 0; transform: translateY(2rem); }
.reveal-item.revealed {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(var(--index, 0) * 100ms);
}

/* === SPINNER === */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
.spinner-dark {
  width: 24px; height: 24px;
  border: 2.5px solid rgba(0,0,0,0.08);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
  margin: 0 auto;
}

/* === STATUS BADGES === */
.badge { padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.badge-draft { background: #f4f4f5; color: #71717a; }
.badge-analyzing { background: #eff6ff; color: #3b82f6; }
.badge-generating { background: #faf5ff; color: #a855f7; }
.badge-review { background: #fffbeb; color: #f59e0b; }
.badge-deploying { background: #f0fdf4; color: #22c55e; }
.badge-active { background: #ecfdf5; color: #10b981; }
.badge-paused { background: #fffbeb; color: #f59e0b; }
.badge-completed { background: #ecfdf5; color: #10b981; }
.badge-failed { background: #fef2f2; color: #ef4444; }

/* === FOCUS === */
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }
button:focus-visible { outline: 2px solid rgba(59,130,246,0.5); outline-offset: 2px; }
::selection { background: rgba(59,130,246,0.2); color: inherit; }

/* === PAGE ANIMATION === */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
#app-root, #dashboard-root, #admin-root { animation: pageIn 0.4s ease-out; }

/* ============================================================
   SHARED COMPONENTS
   ============================================================ */

/* Cards */
.dash-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.admin-card {
  background: white;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  text-decoration: none;
  display: block;
}

/* Input fields */
.input-field {
  width: 100%;
  padding: 12px 16px;
  background: #fafbfc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  color: #111;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.input-field::placeholder { color: #bbb; }
.input-field:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
  background: white;
}
textarea.input-field { resize: vertical; min-height: 80px; }

/* Primary button */
.btn-primary {
  padding: 12px 24px;
  background: #3b82f6;
  color: white;
  font-size: 14px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-primary:hover { background: #2563eb; }
.btn-primary:active { transform: scale(0.97); }

/* Ghost button */
.btn-ghost {
  padding: 10px 16px;
  background: transparent;
  color: #666;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { border-color: #3b82f6; color: #3b82f6; }

/* ============================================================
   CUSTOMER DASHBOARD — Light sidebar
   ============================================================ */
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-item:hover { color: #111; background: #f5f6f8; }
.nav-item.active { color: #3b82f6; background: rgba(59,130,246,0.06); font-weight: 600; }

.project-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.project-row:last-child { border-bottom: 0; }
.project-row:hover { background: #fafbfc; }

/* ============================================================
   ADMIN DASHBOARD — Dark sidebar
   ============================================================ */
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  transition: all 0.2s ease;
}
.admin-nav-item:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
}
.admin-nav-item.active {
  color: white;
  background: rgba(139,92,246,0.15);
  font-weight: 600;
}
.admin-nav-item.active iconify-icon { color: #a78bfa; }

/* ============================================================
   TOGGLE SWITCH
   ============================================================ */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.toggle-switch input:checked + .toggle-slider { background: #3b82f6; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 8px 30px -8px rgba(0,0,0,0.2);
  z-index: 99999;
  transition: all 0.3s ease;
}
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }

/* ============================================================
   PROSE (Legal pages)
   ============================================================ */
.prose h1 { font-size: 32px; font-weight: 800; color: #111; margin-bottom: 24px; }
.prose h2 { font-size: 22px; font-weight: 700; color: #111; margin-top: 32px; margin-bottom: 12px; }
.prose h3 { font-size: 18px; font-weight: 600; color: #333; margin-top: 24px; margin-bottom: 8px; }
.prose p { font-size: 15px; line-height: 1.8; color: #555; margin-bottom: 12px; }
.prose ul, .prose ol { padding-left: 24px; margin-bottom: 12px; }
.prose li { font-size: 15px; line-height: 1.8; color: #555; margin-bottom: 4px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .dash-card, .admin-card { border-radius: 12px; }
}

/* ============================================================
   TOOLTIP
   ============================================================ */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: #18181b;
  color: white;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
}
