/*
  Design system inspirado no shadcn/ui, implementado em CSS puro
  (sem React) para ser usado em templates Django.
  Tokens de cor seguem o tema "Neutral" do shadcn/ui.
*/

:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --success: 142 71% 45%;
  --success-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --brand: 221 83% 53%;
  --brand-foreground: 0 0% 98%;
  --radius: 0.625rem;
}

html.dark {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 6% 10%;
  --card-foreground: 0 0% 98%;
  --popover: 240 6% 10%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
  --brand: 217 91% 60%;
  --brand-foreground: 0 0% 98%;
}

* {
  border-color: hsl(var(--border));
}

[x-cloak] { display: none !important; }

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Botões ---------- */

.sd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0 1rem;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, opacity .15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  outline: none;
}
.sd-btn:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}
.sd-btn:disabled, .sd-btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.sd-btn-default {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}
.sd-btn-default:hover { opacity: 0.9; }

.sd-btn-brand {
  background-color: hsl(var(--brand));
  color: hsl(var(--brand-foreground));
}
.sd-btn-brand:hover { opacity: 0.9; }

.sd-btn-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}
.sd-btn-secondary:hover { opacity: 0.8; }

.sd-btn-outline {
  background-color: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
.sd-btn-outline:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.sd-btn-ghost {
  background-color: transparent;
  color: hsl(var(--foreground));
}
.sd-btn-ghost:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

.sd-btn-destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}
.sd-btn-destructive:hover { opacity: 0.9; }

.sd-btn-link {
  background-color: transparent;
  color: hsl(var(--foreground));
  text-decoration: underline;
  text-underline-offset: 4px;
  height: auto;
  padding: 0;
}

.sd-btn-sm { height: 2.25rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.sd-btn-lg { height: 2.75rem; padding: 0 2rem; font-size: 0.9375rem; }
.sd-btn-icon { height: 2.5rem; width: 2.5rem; padding: 0; }
.sd-btn-block { width: 100%; }

/* ---------- Inputs / campos de formulário ---------- */

.sd-label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: hsl(var(--foreground));
  display: inline-block;
  margin-bottom: 0.5rem;
}

.sd-input, .sd-textarea, .sd-select {
  display: flex;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color .15s ease, box-shadow .15s ease;
  outline: none;
}
.sd-input { height: 2.5rem; }
.sd-select { height: 2.5rem; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; padding-right: 2.25rem; }
.sd-textarea { min-height: 5rem; resize: vertical; }

.sd-input::placeholder, .sd-textarea::placeholder { color: hsl(var(--muted-foreground)); }

.sd-input:focus, .sd-textarea:focus, .sd-select:focus {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.15);
}

.sd-input.sd-input-error, .sd-textarea.sd-input-error, .sd-select.sd-input-error {
  border-color: hsl(var(--destructive));
}
.sd-input.sd-input-error:focus, .sd-textarea.sd-input-error:focus {
  box-shadow: 0 0 0 3px hsl(var(--destructive) / 0.15);
}

.sd-field-error {
  font-size: 0.8125rem;
  color: hsl(var(--destructive));
  margin-top: 0.375rem;
}
.sd-field-help {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.375rem;
}

.sd-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sd-checkbox {
  height: 1rem;
  width: 1rem;
  border-radius: 0.25rem;
  border: 1px solid hsl(var(--input));
  accent-color: hsl(var(--primary));
  cursor: pointer;
}

.sd-file-input {
  display: block;
  width: 100%;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}
.sd-file-input::file-selector-button {
  margin-right: 1rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

/* ---------- Card ---------- */

.sd-card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
.sd-card-header { padding: 1.5rem 1.5rem 0 1.5rem; }
.sd-card-title { font-size: 1.125rem; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; }
.sd-card-description { font-size: 0.875rem; color: hsl(var(--muted-foreground)); margin-top: 0.25rem; }
.sd-card-content { padding: 1.5rem; }
.sd-card-footer { padding: 0 1.5rem 1.5rem 1.5rem; display: flex; align-items: center; gap: 0.75rem; }

/* ---------- Badge ---------- */

.sd-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 9999px;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.sd-badge-default { background-color: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.sd-badge-secondary { background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.sd-badge-outline { background-color: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.sd-badge-brand { background-color: hsl(var(--brand) / 0.12); color: hsl(var(--brand)); }
.sd-badge-success { background-color: hsl(var(--success) / 0.12); color: hsl(var(--success)); }

/* ---------- Alert / mensagens ---------- */

.sd-alert {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  padding: 1rem;
  font-size: 0.875rem;
  background-color: hsl(var(--background));
}
.sd-alert-success { border-color: hsl(var(--success) / 0.3); background-color: hsl(var(--success) / 0.08); color: hsl(var(--success)); }
.sd-alert-error { border-color: hsl(var(--destructive) / 0.3); background-color: hsl(var(--destructive) / 0.08); color: hsl(var(--destructive)); }
.sd-alert-info { border-color: hsl(var(--brand) / 0.3); background-color: hsl(var(--brand) / 0.08); color: hsl(var(--brand)); }
.sd-alert-warning { border-color: 38 92% 50% / 0.3; background-color: hsl(38 92% 50% / 0.1); color: hsl(38 92% 40%); }

/* ---------- Avatar ---------- */

.sd-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
}
.sd-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Progress ---------- */

.sd-progress {
  width: 100%;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: hsl(var(--secondary));
  overflow: hidden;
}
.sd-progress-bar {
  height: 100%;
  border-radius: 9999px;
  background-color: hsl(var(--brand));
  transition: width .4s ease;
}

/* ---------- Separator ---------- */

.sd-separator {
  height: 1px;
  background-color: hsl(var(--border));
  border: none;
}

/* ---------- Tabela ---------- */

.sd-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.sd-table thead th {
  text-align: left;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
}
.sd-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.sd-table tbody tr:last-child td { border-bottom: none; }
.sd-table tbody tr:hover { background-color: hsl(var(--accent) / 0.5); }

/* ---------- Sidebar navigation ---------- */

.sd-nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: background-color .15s ease, color .15s ease;
}
.sd-nav-link:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.sd-nav-link.active { background-color: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }

/* ---------- Dropdown menu ---------- */

.sd-dropdown-content {
  min-width: 12rem;
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  padding: 0.25rem;
}
.sd-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  color: hsl(var(--popover-foreground));
  cursor: pointer;
}
.sd-dropdown-item:hover { background-color: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

/* ---------- Dialog / modal ---------- */

.sd-dialog-overlay {
  position: fixed;
  inset: 0;
  background-color: rgb(0 0 0 / 0.5);
  z-index: 50;
}
.sd-dialog-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  max-width: 28rem;
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
  padding: 1.5rem;
  z-index: 51;
}

/* ---------- Skeleton loading (foto) ---------- */

.sd-skeleton {
  background-color: hsl(var(--muted));
  border-radius: var(--radius);
  animation: sd-pulse 1.5s ease-in-out infinite;
}
@keyframes sd-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------- Utilidades específicas do fluxo de currículo ---------- */

.sd-auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-color: hsl(var(--muted) / 0.4);
  padding: 1.5rem;
}

.sd-skill-level-dot {
  height: 0.5rem;
  width: 0.5rem;
  border-radius: 9999px;
  background-color: hsl(var(--border));
}
.sd-skill-level-dot.filled { background-color: hsl(var(--brand)); }
