/* ============ Agendius Web — Design System (Soft UI Evolution) ============ */

/* --- Tipografia local (Plus Jakarta Sans, variável) --- */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('../vendor/fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2');
}

:root {
  --ag-primary: #4648d4;
  --ag-primary-2: #6063ee;
  --ag-accent: #7c3aed;
  --ag-grad: linear-gradient(135deg, #4648d4 0%, #7c3aed 100%);
  --ag-bg: #f6f7fc;
  --ag-surface: #ffffff;
  --ag-surface-2: #f2f4fb;
  --ag-text: #131a2b;
  --ag-muted: #6b7291;
  --ag-border: #e8eaf4;
  --ag-border-2: #eef0f8;
  --ag-success: #12a150;
  --ag-danger: #e5484d;
  --ag-warning: #f5a524;
  --ag-sidebar-w: 256px;
  --ag-sidebar-cw: 76px;
  --ag-radius: 16px;
  --ag-radius-sm: 11px;
  --ag-shadow-sm: 0 1px 2px rgba(20, 26, 60, .04), 0 1px 3px rgba(20, 26, 60, .04);
  --ag-shadow: 0 1px 2px rgba(20, 26, 60, .04), 0 10px 28px -8px rgba(27, 37, 89, .10);
  --ag-shadow-lg: 0 12px 40px -10px rgba(27, 37, 89, .22);
  --ag-ring: 0 0 0 4px color-mix(in srgb, var(--ag-primary) 22%, transparent);
  --bs-body-bg: var(--ag-bg);
  --bs-body-color: var(--ag-text);
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root:not([data-bs-theme="light"]) {
  color-scheme: light;
}
[data-bs-theme="dark"] {
  --ag-bg: #0b0d14;
  --ag-surface: #141824;
  --ag-surface-2: #1c2130;
  --ag-text: #e8eaf5;
  --ag-muted: #99a0bd;
  --ag-border: #242a3a;
  --ag-border-2: #1f2432;
  --ag-shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --ag-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -8px rgba(0, 0, 0, .5);
  --ag-shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, .6);
  --ag-primary: #a9abff;
  --ag-primary-2: #8f92f6;
  --ag-grad: linear-gradient(135deg, #6d6ff0 0%, #a06cf5 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ag-bg);
  color: var(--ag-text);
  font-family: var(--bs-body-font-family);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { text-decoration: none; color: inherit; }
button, [role="button"], .btn, .ag-nav-link, .ag-icon-btn, [onclick] { cursor: pointer; }
::selection { background: color-mix(in srgb, var(--ag-primary) 26%, transparent); }

/* Scrollbar discreta */
* { scrollbar-width: thin; scrollbar-color: var(--ag-border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--ag-border); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ag-muted); }

/* Foco acessível (teclado) */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-control:focus, .form-select:focus,
.ag-nav-link:focus-visible, .ag-icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--ag-ring);
  border-color: var(--ag-primary);
}

/* ---------------- Shell ---------------- */
.ag-shell { display: flex; min-height: 100vh; }
.ag-sidebar {
  width: var(--ag-sidebar-w);
  flex: 0 0 var(--ag-sidebar-w);
  background: var(--ag-surface);
  border-right: 1px solid var(--ag-border);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  transition: width .2s ease, transform .22s cubic-bezier(.4, 0, .2, 1);
  z-index: 40;
}
.ag-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 16px; font-weight: 800; font-size: 20px;
  letter-spacing: -.02em; white-space: nowrap; overflow: hidden;
}
.ag-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  display: grid; place-items: center; overflow: hidden;
}
.ag-logo img { width: 100%; height: 100%; object-fit: contain; }
.ag-brand-name {
  background: var(--ag-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ag-nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.ag-nav-link {
  display: flex; align-items: center; gap: 13px;
  padding: 10px 13px; border-radius: var(--ag-radius-sm); color: var(--ag-muted);
  font-weight: 600; font-size: 14px; white-space: nowrap; position: relative;
  transition: background .16s ease, color .16s ease;
}
.ag-nav-link i { font-size: 18px; width: 22px; text-align: center; transition: transform .16s ease; }
.ag-nav-link:hover { background: var(--ag-surface-2); color: var(--ag-text); }
.ag-nav-link:hover i { transform: translateX(1px) scale(1.05); }
.ag-nav-link.active {
  background: color-mix(in srgb, var(--ag-primary) 12%, transparent);
  color: var(--ag-primary);
}
.ag-nav-link.active::before {
  content: ""; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 20px; border-radius: 0 4px 4px 0; background: var(--ag-grad);
}
.ag-nav-sep { height: 1px; background: var(--ag-border); margin: 8px 12px; }

.ag-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.ag-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; background: color-mix(in srgb, var(--ag-surface) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--ag-border);
}
.ag-icon-btn {
  width: 40px; height: 40px; border-radius: var(--ag-radius-sm); border: 0;
  background: var(--ag-surface-2); color: var(--ag-text);
  display: grid; place-items: center; font-size: 18px;
  transition: background .16s ease, transform .12s ease;
}
.ag-icon-btn:hover { background: var(--ag-border); }
.ag-icon-btn:active { transform: scale(.94); }
.ag-search {
  flex: 1 1 auto; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  background: var(--ag-surface-2); border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius-sm); padding: 0 14px; height: 42px; color: var(--ag-muted);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.ag-search:focus-within { border-color: var(--ag-primary); box-shadow: var(--ag-ring); }
.ag-search input { flex: 1; border: 0; background: transparent; outline: none; color: var(--ag-text); font-size: 14px; font-family: inherit; }
.ag-topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.ag-user { display: flex; align-items: center; gap: 10px; }
.ag-user-info { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.ag-user-name { font-weight: 700; font-size: 14px; }
.ag-badge { font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-top: 2px; letter-spacing: .02em; }
.ag-badge-free { background: var(--ag-surface-2); color: var(--ag-muted); }
.ag-badge-premium { background: color-mix(in srgb, var(--ag-primary) 16%, transparent); color: var(--ag-primary); }
.ag-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ag-grad);
  color: #fff; display: grid; place-items: center; font-weight: 800;
  box-shadow: var(--ag-shadow-sm); overflow: hidden;
}
.ag-content { padding: 26px; max-width: 1220px; width: 100%; margin: 0 auto; }

