/* ============================================================
   CRM PraiaValle v2 — app-light.css (tema claro, formato Tasks Report)
   Mesmos nomes de classe do tema dark (app.js compatível).
   ============================================================ */

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

body {
  background: #F2F3F7;
  color: #1F2937;
  font-family: var(--font-sans, "Inter", ui-sans-serif, system-ui, sans-serif);
}

::selection { background: rgba(18, 27, 54, 0.18); color: #121b36; }

:focus-visible { outline: 2px solid #121b36; outline-offset: 2px; }

* { scrollbar-width: thin; scrollbar-color: rgba(107, 114, 128, 0.3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(107, 114, 128, 0.25); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(107, 114, 128, 0.45); }
*::-webkit-scrollbar-track { background: transparent; }

/* ============ Cards ============ */
.glass, .glass-card-premium {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 1rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -16px rgba(16, 24, 40, 0.12);
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.glass-card-premium:hover { border-color: #D1D5DB; box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 14px 32px -18px rgba(16, 24, 40, 0.18); }

.glass-strong {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 1rem;
  box-shadow: 0 24px 60px -24px rgba(16, 24, 40, 0.28);
}

/* ============ Sidebar ============ */
.sidebar {
  width: 264px;
  background: #FFFFFF;
  border-right: 1px solid #E5E7EB;
  transition: width .28s cubic-bezier(.4,0,.2,1), transform .28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}

body.sidebar-collapsed .sidebar { width: 78px; }
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .sidebar-section-label,
body.sidebar-collapsed .sidebar .sidebar-logo-text,
body.sidebar-collapsed .sidebar .sidebar-user-info,
body.sidebar-collapsed .sidebar .sidebar-user-chevron,
body.sidebar-collapsed .sidebar .sidebar-footer-hint,
body.sidebar-collapsed .sidebar .sidebar-sub { display: none; }
body.sidebar-collapsed .sidebar .sidebar-item { justify-content: center; padding: 0.72rem 0; }
body.sidebar-collapsed .sidebar .nav-badge { position: absolute; top: 4px; right: 6px; }
body.sidebar-collapsed .sidebar .sidebar-item { position: relative; }
body.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 1.1rem 0; }
body.sidebar-collapsed .sidebar-user { justify-content: center; }
body.sidebar-collapsed .main-content { margin-left: 78px; }

.main-content { margin-left: 264px; transition: margin-left .28s cubic-bezier(.4,0,.2,1); }

.sidebar-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .58rem .85rem; border-radius: .7rem;
  color: #6B7280; font-size: .875rem; font-weight: 500;
  border: 1px solid transparent; transition: all .18s ease; position: relative;
}
.sidebar-item:hover { color: #1F2937; background: #F9FAFB; }
.sidebar-item.active {
  color: #121b36; font-weight: 600;
  background: #e6e9f3;
  border-color: #c9d0e3;
}
.sidebar-item.active .nav-icon { color: #121b36; }
.sidebar-item.active::before {
  content: ""; position: absolute; left: -0.85rem; top: 22%; bottom: 22%;
  width: 3px; border-radius: 4px; background: #121b36;
}
.sidebar-item .sidebar-sub-item { margin-left: 2.6rem; }

.sidebar-sub {
  margin-left: 2.55rem; padding: .3rem 0 .2rem;
  border-left: 1px solid #E5E7EB;
  display: flex; flex-direction: column; gap: .15rem;
}

@media (max-width: 1023px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; transform: translateX(-100%); }
  body.sidebar-mobile-open .sidebar { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  body.sidebar-collapsed .sidebar { width: 264px; }
}

/* ============ Topbar ============ */
.topbar-glass {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid #E5E7EB;
}

/* ============ Botões / inputs ============ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: #111827; color: #FFFFFF; font-weight: 600; font-size: .875rem;
  padding: .58rem 1.1rem; border-radius: .7rem;
  border: 1px solid #111827;
  box-shadow: 0 8px 20px -10px rgba(17, 24, 39, 0.45);
  transition: all .2s ease;
}
.btn-primary:hover { background: #1F2937; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  color: #6B7280; font-weight: 500; font-size: .875rem;
  padding: .58rem 1rem; border-radius: .7rem;
  border: 1px solid #E5E7EB; background: #FFFFFF;
  transition: all .2s ease;
}
.btn-ghost:hover { color: #1F2937; border-color: #D1D5DB; background: #F9FAFB; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.35rem; height: 2.35rem; border-radius: .7rem;
  color: #6B7280; border: 1px solid #E5E7EB; background: #FFFFFF; transition: all .2s ease;
}
.btn-icon:hover { color: #1F2937; border-color: #D1D5DB; background: #F9FAFB; }

.input-field {
  width: 100%;
  background: #FFFFFF;
  border: 1px solid #E5E7EB; border-radius: .7rem;
  padding: .58rem .9rem; font-size: .875rem; color: #1F2937;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-field::placeholder { color: #9CA3AF; }
.input-field:focus { outline: none; border-color: #33447a; box-shadow: 0 0 0 3px rgba(18, 27, 54, 0.12); }

/* Search inputs com ícone à esquerda: o shorthand do .input-field (padding: .58rem .9rem)
   sobrescreve o pl-9/pl-10 do Tailwind na cascata. Specificity maior restaura o padding. */
.input-field.pl-9 { padding-left: 2.25rem; }
.input-field.pl-10 { padding-left: 2.5rem; }

/* Dropdown nativo dos selects — options com espaçamento (não gruda na lateral) */
select option {
  padding: .5rem .9rem;
  color: #1F2937;
  background: #FFFFFF;
}

/* ============ Badges (light) ============ */
.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .22rem .6rem; border-radius: 999px; white-space: nowrap;
}
.badge-dot::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: currentColor; }

/* Badge padrão de status */
.badge-status {
  color: #4B5563;
  border-radius: 4px;
}

/* Tooltip no topo (usa data-tooltip no elemento) */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  background: #1F2937;
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity .15s ease, transform .15s ease;
}
[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  border: 5px solid transparent;
  border-top-color: #1F2937;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity .15s ease, transform .15s ease;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Bolinha do badge de status */
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9CA3AF;
  flex-shrink: 0;
}

.badge-sky,
.badge-amber,
.badge-orange,
.badge-violet,
.badge-indigo,
.badge-cyan,
.badge-emerald,
.badge-rose,
.badge-zinc,
.badge-lagoon {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .7rem; font-weight: 600; letter-spacing: .02em;
  padding: .22rem .6rem; border-radius: 999px; white-space: nowrap;
}
.badge-sky     { color: #0369A1; background: #F0F9FF; border: 1px solid #BAE6FD; }
.badge-amber   { color: #B45309; background: #FFFBEB; border: 1px solid #FDE68A; }
.badge-orange  { color: #C2410C; background: #FFF7ED; border: 1px solid #FED7AA; }
.badge-violet  { color: #121b36; background: #e6e9f3; border: 1px solid #c9d0e3; }
.badge-indigo  { color: #4338CA; background: #EEF2FF; border: 1px solid #C7D2FE; }
.badge-cyan    { color: #0E7490; background: #ECFEFF; border: 1px solid #A5F3FC; }
.badge-emerald { color: #047857; background: #ECFDF5; border: 1px solid #A7F3D0; }
.badge-rose    { color: #BE123C; background: #FFF1F2; border: 1px solid #FECDD3; }
.badge-zinc    { color: #4B5563; background: #F9FAFB; border: 1px solid #E5E7EB; }
.badge-lagoon  { color: #121b36; background: #e6e9f3; border: 1px solid #c9d0e3; }

/* ============ Tabelas ============ */
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table thead th {
  text-align: left; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #9CA3AF; padding: .65rem .9rem; border-bottom: 1px solid #E5E7EB; white-space: nowrap;
}
.data-table tbody td { padding: .8rem .9rem; border-bottom: 1px solid #F3F4F6; color: #6B7280; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #F9FAFB; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ============ Avatares ============ */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: .75rem; font-weight: 700; letter-spacing: .02em; flex-shrink: 0;
  background: linear-gradient(140deg, var(--avatar-a, #121b36), var(--avatar-b, #243260));
  color: #FFFFFF; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 10px -6px rgba(0,0,0,.35);
}

/* ============ Kanban (light) ============ */
.kanban-col { transition: background .2s ease, border-color .2s ease; }
.kanban-col.drag-over { background: #e6e9f3 !important; border-color: #5a6da3 !important; }
.kanban-card { cursor: grab; transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; background: #FFFFFF; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; transform: rotate(1.5deg) scale(1.02); box-shadow: 0 24px 48px -18px rgba(0,0,0,.25); }
.kanban-card.ghost { opacity: .35; border-style: dashed; }

/* ============ Dropdowns ============ */
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + .5rem); min-width: 240px; z-index: 50;
  opacity: 0; visibility: hidden; transform: translateY(6px) scale(.98);
  transition: all .18s cubic-bezier(.4,0,.2,1); transform-origin: top right;
  text-align: left; /* botões têm text-align:center por UA default — dropdown herda e centraliza os itens */
}
.dropdown-open .dropdown-menu, .dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

/* ============ Reveal ============ */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* ============ Progress ============ */
.progress-track { background: #E5E7EB; border-radius: 999px; overflow: hidden; height: 8px; }
.progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #121b36, #243260);
  box-shadow: 0 0 10px rgba(18, 27, 54, 0.35);
  transition: width .8s cubic-bezier(.22,1,.36,1);
}

/* ============ Stacked navy bar (card Pipeline) ============ */
.stack-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; gap: 3px; }
.stack-bar > span { border-radius: 999px; }

/* ============ Tabs (light) ============ */
.tab-item {
  padding: .5rem .95rem; border-radius: .6rem;
  font-size: .8rem; font-weight: 500; color: #6B7280;
  border: 1px solid transparent; cursor: pointer; transition: all .18s ease;
}
.tab-item:hover { color: #1F2937; background: #F9FAFB; }
.tab-item.active { color: #121b36; background: #e6e9f3; border-color: #c9d0e3; font-weight: 600; }

/* ============ Toast ============ */
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
.toast-item { animation: toast-in .3s cubic-bezier(.22,1,.36,1); }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.pulse-dot { animation: pulse-dot 2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
