/* ============================================================
   Start Delas — Admin Design System
   Central file for all admin UI customization.
   Use CSS variables to change colors globally.
   ============================================================ */

/* ------------------------------------------------------------
   Sidebar toggle button visibility
   Breakpoint lg = 1024px (independent of Tailwind compiled classes)
   ------------------------------------------------------------ */
.sd-toggle-desktop {
  display: none;
}

.sd-toggle-mobile {
  display: inline-flex;
}

@media (min-width: 1024px) {
  .sd-toggle-desktop {
    display: inline-flex;
  }

  .sd-toggle-mobile {
    display: none;
  }
}

/* ------------------------------------------------------------
   Design Tokens
   ------------------------------------------------------------ */
:root {
  /* Brand */
  --sd-brand-primary: #FF007F;
  /* blue-600  — links ativos, botões */
  --sd-brand-secondary: #bfdbfe;
  /* blue-100  — highlights leves     */
  --sd-brand-accent: #60a5fa;
  /* blue-400  — hover, destaques     */

  /* Semantic */
  --sd-color-blue: #2563eb;
  --sd-color-indigo: #4f46e5;
  --sd-color-cyan: #0891b2;
  --sd-color-teal: #0d9488;
  --sd-color-slate: #475569;
  --sd-color-violet: #7c3aed;
  --sd-color-green: #16a34a;
  --sd-color-red: #dc2626;

  /* Card icon background opacity */
  --sd-icon-bg: rgba(255, 255, 255, 0.15);

  /* Spacing & shape */
  --sd-radius: 0.625rem;
  --sd-radius-sm: 0.375rem;
}

/* ------------------------------------------------------------
   Dashboard layout
   ------------------------------------------------------------ */
.sd-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ------------------------------------------------------------
   Stat cards grid
   ------------------------------------------------------------ */
.sd-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

@media (max-width: 1280px) {
  .sd-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .sd-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .sd-stats {
    grid-template-columns: 1fr;
  }
}

.sd-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1rem;
  border-radius: var(--sd-radius);
  color: #fff;
  text-decoration: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.sd-card:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  text-decoration: none;
  color: #fff;
}

.sd-card--blue {
  background-color: var(--sd-color-blue);
}

.sd-card--indigo {
  background-color: var(--sd-color-indigo);
}

.sd-card--cyan {
  background-color: var(--sd-color-cyan);
}

.sd-card--teal {
  background-color: var(--sd-color-teal);
}

.sd-card--slate {
  background-color: var(--sd-color-slate);
}

.sd-card--violet {
  background-color: var(--sd-color-violet);
}

.sd-card--green {
  background-color: var(--sd-color-green);
}

.sd-card--red {
  background-color: var(--sd-color-red);
}

.sd-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  background-color: var(--sd-icon-bg);
  border-radius: var(--sd-radius-sm);
  flex-shrink: 0;
}

.sd-card__icon .material-symbols-outlined {
  font-size: 1.5rem;
}

