/* assets/css/dashboard.css */
:root {
  --bg: #050507;
  --card: #0D0D12;
  --card-el: #111116;
  --purple: #6C47FF;
  --purple2: #8B5CFF;
  --white: #FFF;
  --text2: #A1A1AA;
  --text3: #71717A;
  --border: #202027;
  --border-purple: rgba(108, 71, 255, .35);
  --green: #22C55E;
  --red: #F87171;
  --wa-green: #25D366;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
.mono { font-family: 'JetBrains Mono', monospace; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: var(--card-el);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 49;
  opacity: 0;
  transition: opacity .2s ease;
}
.sidebar-backdrop.open { display: block; opacity: 1; }

@media (max-width: 880px) {
  .sidebar-toggle { display: flex; }
  .sidebar {
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.7,.3,1);
  }
  .sidebar.open { transform: translateX(0); }
  .main { padding-top: 70px; }
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img { width: 28px; height: 28px; object-fit: contain; }

.nav { flex: 1; padding: 12px; overflow-y: auto; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text2);
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}

.nav a:hover { background: var(--card-el); color: var(--white); }
.nav a.active { background: rgba(108,71,255,.14); color: #B794F6; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text2);
  font-size: 14px;
}
.logout-btn:hover { background: var(--card-el); color: var(--white); }

.main { flex: 1; min-width: 0; padding: 28px 32px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar p { font-size: 13px; color: var(--text3); margin-top: 2px; }

/* Voltar + breadcrumb das páginas internas do dashboard */
.page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  background: var(--card-el);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px 6px 8px;
  margin-bottom: 12px;
  transition: border-color .15s, color .15s;
}
.page-back:hover { border-color: var(--purple); color: #fff; }
.page-back .icon { width: 15px; height: 15px; color: var(--purple); }

.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text3); margin-bottom: 10px; }
.breadcrumbs a { color: var(--text2); }
.breadcrumbs a:hover { color: #fff; }
.breadcrumbs .sep { opacity: .5; }

/* Sino de notificações do lojista */
.notif-wrap { position: relative; }
.notif-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px;
  background: var(--card-el); border: 1px solid var(--border); color: var(--text2);
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-btn:hover { border-color: var(--purple); color: #fff; }
.notif-badge {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 100px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.notif-panel {
  position: absolute; right: 0; top: 48px; width: 340px; max-width: 86vw; z-index: 70;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.5); overflow: hidden;
}
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 700; }
.notif-panel-head button { background: none; border: none; color: var(--purple2); font-size: 12px; font-weight: 600; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--border); padding: 12px 14px; color: inherit; }
.notif-item:hover { background: var(--card-el); }
.notif-item.unread { background: rgba(108,71,255,.08); }
.notif-item .t { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.notif-item .t .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--purple2); flex-shrink: 0; }
.notif-item .b { font-size: 12.5px; color: var(--text2); margin-top: 3px; }
.notif-item .d { font-size: 11.5px; color: var(--text3); margin-top: 5px; }
.notif-empty { padding: 26px 14px; text-align: center; font-size: 13px; color: var(--text3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge.draft { background: rgba(245,185,66,.14); color: #FBD38D; }
.badge.active { background: rgba(34,197,94,.14); color: #4ADE80; }
.badge.inactive { background: rgba(113,113,122,.18); color: var(--text2); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--purple);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  box-shadow: 0 4px 20px rgba(108,71,255,.25);
  transition: background .2s, transform .2s;
}
.btn-primary:hover { background: var(--purple2); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: default; transform: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card-el);
  border: 1px solid var(--border);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}
.btn-secondary:hover { border-color: var(--border-purple); }

.btn-danger {
  background: rgba(248,113,113,.12);
  border: 1px solid rgba(248,113,113,.3);
  color: var(--red);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}
.btn-danger:hover { background: rgba(248,113,113,.2); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.stat-card .label { font-size: 12.5px; color: var(--text3); margin-bottom: 8px; }
.stat-card .value { font-size: 22px; font-weight: 800; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 20px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text3);
  font-size: 13.5px;
}

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text3);
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
table.data-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table tr:last-child td { border-bottom: none; }
table.data-table img.thumb {
  width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--card-el);
}

.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--card-el);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s;
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--purple); }

/* Foco visível (acessibilidade) — mesmo padrão do store.css. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
.form-hint { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text2); }
.checkbox-row input { accent-color: var(--purple); }

/* modal simples */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}
.modal-close { background: none; border: none; color: var(--text3); font-size: 20px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

#loadingScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--text3);
  font-size: 14px;
}

@media (max-width: 860px) {
  .main { padding: 20px; padding-top: 70px; }
  table.data-table { display: block; overflow-x: auto; white-space: nowrap; }
}

@media (max-width: 560px) {
  .main { padding: 16px; padding-top: 68px; }
  .topbar { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
  .topbar > div { min-width: 0; }
  .form-row { flex-direction: column; gap: 0; }
  .card-body { padding: 16px; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .modal-header { position: sticky; top: 0; z-index: 1; background: var(--card); padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { position: sticky; bottom: 0; background: var(--card); padding: 12px 16px; }
  .modal-footer > button { flex: 1; min-height: 42px; }
}
