/* ── Ícones Lucide ──────────────────────────────────────────────────────── */
svg.lucide {
  stroke-width: 1.6 !important;
  color: currentColor;
  transition: all 0.2s ease;
}

/* ── Layout root ────────────────────────────────────────────────────────── */
.layout-root {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────
   Desktop: aberta = 260px | colapsada = 64px (só ícones)
   Mobile:  overlay deslizante via transform
   Estado persistido em localStorage
   ───────────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: width 0.22s ease, transform 0.22s ease;
}

/* Estado colapsado — desktop */
.sidebar.sidebar-collapsed { width: 64px; }

/* Ocultar labels quando colapsado */
.sidebar.sidebar-collapsed .menu-group { opacity: 0; height: 0; margin: 0; overflow: hidden; }
.sidebar.sidebar-collapsed .menu-item span { display: none; }
.sidebar.sidebar-collapsed .menu-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}
.sidebar.sidebar-collapsed .sidebar-header { justify-content: center; padding: 0 8px; }
.sidebar.sidebar-collapsed .sidebar-logo-full { display: none; }
.sidebar.sidebar-collapsed .sidebar-logo-icon { display: flex !important; }
.sidebar.sidebar-collapsed .sidebar-footer { padding: 10px 8px; }
.sidebar.sidebar-collapsed .sidebar-footer-trigger { justify-content: center; padding: 6px 0; }
.sidebar.sidebar-collapsed .sidebar-footer-trigger .sidebar-footer-name,
.sidebar.sidebar-collapsed .sidebar-footer-trigger .sidebar-footer-chevron { display: none; }

/* Tooltip nos items quando colapsado */
.sidebar.sidebar-collapsed .menu-item { position: relative; }
.sidebar.sidebar-collapsed .menu-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--panel);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 100;
}
.sidebar.sidebar-collapsed .menu-item:hover::after { opacity: 1; }

/* Logo icon (só aparece colapsado) */
.sidebar-logo-icon { display: none; }

/* ── Sidebar Header ─────────────────────────────────────────────────────── */
.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

/* ── Sidebar Content ────────────────────────────────────────────────────── */
.sidebar-content {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Menu Group ─────────────────────────────────────────────────────────── */
.menu-group {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  padding-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  transition: opacity 0.15s ease, height 0.15s ease;
}

/* ── Menu Item ──────────────────────────────────────────────────────────── */
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
}

.menu-item span { transition: opacity 0.15s ease; overflow: hidden; }
.menu-item svg.lucide { color: var(--muted); flex-shrink: 0; }
.menu-item:hover { color: var(--text); background-color: var(--bg); }
.menu-item:hover svg.lucide { color: var(--text); }

.menu-item-active {
  color: var(--brand-primary);
  background-color: rgba(15, 111, 255, 0.08);
  border-color: rgba(15, 111, 255, 0.15);
  font-weight: 600;
}

html[data-theme="dark"] .menu-item-active,
html.dark .menu-item-active {
  color: #ffffff;
  background-color: rgba(15, 111, 255, 0.15);
  border-color: rgba(15, 111, 255, 0.25);
}

.menu-item-active svg.lucide { color: var(--brand-primary) !important; }
html[data-theme="dark"] .menu-item-active svg.lucide,
html.dark .menu-item-active svg.lucide { color: var(--brand-accent) !important; }

/* ── Sidebar Footer ─────────────────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  flex-shrink: 0;
}

/* ── Avatar ─────────────────────────────────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  flex-shrink: 0;
}

/* ── Content Shell ──────────────────────────────────────────────────────── */
.content-shell {
  margin-left: 260px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.22s ease;
}

.content-shell.sidebar-collapsed { margin-left: 64px; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 30;
}

/* ── Content ────────────────────────────────────────────────────────────── */
.content {
  padding: 24px;
  flex: 1;
  background: var(--bg);
}

.left-panel, .actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Icon Button ────────────────────────────────────────────────────────── */
.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-button svg.lucide { width: 16px !important; height: 16px !important; }
.icon-button:hover { color: var(--text); background: var(--bg); border-color: var(--line); }