.sd-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.sd-card__value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.sd-card__label {
  font-size: 0.8rem;
  font-weight: 500;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------
   Recent activity tables
   ------------------------------------------------------------ */
.sd-tables {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .sd-tables {
    grid-template-columns: 1fr;
  }
}

.sd-table-card {
  background: #fff;
  border-radius: var(--sd-radius);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.dark .sd-table-card {
  background: #1e293b;
  border-color: #334155;
}

.sd-table-card__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.dark .sd-table-card__header {
  color: #f1f5f9;
  background: #0f172a;
  border-color: #334155;
}

.sd-table-card__header .material-symbols-outlined {
  font-size: 1.1rem;
  color: var(--sd-brand-primary);
}

.sd-table-card__body {
  overflow-x: auto;
}

/* ------------------------------------------------------------
   Table
   ------------------------------------------------------------ */
.sd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sd-table thead th {
  padding: 0.6rem 1.25rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.dark .sd-table thead th {
  color: #94a3b8;
  background: #0f172a;
  border-color: #334155;
}

.sd-table tbody td {
  padding: 0.65rem 1.25rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.dark .sd-table tbody td {
  color: #cbd5e1;
  border-color: #1e293b;
}

.sd-table tbody tr:last-child td {
  border-bottom: none;
}

.sd-table tbody tr:hover td {
  background-color: #f0f7ff;
}

.dark .sd-table tbody tr:hover td {
  background-color: #1e3a5f;
}

.sd-table a {
  color: var(--sd-brand-primary);
  font-weight: 500;
  text-decoration: none;
}

.sd-table a:hover {
  text-decoration: underline;
}

.sd-table__nowrap {
  white-space: nowrap;
}

.sd-table__truncate {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-table__empty {
  text-align: center;
  color: #94a3b8;
  padding: 2rem 0;
}

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.sd-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.7em;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sd-badge--green {
  background: #dcfce7;
  color: #15803d;
}

.sd-badge--gray {
  background: #f1f5f9;
  color: #475569;
}

.sd-badge--red {
  background: #fee2e2;
  color: #dc2626;
}

.dark .sd-badge--green {
  background: #14532d;
  color: #86efac;
}

.dark .sd-badge--gray {
  background: #1e293b;
  color: #94a3b8;
}

.dark .sd-badge--red {
  background: #450a0a;
  color: #fca5a5;
}

/* ------------------------------------------------------------
   API Docs button
   ------------------------------------------------------------ */
.sd-api-docs-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--sd-radius-sm);
  background-color: var(--sd-brand-primary);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: filter 0.15s ease;
}

.sd-api-docs-btn:hover {
  filter: brightness(1.1);
  color: #fff;
  text-decoration: none;
}

.sd-api-docs-btn .material-symbols-outlined {
  font-size: 1.1rem;
}

/* ------------------------------------------------------------
   Inline action bar (teleported into the search toolbar row)
   ------------------------------------------------------------ */

/* Container that wraps #changelist-actions after teleport */
#sd-actions-slot {
  align-items: center;
  gap: 0.5rem;
}

/* The action bar itself: reset dark-mode colours from Unfold default */
#sd-actions-slot #changelist-actions {
  color: #1e293b;
  width: auto !important;  /* remove the JS-injected px width */
}

.dark #sd-actions-slot #changelist-actions {
  color: #f1f5f9;
}

/* Strip the pink bg-primary-600 wrapper that Unfold renders inside the bar */
#sd-actions-slot #changelist-actions > div {
  background: transparent !important;
  padding: 0;
  margin: 0;
  border-radius: 0;
  gap: 0.5rem;
}

/* Action dropdown */
#sd-actions-slot select {
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  max-width: 220px;
}

.dark #sd-actions-slot select {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #475569;
}

/* "Executar" / Run button */
#sd-actions-slot button[type="submit"] {
  background: #1e293b;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

#sd-actions-slot button[type="submit"]:hover {
  background: #0f172a;
}

.dark #sd-actions-slot button[type="submit"] {
  background: #475569;
}

.dark #sd-actions-slot button[type="submit"]:hover {
  background: #64748b;
}

/* ------------------------------------------------------------
   Admin change list — first column link
   ------------------------------------------------------------ */

/* Remove the ::after overlay that blocks pointer events on rows */
#result_list tbody::after {
  pointer-events: none;
}

/* Style only the data row links (tbody th), not header sort links (thead th) */
#result_list tbody th a {
  color: var(--sd-brand-primary);
  font-weight: 500;
  text-decoration: none;
  position: relative;
  z-index: 1;
}

#result_list tbody th a:hover {
  text-decoration: underline;
}
/* ------------------------------------------------------------
   Sales consolidado — section title + period filter
   ------------------------------------------------------------ */
.sd-section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sd-text-primary);
  margin-bottom: 0.75rem;
  margin-top: 0.25rem;
}

.sd-period-form {
  display: inline-flex;
  margin: 0;
}

.sd-period-select {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--sd-border);
  border-radius: var(--sd-radius-sm);
  background: var(--sd-surface);
  color: var(--sd-text-primary);
  cursor: pointer;
}

.sd-stats--sales {
  margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------
   Error pages (404, 500, 403, 401)
   ------------------------------------------------------------ */
.sd-error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem;
  gap: 0.75rem;
}

.sd-error-page__icon .material-symbols-outlined {
  font-size: 4rem;
  color: var(--sd-brand-primary);
  opacity: 0.6;
}

.sd-error-page__code {
  font-size: 5rem;
  font-weight: 800;
  color: var(--sd-brand-primary);
  line-height: 1;
  margin: 0;
}

.sd-error-page__title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--sd-text-primary);
  margin: 0;
}

.sd-error-page__desc {
  font-size: 0.9rem;
  color: var(--sd-text-secondary);
  max-width: 360px;
  margin: 0;
}

.sd-error-page__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  background: var(--sd-brand-primary);
  color: #fff;
  border-radius: var(--sd-radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s;
}

.sd-error-page__btn:hover {
  opacity: 0.85;
  color: #fff;
  text-decoration: none;
}

.sd-error-page__btn .material-symbols-outlined {
  font-size: 1rem;
}
