/* =========================
   RESET & VARIÁVEIS
========================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --danger: #dc2626;
  --border: #e5e7eb;
  --bg: #f9fafb;
  --text: #111827;
  --text-muted: #6b7280;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* =========================
   LAYOUT GERAL
========================= */
.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
}

/* =========================
   FORMULÁRIO DE UPLOAD
========================= */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr 0.8fr auto;
  gap: 12px;
  align-items: end;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.grid label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.grid input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.grid input:focus {
  outline: none;
  border-color: var(--primary);
}

.grid input[type="file"] {
  padding: 8px 12px;
}

.send {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#btn-enviar {
  height: 40px;
  padding: 0 20px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#btn-enviar:hover {
  background: var(--primary-dark);
}

/* =========================
   GALERIA - CARDS
========================= */
.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.preview {
  width: 100%;
  height: 280px;
  object-fit: contain;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 12px;
}

.meta {
  padding: 8px 0;
}

.meta p {
  margin: 4px 0;
  font-size: 14px;
}

.meta strong {
  color: var(--text);
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.left {
  display: flex;
  gap: 6px;
}

.right {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* =========================
   BOTÕES
========================= */
.btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg);
}

.btn--primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn--primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.btn--ghost {
  background: transparent;
}

.btn--ghost:hover {
  background: var(--bg);
}

.btn--danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.btn-mini {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-mini:hover {
  background: var(--bg);
}

/* =========================
   QUANTIDADE
========================= */
.qty {
  display: flex;
  gap: 6px;
  align-items: center;
}

.qty__input {
  width: 50px;
  height: 28px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* =========================
   CARRINHO FAB
========================= */
.cart-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 56px;
  padding: 0 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 50;
}

.cart-fab:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.5);
}

/* =========================
   CARRINHO DRAWER
========================= */
.cart {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  transition: opacity 0.3s;
}

.cart[aria-hidden="true"] {
  opacity: 0;
}

.cart.open {
  pointer-events: auto;
  opacity: 1;
}

.cart__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s;
}

.cart.open .cart__overlay {
  opacity: 1;
}

.cart__drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 90vw);
  background: white;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s;
}

.cart.open .cart__drawer {
  transform: translateX(0);
}

.cart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.cart__header strong {
  font-size: 18px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.icon-btn:hover {
  background: var(--bg);
}

.cart__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.cart__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg);
  border-radius: 8px;
  margin-bottom: 8px;
}

.cart__item-info {
  flex: 1;
}

.cart__item-qty {
  display: flex;
  gap: 6px;
  align-items: center;
}

.cart__info {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.cart__footer {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* =========================
   RESPONSIVO
========================= */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .send {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
  
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .left, .right {
    width: 100%;
    justify-content: space-between;
  }
  
  .cart-fab {
    bottom: 16px;
    right: 16px;
  }
}