/* ==========================================================================
   ALPHA CELL - PAINEL ADMINISTRATIVO (ADMIN CSS)
   ========================================================================== */

:root {
  --admin-bg: #07080c;
  --admin-card: rgba(18, 20, 29, 0.85);
  --admin-surface: #0f1118;
  --gold-primary: #D4AF37;
  --gold-light: #FCE282;
  --gold-dark: #997819;
  --gold-gradient: linear-gradient(135deg, #FFF1B0 0%, #D4AF37 50%, #997819 100%);
  --chrome-gradient: linear-gradient(135deg, #FFFFFF 0%, #CBD5E1 50%, #64748B 100%);
  --border-gold: rgba(212, 175, 55, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --whatsapp-green: #25D366;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--admin-bg);
  color: var(--text-main);
  min-height: 100vh;
}

/* Header */
.admin-header {
  background: rgba(12, 14, 21, 0.95);
  border-bottom: 1px solid var(--border-gold);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.admin-brand img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--gold-primary);
}

.admin-title {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 1px;
}

.admin-title span {
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.admin-badge {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 8px;
  text-transform: uppercase;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-admin-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: 0.2s ease;
}

.btn-admin-action:hover {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--border-gold);
  color: var(--gold-light);
}

/* Tabs */
.admin-nav-tabs {
  max-width: 1400px;
  margin: 20px auto 0;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: 0.2s ease;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--gold-light);
}

.tab-btn.active {
  color: var(--gold-light);
  border-bottom-color: var(--gold-primary);
}

/* Layout Container */
.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.kpi-card {
  background: var(--admin-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-val {
  font-size: 1.85rem;
  font-weight: 900;
  color: var(--gold-light);
}

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--gold-light);
}

/* Toolbar & Filters */
.admin-toolbar {
  background: var(--admin-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.admin-search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.admin-search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-primary);
}

.admin-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: rgba(7, 8, 12, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #FFF;
  font-size: 0.9rem;
  outline: none;
}

.admin-input:focus {
  border-color: var(--gold-primary);
}

.admin-select {
  padding: 10px 14px;
  background: rgba(7, 8, 12, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #FFF;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

/* Orders Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--admin-surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

.admin-table th {
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 18px;
  font-weight: 800;
  color: var(--gold-light);
  border-bottom: 1px solid var(--border-gold);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.status-pendente {
  background: rgba(245, 158, 11, 0.15);
  color: #F59E0B;
  border: 1px solid #F59E0B;
}

.status-separacao {
  background: rgba(59, 130, 246, 0.15);
  color: #60A5FA;
  border: 1px solid #3B82F6;
}

.status-entrega {
  background: rgba(168, 85, 247, 0.15);
  color: #C084FC;
  border: 1px solid #A855F7;
}

.status-concluido {
  background: rgba(34, 197, 94, 0.15);
  color: #4ADE80;
  border: 1px solid #22C55E;
}

.status-cancelado {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid #EF4444;
}

/* Action Buttons inside Table */
.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s ease;
  text-decoration: none;
}

.btn-icon:hover {
  background: var(--gold-gradient);
  color: #000;
  border-color: transparent;
}

.btn-icon.wa {
  color: var(--whatsapp-green);
  border-color: rgba(37, 211, 102, 0.3);
}

.btn-icon.wa:hover {
  background: var(--whatsapp-green);
  color: #FFF;
}

.btn-icon.nf {
  color: var(--gold-light);
  border-color: var(--border-gold);
}

.btn-icon.nf:hover {
  background: var(--gold-gradient);
  color: #000;
}

.btn-icon.del {
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-icon.del:hover {
  background: #EF4444;
  color: #FFF;
}

/* Login Modal */
.admin-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-login-box {
  background: var(--admin-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 0 50px rgba(212, 175, 55, 0.25);
}

.admin-login-box img {
  width: 70px;
  height: 70px;
  border-radius: 16px;
  border: 2px solid var(--gold-primary);
  margin-bottom: 20px;
}

/* Modal Detalhes do Pedido */
.admin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-modal-overlay.active {
  display: flex;
}

.admin-modal-box {
  background: #0f1118;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 650px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9);
}

.btn-close-admin-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #FFF;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Edit Price Inputs inside Products Tab */
.editable-price-input {
  width: 90px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-gold);
  border-radius: 4px;
  color: var(--gold-light);
  font-weight: 800;
  text-align: right;
  font-size: 0.95rem;
}

/* ==========================================================================
   DANFE / NOTA FISCAL PRINTABLE & VISUAL STYLES
   ========================================================================== */
.danfe-container {
  background: #FFFFFF;
  color: #111827;
  border-radius: 8px;
  padding: 24px;
  font-family: 'Plus Jakarta Sans', Arial, sans-serif;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid #E2E8F0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.danfe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #0F172A;
  padding-bottom: 12px;
  margin-bottom: 12px;
  gap: 16px;
}

.danfe-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.danfe-logo {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #CBD5E1;
}

.danfe-company-name {
  font-size: 15px;
  font-weight: 800;
  color: #0F172A;
  text-transform: uppercase;
}

.danfe-company-sub {
  font-size: 11px;
  color: #475569;
  line-height: 1.35;
}

.danfe-badge-doc {
  border: 2px solid #0F172A;
  border-radius: 6px;
  padding: 8px 12px;
  text-align: center;
  min-width: 220px;
  background: #F8FAFC;
}

.danfe-badge-doc .title {
  font-size: 10px;
  font-weight: 800;
  color: #0F172A;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.danfe-badge-doc .number {
  font-size: 16px;
  font-weight: 900;
  color: #0F172A;
  margin: 3px 0;
}

.danfe-barcode-sim {
  margin: 10px 0;
  padding: 8px;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  text-align: center;
  border-radius: 4px;
}

.danfe-barcode-stripes {
  height: 30px;
  background: repeating-linear-gradient(90deg, #000 0, #000 2px, #fff 2px, #fff 4px, #000 4px, #000 7px, #fff 7px, #fff 9px);
  margin: 0 auto 4px;
  max-width: 440px;
}

.danfe-key {
  font-family: monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #334155;
}

.danfe-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0F172A;
  background: #F1F5F9;
  padding: 4px 8px;
  border-left: 3px solid #D4AF37;
  margin: 10px 0 6px;
  border-radius: 2px;
}

.danfe-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 11.5px;
  margin-bottom: 8px;
}

.danfe-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 8px 0;
}

.danfe-table th {
  background: #F1F5F9;
  color: #0F172A;
  font-weight: 700;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid #CBD5E1;
}

.danfe-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #E2E8F0;
  color: #1E293B;
}