/* --------------- Collapsed (desktop) --------------- */
body.ag-collapsed .ag-sidebar { width: var(--ag-sidebar-cw); flex-basis: var(--ag-sidebar-cw); }
body.ag-collapsed .ag-brand-name,
body.ag-collapsed .ag-nav-link span { display: none; }
body.ag-collapsed .ag-nav-link { justify-content: center; }
body.ag-collapsed .ag-nav-link.active::before { left: -10px; }
body.ag-collapsed .ag-nav-link:hover::after {
  content: attr(data-tip); position: absolute; left: 100%; margin-left: 12px;
  background: var(--ag-text); color: var(--ag-bg); padding: 6px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600; white-space: nowrap; z-index: 50; box-shadow: var(--ag-shadow);
}

/* ---------------- Cards / UI ---------------- */
.ag-card {
  background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius);
  padding: 20px; box-shadow: var(--ag-shadow);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.ag-card[onclick] { cursor: pointer; }
.ag-card[onclick]:hover { transform: translateY(-3px); box-shadow: var(--ag-shadow-lg); border-color: color-mix(in srgb, var(--ag-primary) 30%, var(--ag-border)); }
.ag-grid { display: grid; gap: 16px; }
.ag-stat { display: flex; flex-direction: column; gap: 4px; }
.ag-stat .num { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.ag-stat .lbl { color: var(--ag-muted); font-size: 13px; font-weight: 500; }
.ag-h1 { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin: 0; }
.ag-sub { color: var(--ag-muted); margin: 4px 0 0; }
.ag-section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; letter-spacing: -.01em; }
.ag-muted { color: var(--ag-muted); }
.ag-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--ag-surface-2); color: var(--ag-muted); }
.ag-pill-danger { background: color-mix(in srgb, var(--ag-danger) 15%, transparent); color: var(--ag-danger); }
.ag-pill-warning { background: color-mix(in srgb, var(--ag-warning) 18%, transparent); color: var(--ag-warning); }
.ag-progress { height: 8px; border-radius: 999px; background: var(--ag-surface-2); overflow: hidden; }
.ag-progress > span { display: block; height: 100%; border-radius: 999px; background: var(--ag-grad); transition: width .5s cubic-bezier(.4, 0, .2, 1); }

/* Botões */
.btn { font-weight: 600; border-radius: var(--ag-radius-sm); transition: transform .12s ease, box-shadow .16s ease, background .16s ease; }
.btn:active { transform: translateY(1px); }
.btn-ag { background: var(--ag-grad); border: 0; color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--ag-primary) 70%, transparent); }
.btn-ag:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 10px 22px -6px color-mix(in srgb, var(--ag-primary) 75%, transparent); }
.btn-outline-secondary { border-color: var(--ag-border); color: var(--ag-text); }
.btn-outline-secondary:hover { background: var(--ag-surface-2); border-color: var(--ag-muted); color: var(--ag-text); }

