/* ==========================================================================
   ADMIN DASHBOARD STYLES - LOJA DO CARLOS
   ========================================================================== */

:root {
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-subtle: #f0fdfa;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.admin-layout {
  display: flex;
  min-height: 100vh;
  background: #f8fafc;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #1e293b;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 24px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 24px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: #1e293b;
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35);
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid #1e293b;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-title h2 {
  font-size: 1.7rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.admin-title p {
  color: #64748b;
  font-size: 0.9rem;
}

/* Metric Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info .stat-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info .stat-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: #0f172a;
  margin-top: 4px;
}

/* Sections & Tables */
.admin-panel-section {
  display: none;
}

.admin-panel-section.active {
  display: block;
}

.content-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-top {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.card-top h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
}

/* Table */
.data-table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: #334155;
  vertical-align: middle;
}

.data-table tr:hover td {
  background: #f1f5f9;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.status-approved {
  background: #d1fae5;
  color: #065f46;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Buttons in Admin */
.btn,
.btn-primary,
.btn-outline,
.btn-danger {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-primary {
  background: #0f766e !important;
  color: #ffffff !important;
  border: 1px solid #0f766e !important;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.25);
}

.btn-primary:hover {
  background: #115e59 !important;
  border-color: #115e59 !important;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.35);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 0.8rem !important;
  border-radius: 6px !important;
  font-weight: 600 !important;
}

.btn-danger {
  background: #dc2626 !important;
  color: #ffffff !important;
  border: 1px solid #dc2626 !important;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.35);
}

.btn-danger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-outline {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #334155 !important;
}

.btn-outline:hover {
  background: #f8fafc !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
}

/* Categorias & Subcategorias Hierárquicas */
.cat-row-root {
  background: #ffffff;
  font-weight: 600;
  border-left: 4px solid var(--primary);
}

.cat-row-sub {
  background: #fafbfe;
  font-size: 0.88rem;
}

.cat-row-sub:hover td {
  background: #f1f5f9 !important;
}

.cat-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-sub-indent {
  display: inline-flex;
  align-items: center;
  color: #94a3b8;
  margin-left: 20px;
  font-family: monospace;
  font-size: 1.1rem;
}

.badge-cat-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-cat-root {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-cat-sub {
  background: #f1f5f9;
  color: #475569;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #f1f5f9;
  color: #1e293b;
  font-weight: 700;
  font-size: 0.78rem;
}

/* Feedback Box */
.feedback-box {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.feedback-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.feedback-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.feedback-loading {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* ==========================================================================
   MODAIS E FORMULÁRIOS DE EDIÇÃO (ADMIN)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-content.modal-editorial,
.modal-content {
  background: #ffffff;
  border-radius: 14px;
  max-width: 540px;
  width: 100%;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.01em;
}

.modal-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 3px;
  margin-bottom: 0;
}

.modal-header-danger {
  background: #fef2f2;
  border-bottom-color: #fee2e2;
}

.btn-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.6rem;
  cursor: pointer;
  padding: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  line-height: 1;
  transition: all 0.15s ease;
}

.btn-close:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.modal-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  overscroll-behavior: contain;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  flex-shrink: 0;
}

/* Form Styling within Modals */
.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-control,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary, #0f766e);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.form-group small {
  display: block;
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 5px;
  line-height: 1.4;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

/* Subcategory Multi-Select Chips */
.subcat-group-block {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px 12px;
}

.subcat-group-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.subcat-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.subcat-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.subcat-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.subcat-chip.selected {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.subcat-chip .chip-check {
  display: none;
  font-size: 0.85rem;
  line-height: 1;
}

.subcat-chip.selected .chip-check {
  display: inline;
}


