/* ============================================================
   FlowPDV — Componentes Reutilizáveis
   ============================================================ */

/* ── Botões ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition-normal);
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}
.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-md);
  border-radius: var(--radius-lg);
}

.btn-icon {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  width: 40px; height: 40px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Inputs ─────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.input-group label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-2);
}

.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: var(--font-size-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.input::placeholder { color: var(--text-muted); }

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23A8938E' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-8);
}

/* ── Cards ──────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text);
}

/* ── Badges / Status ────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-aguardando_pagamento { background: var(--warning-bg); color: var(--warning); }
.badge-pago_aprovado        { background: var(--success-bg); color: var(--success); }
.badge-em_preparo           { background: var(--info-bg);    color: var(--info); }
.badge-saiu_para_entrega    { background: var(--surface-3);  color: var(--text-2); }
.badge-entregue             { background: var(--success-bg); color: var(--success); }
.badge-cancelado            { background: var(--error-bg);   color: var(--error); }
.badge-pendente             { background: var(--warning-bg); color: var(--warning); }
.badge-aprovado             { background: var(--success-bg); color: var(--success); }

/* ── Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 37, 37, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

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

.modal-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: var(--space-6);
  color: var(--text);
}

/* ── Toast / Notifications ──────────────── */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--accent);
  font-size: var(--font-size-sm);
  font-weight: 500;
  min-width: 280px;
  pointer-events: all;
  transform: translateX(120%);
}

.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }

/* ── Header compartilhado ───────────────── */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-6);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.logo span { color: var(--text-muted); font-weight: 300; }

/* ── Stat Card ──────────────────────────── */
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-card .stat-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card .stat-delta {
  font-size: var(--font-size-xs);
  color: var(--success);
  font-weight: 600;
}

/* ── Loading Spinner ────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  gap: var(--space-4);
  color: var(--text-muted);
}

/* ── Empty State ────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  gap: var(--space-3);
}

.empty-state .empty-icon {
  font-size: 3rem;
  opacity: 0.4;
}

.empty-state p {
  color: var(--text-muted);
  font-size: var(--font-size-sm);
}

/* ── Qty Control ────────────────────────── */
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

.qty-control button {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--text-2);
  transition: background var(--transition-fast);
}

.qty-control button:hover { background: var(--border); }

.qty-control span {
  min-width: 36px;
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
}

/* ── Tabs ───────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 0;
  overflow-x: auto;
}

.tab-btn {
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-btn:hover:not(.active) { color: var(--text-2); }

.pdv-nav {
  flex: 1;
  display: flex;
  gap: var(--space-4);
}

@media (max-width: 768px) {
  .pdv-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding: var(--space-2) 0;
    z-index: 1000;
  }
  .pdv-nav .tab-btn {
    flex-direction: column;
    padding: var(--space-2);
    font-size: 1.2rem;
    border-bottom: none;
  }
  .pdv-nav .tab-btn.active {
    color: var(--accent);
  }
}

/* ── Table ──────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}

table.flow-table {
  width: 100%;
  border-collapse: collapse;
}

.flow-table thead th {
  background: var(--surface-2);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.flow-table tbody td {
  padding: var(--space-4);
  font-size: var(--font-size-sm);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

.flow-table tbody tr:last-child td { border-bottom: none; }
.flow-table tbody tr:hover { background: var(--surface-2); }

/* ── Chips / Seleção de Variação ─────────── */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ── Responsive ─────────────────────────── */
@media (max-width: 768px) {
  .btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-sm);
  }

  .modal { padding: var(--space-6); }
  .card { padding: var(--space-4); }
}