/* Formulários */
.form-control, .form-select { background: var(--ag-surface); border-color: var(--ag-border); color: var(--ag-text); border-radius: var(--ag-radius-sm); padding: .55rem .8rem; }
.form-control::placeholder { color: color-mix(in srgb, var(--ag-muted) 75%, transparent); }
.form-label { font-weight: 600; font-size: 13px; color: var(--ag-muted); margin-bottom: 5px; }

/* Modais / tabelas com o tema */
.modal-content { background: var(--ag-surface); border: 1px solid var(--ag-border); border-radius: var(--ag-radius); box-shadow: var(--ag-shadow-lg); }
.modal-header, .modal-footer { border-color: var(--ag-border); }
.table { --bs-table-bg: transparent; --bs-table-color: var(--ag-text); color: var(--ag-text); border-color: var(--ag-border); }
.table > :not(caption) > * > * { border-color: var(--ag-border); }
.table thead th { color: var(--ag-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.p-0 .table { margin: 0; }
.alert { border-radius: var(--ag-radius-sm); border: 1px solid var(--ag-border); }

.ag-task {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px;
  border: 1px solid var(--ag-border); border-radius: 14px; background: var(--ag-surface);
  box-shadow: var(--ag-shadow-sm); transition: box-shadow .16s ease, transform .16s ease;
}
.ag-task:hover { box-shadow: var(--ag-shadow); transform: translateY(-1px); }
.ag-task.overdue { border-left: 3px solid var(--ag-danger); }
.ag-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ag-border); flex: 0 0 22px; margin-top: 1px; transition: border-color .15s ease, background .15s ease; }
.ag-check:hover { border-color: var(--ag-primary); }
.ag-check.done { background: var(--ag-success); border-color: var(--ag-success); color: #fff; display: grid; place-items: center; }
.ag-done-text { text-decoration: line-through; color: var(--ag-muted); }

/* ---------------- Calendário ---------------- */
.ag-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.ag-cal-h { text-align: center; font-size: 12px; font-weight: 700; color: var(--ag-muted); padding: 4px 0; }
.ag-cal-cell { min-height: 96px; border: 1px solid var(--ag-border); border-radius: 12px; padding: 6px; background: var(--ag-surface); display: flex; flex-direction: column; gap: 3px; transition: border-color .15s ease, box-shadow .15s ease; }
.ag-cal-cell:hover { border-color: color-mix(in srgb, var(--ag-primary) 35%, var(--ag-border)); box-shadow: var(--ag-shadow-sm); }
.ag-cal-cell.empty { border: 0; background: transparent; box-shadow: none; }
.ag-cal-cell.today { border-color: var(--ag-primary); box-shadow: inset 0 0 0 1px var(--ag-primary); }
.ag-cal-num { font-size: 12px; font-weight: 700; color: var(--ag-muted); }
.ag-cal-cell.today .ag-cal-num { color: var(--ag-primary); }
.ag-cal-ev {
  border: 0; text-align: left; width: 100%;
  background: var(--ag-surface-2); color: var(--ag-text);
  border-radius: 7px; padding: 2px 6px; font-size: 11px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter .14s ease;
}
.ag-cal-ev:hover { filter: brightness(.96); }
@media (max-width: 576px) {
  .ag-cal { gap: 3px; }
  .ag-cal-cell { min-height: 64px; padding: 3px; }
  .ag-cal-ev { font-size: 9px; padding: 1px 3px; }
}

/* ---------------- Entrada com animação ---------------- */
@keyframes ag-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ag-content > * { animation: ag-rise .35s cubic-bezier(.4, 0, .2, 1) both; }

/* ---------------- Responsive ---------------- */
.ag-scrim { display: none; position: fixed; inset: 0; background: rgba(6, 10, 25, .5); backdrop-filter: blur(2px); z-index: 39; }
@media (max-width: 992px) {
  .ag-sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--ag-shadow-lg); }
  body.ag-drawer .ag-sidebar { transform: translateX(0); }
  body.ag-drawer .ag-scrim { display: block; }
  .ag-user-info { display: none; }
}
@media (max-width: 576px) {
  .ag-content { padding: 16px; }
  .ag-search { display: none; }
}

/* ---------------- Anúncios (AdSense, só FREE) ---------------- */
.ag-ad {
  margin: 0 0 18px; text-align: center; overflow: hidden;
  background: var(--ag-surface-2); border: 1px solid var(--ag-border);
  border-radius: var(--ag-radius); min-height: 90px;
  display: flex; align-items: center; justify-content: center;
}
.ag-ad::before { content: "Publicidade"; position: absolute; font-size: 10px; color: var(--ag-muted); opacity: .0; }
.ag-ad ins { width: 100%; }

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
