/* =====================================================
   PRETAH DOCERIA — Painel Administrativo Secreto
   ===================================================== */

/* ── Painel Principal ────────────────────────────────────────────────────────── */
.pretah-admin-panel {
  position: fixed;
  inset: 0;
  z-index: 999990;
  background: #1A0F14;
  display: flex;
  overflow: hidden;
  font-family: 'Poppins', sans-serif;
  animation: paFadeIn .3s ease;
}
@keyframes paFadeIn { from { opacity:0 } to { opacity:1 } }

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.pa-sidebar {
  width: 240px;
  min-width: 240px;
  background: linear-gradient(180deg, #2D1520 0%, #1A0F14 100%);
  display: flex;
  flex-direction: column;
  padding: 0;
  box-shadow: 4px 0 20px rgba(0,0,0,.3);
  transition: width .3s;
}
.pa-sidebar-logo {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.pa-sidebar-logo img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #C9788A;
}
.pa-sidebar-logo span {
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  font-weight: 700;
  color: #F0D0D8;
  line-height: 1.2;
}
.pa-sidebar-logo small { color: #9E7A84; font-size: 10px; font-family: 'Poppins', sans-serif; display: block; }

.pa-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.pa-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #B09099;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .2s;
  text-decoration: none;
}
.pa-nav-item i { font-size: 16px; width: 20px; text-align: center; }
.pa-nav-item:hover { color: #F0D0D8; background: rgba(201,120,138,.1); }
.pa-nav-item.active {
  color: #F0D0D8;
  background: rgba(201,120,138,.15);
  border-left-color: #C9788A;
}

.pa-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.pa-btn-sair {
  width: 100%;
  padding: 10px;
  background: rgba(229,115,115,.15);
  border: 1px solid rgba(229,115,115,.3);
  border-radius: 8px;
  color: #EF9A9A;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all .2s;
  font-family: 'Poppins', sans-serif;
}
.pa-btn-sair:hover { background: rgba(229,115,115,.25); }

/* ── Conteúdo Principal ─────────────────────────────────────────────────────── */
.pa-main {
  flex: 1;
  background: #F7F0F3;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pa-topbar {
  background: #fff;
  padding: 16px 28px;
  border-bottom: 1px solid #EDD5D5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.pa-topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: #7B3D5A;
  font-weight: 700;
}
.pa-topbar-info { font-size: 13px; color: #9E7A84; }

.pa-content { flex: 1; padding: 28px; }

/* ── Seções ──────────────────────────────────────────────────────────────────── */
.pa-section { display: none; }
.pa-section.active { display: block; }

.pa-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: #7B3D5A;
  font-weight: 700;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pa-section-title i { color: #C9788A; }

/* ── Cards Dashboard ─────────────────────────────────────────────────────────── */
.pa-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.pa-card {
  background: #fff;
  border-radius: 16px;
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
  transition: transform .2s, box-shadow .2s;
}
.pa-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(0,0,0,.1); }

.pa-card-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.pa-card-pink  .pa-card-icon { background: #FCE4EC; color: #C9788A; }
.pa-card-gold  .pa-card-icon { background: #FFF3E0; color: #C8915C; }
.pa-card-purple.pa-card-icon { background: #F3E5F5; color: #7B3D5A; }
.pa-card-rose  .pa-card-icon { background: #FCE4EC; color: #E91E63; }
.pa-card-purple .pa-card-icon { background: #F3E5F5; color: #7B3D5A; }

.pa-card-num {
  font-size: 26px;
  font-weight: 700;
  color: #3D2B2B;
  display: block;
  line-height: 1;
}
.pa-card-label { font-size: 12px; color: #9E7A84; margin-top: 4px; display: block; }

/* ── Row 2 col ──────────────────────────────────────────────────────────────── */
.pa-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.pa-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}
.pa-box-title {
  font-weight: 700;
  font-size: 15px;
  color: #7B3D5A;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pa-box-title i { color: #C9788A; }

.pa-top-list { padding: 0; margin: 0; list-style: none; }
.pa-top-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #EDD5D5;
  font-size: 13.5px;
  color: #3D2B2B;
}
.pa-top-list li:last-child { border: none; }
.pa-top-list .rank {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, #C9788A, #7B3D5A);
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── Tabelas ─────────────────────────────────────────────────────────────────── */
.pa-table-wrap { overflow-x: auto; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.06); }
.pa-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13.5px;
}
.pa-table thead tr { background: linear-gradient(135deg, #7B3D5A, #C9788A); }
.pa-table thead th {
  padding: 13px 16px;
  text-align: left;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
.pa-table tbody tr { border-bottom: 1px solid #F5E8ED; transition: background .15s; }
.pa-table tbody tr:hover { background: #FDF6F0; }
.pa-table tbody td { padding: 12px 16px; color: #3D2B2B; vertical-align: middle; }
.pa-table .pa-loading { text-align: center; color: #9E7A84; padding: 28px; }

.pa-table img.pa-thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

/* Status badges */
.pa-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
}
.pa-badge-pendente   { background: #FFF9C4; color: #856404; }
.pa-badge-preparando { background: #E3F2FD; color: #1565C0; }
.pa-badge-saiu_entrega { background: #E8F5E9; color: #2E7D32; }
.pa-badge-entregue   { background: #E8F5E9; color: #1B5E20; }
.pa-badge-cancelado  { background: #FFEBEE; color: #C62828; }
.pa-badge-ativo      { background: #E8F5E9; color: #2E7D32; }
.pa-badge-inativo    { background: #FFEBEE; color: #C62828; }

/* ── Botões de Ação ──────────────────────────────────────────────────────────── */
.pa-btn-add {
  margin-left: auto;
  padding: 9px 18px;
  background: linear-gradient(135deg, #C9788A, #7B3D5A);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  font-family: 'Poppins', sans-serif;
}
.pa-btn-add:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(201,120,138,.4); }

.pa-btn-action {
  padding: 5px 10px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  transition: all .2s;
  margin: 1px;
}
.pa-btn-edit   { background: #E3F2FD; color: #1565C0; }
.pa-btn-delete { background: #FFEBEE; color: #C62828; }
.pa-btn-view   { background: #F3E5F5; color: #7B3D5A; }
.pa-btn-wa     { background: #E8F5E9; color: #2E7D32; }
.pa-btn-action:hover { opacity: .85; transform: scale(1.05); }

.pa-btn-save {
  padding: 10px 22px;
  background: linear-gradient(135deg, #C9788A, #7B3D5A);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
  font-family: 'Poppins', sans-serif;
}
.pa-btn-save:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(201,120,138,.35); }
.pa-btn-cancel {
  padding: 10px 22px;
  background: #F5E8ED;
  color: #7B3D5A;
  border: 1px solid #EDD5D5;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  transition: all .2s;
}
.pa-btn-cancel:hover { background: #EDD5D5; }
.pa-btn-print {
  margin-left: auto;
  padding: 8px 16px;
  background: #E3F2FD;
  color: #1565C0;
  border: 1px solid #BBDEFB;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Poppins', sans-serif;
}
.pa-btn-link { background: none; border: none; color: #C9788A; cursor: pointer; font-size: 13px; font-family: 'Poppins', sans-serif; padding: 4px 0; }
.pa-btn-remove-item { background: #FFEBEE; color: #C62828; border: none; border-radius: 6px; padding: 4px 8px; cursor: pointer; }

/* ── Inner Modais (dentro do painel) ────────────────────────────────────────── */
.pa-inner-modal {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,15,20,.6);
  backdrop-filter: blur(3px);
}
.pa-inner-modal-box {
  background: #fff;
  border-radius: 18px;
  width: 96%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: pretahSlideUp .25s ease;
}
.pa-inner-modal-sm { max-width: 420px; }
.pa-inner-modal-header {
  padding: 18px 24px;
  background: linear-gradient(135deg, #7B3D5A, #C9788A);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pa-inner-modal-header h3 {
  color: #fff;
  margin: 0;
  font-size: 17px;
  font-family: 'Playfair Display', serif;
}
.pa-inner-modal-close {
  font-size: 24px;
  background: rgba(255,255,255,.2);
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  cursor: pointer;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.pa-inner-modal-close:hover { background: rgba(255,255,255,.35); }

/* ── Formulários do Admin ────────────────────────────────────────────────────── */
.pa-form { padding: 20px 24px; overflow-y: auto; }
.pa-form-group { margin-bottom: 16px; }
.pa-form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #7B3D5A;
  margin-bottom: 5px;
}
.pa-form-group input,
.pa-form-group textarea,
.pa-form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #EDD5D5;
  border-radius: 9px;
  font-size: 13.5px;
  color: #3D2B2B;
  background: #FDF6F0;
  font-family: 'Poppins', sans-serif;
  transition: border .2s;
  box-sizing: border-box;
}
.pa-form-group input:focus,
.pa-form-group textarea:focus,
.pa-form-group select:focus { border-color: #C9788A; outline: none; }
.pa-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pa-form-inline { display: flex; gap: 24px; align-items: center; margin-bottom: 16px; }
.pa-form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; border-top: 1px solid #EDD5D5; margin-top: 4px; }
.pa-pt-24 { padding-top: 24px; }

/* Toggle */
.pa-toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: #3D2B2B; }
.pa-toggle input { display: none; }
.pa-toggle-slider {
  width: 42px; height: 22px;
  background: #ddd;
  border-radius: 50px;
  position: relative;
  transition: background .2s;
}
.pa-toggle-slider::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.pa-toggle input:checked ~ .pa-toggle-slider { background: #C9788A; }
.pa-toggle input:checked ~ .pa-toggle-slider::after { transform: translateX(20px); }

/* Upload */
.pa-upload-area {
  border: 2px dashed #EDD5D5;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: border-color .2s;
}
.pa-upload-area:hover { border-color: #C9788A; }
.pa-btn-upload {
  padding: 8px 18px;
  background: #F5E8ED;
  color: #7B3D5A;
  border: 1px solid #EDD5D5;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  display: inline-flex; align-items: center; gap: 6px;
}

/* ── Barra de busca / filtros ───────────────────────────────────────────────── */
.pa-search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pa-search-bar input,
.pa-search-bar select {
  padding: 9px 14px;
  border: 1.5px solid #EDD5D5;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: 'Poppins', sans-serif;
  flex: 1;
  min-width: 200px;
  background: #fff;
  color: #3D2B2B;
}
.pa-search-bar input:focus, .pa-search-bar select:focus { border-color: #C9788A; outline: none; }

/* Status Filter Buttons */
.pa-status-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.pa-status-btn {
  padding: 7px 16px;
  border-radius: 50px;
  border: 1.5px solid #EDD5D5;
  background: #fff;
  color: #9E7A84;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  font-family: 'Poppins', sans-serif;
}
.pa-status-btn:hover, .pa-status-btn.active {
  background: #7B3D5A;
  border-color: #7B3D5A;
  color: #fff;
}

/* ── Alert ───────────────────────────────────────────────────────────────────── */
.pa-alert-info {
  background: #E3F2FD;
  border: 1px solid #BBDEFB;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: #1565C0;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pa-alert-info .pa-btn-print { margin-left: auto; }

/* Estoque baixo */
.estoque-critico { color: #C62828; font-weight: 700; }
.estoque-baixo   { color: #E65100; font-weight: 600; }

/* ── Relatório ───────────────────────────────────────────────────────────────── */
.pa-report-filter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.pa-report-filter .pa-form-group { margin: 0; }
.pa-report-filter label { font-size: 12px; font-weight: 600; color: #7B3D5A; display: block; margin-bottom: 4px; }
.pa-report-filter input, .pa-report-filter select {
  padding: 8px 12px;
  border: 1.5px solid #EDD5D5;
  border-radius: 9px;
  font-family: 'Poppins', sans-serif;
  font-size: 13.5px;
  color: #3D2B2B;
  background: #fff;
}
.pa-rel-cards { margin-bottom: 24px; }
.pa-table-sm { font-size: 12.5px; }
.pa-table-sm td, .pa-table-sm th { padding: 9px 12px; }

/* ── Pedido Detalhe ──────────────────────────────────────────────────────────── */
.pa-pedido-detalhe {
  padding: 16px 24px;
  font-size: 14px;
  line-height: 1.7;
}
.pa-pedido-detalhe h4 { color: #7B3D5A; margin: 16px 0 6px; font-family: 'Playfair Display', serif; }
.pa-pedido-detalhe table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.pa-pedido-detalhe td { padding: 6px 10px; border-bottom: 1px solid #EDD5D5; }
.pa-pedido-detalhe .pa-total-row { font-weight: 700; font-size: 16px; color: #C9788A; }

/* ── Avaliações – Seletor de Estrelas ────────────────────────────────────────── */
.pa-star-select { display:flex; gap:4px; margin:8px 0; }
.pa-star { font-size:30px; color:#ddd; cursor:pointer; transition:color .15s; line-height:1; user-select:none; }
.pa-star.ativa { color:#D4A017; }
.pa-star:hover, .pa-star:hover ~ .pa-star { color:#D4A017; }

/* ── PIX Block (exibido no painel/site) ──────────────────────────────────────── */
.pretah-pix-box { background:#f9f9f9; border:1.5px solid #E8D5DC; border-radius:16px; padding:28px 24px; max-width:400px; margin:0 auto; text-align:center; }
.pretah-pix-header { display:flex; align-items:center; justify-content:center; gap:10px; margin-bottom:20px; }
.pretah-pix-logo { font-size:22px; }
.pretah-pix-titulo { font-weight:700; font-size:18px; color:#7B3D5A; }
.pretah-pix-qr { margin-bottom:20px; }
.pretah-pix-qr img { border-radius:12px; border:2px solid #EDD5D5; }
.pretah-pix-valor { font-size:22px; font-weight:700; color:#C9788A; margin-top:10px; }
.pretah-pix-dados { text-align:left; border:1px solid #EDD5D5; border-radius:10px; padding:12px 16px; margin-bottom:16px; }
.pretah-pix-linha { display:flex; justify-content:space-between; padding:6px 0; border-bottom:1px solid #F5E8EC; font-size:13px; }
.pretah-pix-linha:last-child { border-bottom:none; }
.pretah-pix-label { color:#9E7A84; }
.pretah-pix-val { color:#3D2B2B; font-weight:500; }
.pretah-pix-chave { color:#7B3D5A; }
.pretah-pix-copiar { width:100%; padding:12px; background:linear-gradient(135deg,#C9788A,#7B3D5A); color:#fff; border:none; border-radius:10px; font-size:15px; font-weight:600; cursor:pointer; margin-bottom:14px; transition:opacity .2s; }
.pretah-pix-copiar:hover { opacity:.88; }
.pretah-pix-obs { font-size:12px; color:#9E7A84; display:flex; align-items:flex-start; gap:6px; text-align:left; }
.pretah-pix-obs i { margin-top:2px; color:#C9788A; }

/* ── Item Pedido Manual ──────────────────────────────────────────────────────── */
.pa-item-pedido {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.pa-item-pedido input { flex: 1; }

/* ── Responsivo Mobile ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .pa-sidebar { width: 200px; min-width: 200px; }
  .pa-nav-item span { font-size: 12px; }
  .pa-content { padding: 16px; }
  .pa-row-2 { grid-template-columns: 1fr; }
  .pa-form-2col { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .pretah-admin-panel { flex-direction: column; }
  .pa-sidebar { width: 100%; min-width: 100%; height: auto; flex-direction: row; }
  .pa-nav { display: flex; overflow-x: auto; padding: 8px 4px; }
  .pa-nav-item { padding: 8px 14px; min-width: max-content; font-size: 12px; border-left: none; border-bottom: 3px solid transparent; }
  .pa-nav-item.active { border-bottom-color: #C9788A; border-left: none; }
  .pa-sidebar-logo, .pa-sidebar-footer { display: none; }
}

@media print {
  body * { visibility: hidden; }
  #lista-compras-wrap, #lista-compras-wrap *, #relatorio-resultado, #relatorio-resultado * { visibility: visible; }
  #lista-compras-wrap, #relatorio-resultado { position: absolute; top: 0; left: 0; width: 100%; }
  .pa-btn-print, .pa-btn-add, .pa-btn-action, .pa-form-actions { display: none !important; }
}
