/* ===========================
   BASE
=========================== */
body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #f5f7fb;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background: #1e1e2d;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
  overflow-y: auto;
}
.sidebar h2 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 20px;
}
.sidebar a {
  display: block;
  padding: 12px 20px;
  color: #bbb;
  text-decoration: none;
  transition: background .3s, color .3s;
}
.sidebar a:hover,
.sidebar a.active {
  background: #2a2a40;
  color: #fff;
}
.submenu-toggle {
  font-weight: bold;
  cursor: pointer;
  padding: 12px 20px;
  color: #bbb;
}
.submenu-toggle:hover {
  background: #2a2a40;
  color: #fff;
}
.submenu-items {
  display: none;
  flex-direction: column;
}
.submenu.open .submenu-items {
  display: flex;
}
.submenu-items a {
  padding-left: 40px;
  font-size: 14px;
}

/* ===========================
   MAIN CONTENT
=========================== */
.main {
  margin-left: 240px;
  padding: 20px;
}

/* ===========================
   TOPBAR
=========================== */
.topbar {
  background: #fff;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar-left {
  font-weight: bold;
  font-size: 16px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}
.topbar .user {
  font-weight: bold;
  position: relative;
  cursor: pointer;
}
.topbar button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #dc3545;
  color: #fff;
  cursor: pointer;
}
.topbar button:hover {
  background: #a71d2a;
}