.danfe-totals-box {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 10px;
  margin: 10px 0;
}

.danfe-total-item .lbl {
  font-size: 10px;
  color: #64748B;
  text-transform: uppercase;
}

.danfe-total-item .val {
  font-size: 13px;
  font-weight: 800;
  color: #0F172A;
}

.danfe-footer-note {
  font-size: 10px;
  color: #475569;
  border-top: 1px solid #CBD5E1;
  padding-top: 8px;
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ==========================================================================
   PRINT MEDIA RULES (IMPRESSÃO / SALVAR COMO PDF)
   ========================================================================== */
@media print {
  body {
    background: #FFF !important;
    color: #000 !important;
  }
  
  body * {
    visibility: hidden;
  }

  #admin-nf-view-modal,
  #admin-nf-view-modal .admin-modal-box,
  #nf-printable-doc,
  #nf-printable-doc * {
    visibility: visible;
  }

  #admin-nf-view-modal {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #FFF !important;
    padding: 0 !important;
    display: block !important;
    z-index: 999999 !important;
  }

  #admin-nf-view-modal .admin-modal-box {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    background: #FFF !important;
  }

  .no-print,
  .btn-close-admin-modal,
  .nf-view-actions,
  .admin-header,
  .admin-nav-tabs,
  .admin-toolbar {
    display: none !important;
  }

  .danfe-container {
    border: none !important;
    box-shadow: none !important;
    padding: 10px 0 !important;
  }
}