/* ── Botão Catálogo Público (Verde se true, Vermelho se false) ────────── */
.catalog-toggle-button[data-public="1"],
.catalog-toggle-button.text-emerald-600 {
  color: #059669 !important;
}
.catalog-toggle-button[data-public="1"]:hover,
.catalog-toggle-button.text-emerald-600:hover {
  color: #047857 !important;
  background: rgba(5, 150, 105, 0.1) !important;
  border-color: rgba(5, 150, 105, 0.3) !important;
}
.catalog-toggle-button[data-public="0"],
.catalog-toggle-button.text-red-600 {
  color: #dc2626 !important;
}
.catalog-toggle-button[data-public="0"]:hover,
.catalog-toggle-button.text-red-600:hover {
  color: #b91c1c !important;
  background: rgba(220, 38, 38, 0.1) !important;
  border-color: rgba(220, 38, 38, 0.3) !important;
}

/* ── Button ─────────────────────────────────────────────────────────────── */
.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.button-primary { background: var(--brand-primary); color: #ffffff; border-color: var(--brand-primary); }
.button-primary:hover { opacity: 0.95; }

.button-secondary {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
}
.button-secondary:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--line);
}

/* ── Action Links ───────────────────────────────────────────────────────── */
.action-link { font-size: 13px; font-weight: 500; text-decoration: none; }
.action-link-primary { color: var(--brand-primary); }
.action-link-primary:hover { text-decoration: underline; }
.action-link-warning { color: var(--warning); }
.action-link-warning:hover { text-decoration: underline; }

/* ── Status ─────────────────────────────────────────────────────────────── */
.status-icon-success { color: var(--success); }
.status-icon-warning { color: var(--warning); }
.status-icon-info    { color: var(--brand-primary); }
.status-icon-accent  { color: var(--brand-accent); }

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

.status-chip-success { background-color: rgba(0, 208, 132, 0.1); color: var(--success); }
.status-chip-warning { background-color: rgba(255, 193, 7, 0.1); color: var(--warning); }

/* ── Input ──────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease;
}

.input:focus { border-color: var(--text); }
html[data-theme="dark"] select.input option,
html.dark select.input option {
  background: var(--panel);
  color: var(--text);
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  background: var(--panel);
}

.card h2, .card h3 { color: var(--text); }

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1 { color: var(--text); }

/* ── Section Title ──────────────────────────────────────────────────────── */
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

/* ── Table ──────────────────────────────────────────────────────────────── */
table thead th { color: var(--text); font-weight: 600; }
table tbody tr { border-bottom: 1px solid var(--line); }

/* ── Code ───────────────────────────────────────────────────────────────── */
code { font-family: 'Courier New', monospace; font-weight: 500; }

/* ── Badge / Avatar variants ────────────────────────────────────────────── */
.badge-dark {
  background-color: #0f172a;
  color: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

html[data-theme="dark"] .badge-dark,
html.dark .badge-dark { background-color: rgba(15, 23, 42, 0.3); color: var(--text); }
.avatar-dark { background-color: #0f172a; color: #ffffff; }
html[data-theme="dark"] .avatar-dark,
html.dark .avatar-dark { background-color: rgba(15, 23, 42, 0.4); }

/* ── Alpine x-cloak ─────────────────────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    width: 260px !important;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
  }
  .sidebar.sidebar-open { transform: translateX(0); }

  /* No mobile: ignorar estado colapsado */
  .sidebar.sidebar-collapsed { width: 260px !important; }
  .sidebar.sidebar-collapsed .menu-group { opacity: 1; height: auto; margin-bottom: 4px; overflow: visible; }
  .sidebar.sidebar-collapsed .menu-item { justify-content: flex-start; padding: 8px 12px; gap: 10px; }
  .sidebar.sidebar-collapsed .menu-item span { display: inline; }
  .sidebar.sidebar-collapsed .menu-item::after { display: none; }
  .sidebar.sidebar-collapsed .sidebar-header { justify-content: flex-start; padding: 0 16px; }
  .sidebar.sidebar-collapsed .sidebar-logo-full { display: flex !important; }
  .sidebar.sidebar-collapsed .sidebar-logo-icon { display: none !important; }
  .sidebar.sidebar-collapsed .sidebar-footer { padding: 12px; }
  .sidebar.sidebar-collapsed .sidebar-footer-trigger { justify-content: space-between; padding: 6px 4px; }
  .sidebar.sidebar-collapsed .sidebar-footer-trigger .sidebar-footer-name,
  .sidebar.sidebar-collapsed .sidebar-footer-trigger .sidebar-footer-chevron { display: block !important; }

  .content-shell,
  .content-shell.sidebar-collapsed { margin-left: 0; }

  .page-header { flex-direction: column; align-items: flex-start; }
}