/* ===========================
   NOTIFICAÇÕES
=========================== */
.notification {
  position: relative;
  cursor: pointer;
}
.notification i {
  font-size: 18px;
  color: #555;
}
.notification .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #dc3545;
  color: #fff;
  border-radius: 50%;
  padding: 2px 5px;
  font-size: 11px;
  font-weight: bold;
}
.notification-box {
  display: none;
  position: absolute;
  top: 28px;
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  width: 340px;
  z-index: 1000;
  padding: 10px;
}
.notification-box h4 {
  margin: 6px 10px 10px;
  font-size: 15px;
  font-weight: 700;
}
.notification-box .item {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.notification-box .item:last-child {
  border-bottom: none;
}
.notification-box .item i {
  color: #4a6cf7;
  margin-top: 2px;
}
.notification-box .item .title {
  line-height: 1.2;
}
.notification-box .item .meta {
  margin-top: 2px;
  color: #888;
  font-size: 12px;
}
.notification-box .notif-link {
  display: block;
  text-align: center;
  padding: 8px 0 2px;
  color: #4a6cf7;
  text-decoration: none;
  font-size: 13px;
}

/* ===========================
   USER MENU
=========================== */
.user-menu {
  position: absolute;
  right: 0;
  top: 28px;
  width: 220px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  display: none;
  overflow: hidden;
  z-index: 1000;
}
.user-menu a {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: #222;
  font-size: 14px;
}
.user-menu a i {
  width: 18px;
  margin-right: 8px;
  color: #4a6cf7;
}
.user-menu a:hover {
  background: #f1f3f7;
}

/* ===========================
   CARDS
=========================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}
.card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  gap: 15px;
}
.card i {
  font-size: 28px;
  color: #4a6cf7;
  background: #eaf0ff;
  padding: 12px;
  border-radius: 10px;
}
.card h3 {
  margin: 0;
  font-size: 18px;
}
.card p {
  margin: 5px 0 0;
  color: #666;
  font-size: 14px;
}

/* ===========================
   GRÁFICO
=========================== */
.chart-section {
  margin-top: 30px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.chart-section h2 {
  margin-bottom: 20px;
}
.chart-section canvas {
  width: 100%!important;
  max-height: 400px;
}

/* ===========================
   TABELA
=========================== */
.table-section {
  margin-top: 30px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
}
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}
.actions-header {
  display: flex;
  gap: 10px;
  align-items: center;
}
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.controls select,
.controls input,
.btn-cadastrar {
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #cfd4dc;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: #222;
  outline: none;
  transition: border .2s, box-shadow .2s, background .2s;
}
.controls select,
.controls input {
  min-width: 220px;
}
.controls input::placeholder {
  color: #999;
}
.controls select:focus,
.controls input:focus {
  border-color: #4a6cf7;
  box-shadow: 0 0 0 3px rgba(74,108,247,.15);
}
.btn-cadastrar {
  border: 0;
  background: #4a6cf7;
  color: #fff;
  cursor: pointer;
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-cadastrar:hover {
  background: #354ec9;
}

table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid #eee;
}
td .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Botões */
.btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  border: 0;
  cursor: pointer;
  color: #fff;
}
.btn.view { background: #0d6efd; }
.btn.view:hover { background: #0b5ed7; }
.btn.edit { background: #ffc107; color: #000; }
.btn.edit:hover { background: #e0aa06; }
.btn.delete { background: #dc3545; }
.btn.delete:hover { background: #b02a37; }
.btn.duplicate { background: #17a2b8; }
.btn.duplicate:hover { background: #148ea1; }

/* ===========================
   PAGINAÇÃO
=========================== */
.pagination {
  margin-top: 15px;
  text-align: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.page-btn {
  padding: 8px 12px;
  border: 1px solid #cfd4dc;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.page-btn.active {
  background: #4a6cf7;
  color: #fff;
  border-color: #4a6cf7;
}
.page-btn:hover {
  background: #f1f3f7;
}

/* ===========================
   FORMULÁRIOS
=========================== */
.form-section {
  background:#fff;
  border-radius:12px;
  padding:26px 20px;
  box-shadow:0 2px 6px rgba(0,0,0,.08);
  margin:20px 0;
  width:100%;
  box-sizing:border-box;
}
.section-block{margin-bottom:16px}
.form-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:16px}
.form-group label{display:block;margin-bottom:6px;font-weight:bold}
.form-group input,.form-group textarea,.form-group select{
  width:100%;padding:10px 12px;border:1px solid #ccc;border-radius:8px;font-size:14px;box-sizing:border-box
}
.form-group input:focus,.form-group textarea:focus,.form-group select:focus{border-color:#4a6cf7;box-shadow:0 0 5px rgba(74,108,247,.4);outline:none}
.col-6{grid-column:span 6}
.col-12{grid-column:span 12}
/* Tags/Categorias */
.tag-area {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #dbe4ff;
  font-size: 12px;
  color: #334155;
}
.chip .remove {
  cursor: pointer;
  color: #64748b;
}
.chip .remove:hover {
  color: #0f172a;
}
.tag-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tag-controls select {
  min-width: 240px;
  height: 40px;
}

/* Previews */
.preview-principal {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
}
.preview-principal img {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.thumb-grid img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

/* Botões grandes */
.btn-lg {
  height: 40px;
  min-width: 220px;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
}
.btn.btn-primary { background: #4a6cf7; color: #fff; }
.btn.btn-primary:hover { background: #354ec9; }
.btn.btn-light { background: #f3f4f6; color: #111827; }
.btn.btn-light:hover { background: #e5e7eb; }
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}

/* Badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge-cat {
  display: inline-block;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #334155;
  border: 1px solid #dbe4ff;
  white-space: nowrap;
}

/* ===========================
   TOASTS
=========================== */
.toast-container {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
}
.toast {
  min-width: 280px;
  max-width: 360px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,.12);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 24px 1fr 20px;
  gap: 10px;
  align-items: start;
  animation: slideIn .22s ease-out;
  border-left: 6px solid #4a6cf7;
}
.toast.success { border-left-color: #28a745; }
.toast.error { border-left-color: #dc3545; }
.toast.info { border-left-color: #4a6cf7; }
.toast .icon { font-size: 18px; margin-top: 2px; }
.toast .title { font-weight: 700; margin-bottom: 2px; }
.toast .msg { font-size: 13px; color: #4b5563; }
.toast .close { cursor: pointer; color: #94a3b8; }
.toast .close:hover { color: #111827; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===========================
   MODAL
=========================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10001;
}
.modal-card {
  width: min(520px, calc(100% - 40px));
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 12px;
}
.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #fff0f0;
  color: #dc3545;
  font-size: 22px;
}
.modal-body h3 { margin: 2px 0 6px; font-size: 18px; }
.modal-body p { margin: 0; color: #4b5563; font-size: 14px; }
.modal-actions {
  grid-column: 1/-1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}
.btn.ghost {
  background: #f3f4f6;
  color: #111827;
  border-radius: 8px;
  padding: 8px 14px;
  border: 0;
  cursor: pointer;
}
.btn.ghost:hover { background: #e5e7eb; }
.btn.danger {
  background: #dc3545;
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  border: 0;
  cursor: pointer;
}
.btn.danger:hover { background: #b02a37; }

/* Modal de Categoria Rápida corrigido */
#modalCategoria {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.55);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10002;
}

#modalCategoria .modal-card {
  width: min(480px, calc(100% - 40px));
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeIn .25s ease-out;
}

#modalCategoria .modal-body h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}

#modalCategoria .modal-body p {
  margin: 0 0 12px;
  font-size: 14px;
  color: #4b5563;
}

#modalCategoria form .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

#modalCategoria form .form-group label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

#modalCategoria form .form-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

#modalCategoria .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}


/* Miniatura de ícone na lista de categorias */
.cat-icon-thumb{width:50px;height:50px;object-fit:cover;border-radius:6px;border:1px solid #ddd;background:#f9f9f9}

.cat-icon-box{width:50px;height:50px;display:flex;align-items:center;justify-content:center;border:1px solid #ddd;border-radius:6px;background:#fff;overflow:hidden}


#previewIcone img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #ddd;
  margin-top: 8px;
}
