:root {
  --bg: #ffffff;
  --card: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --brand: #fe6a2a; /* Mango */
  --danger: #ef4444;
  --border: #e5e7eb;
  --shadow: 0 8px 24px rgba(0,0,0,.06);
  --gradient-start: #FF4931;
  --gradient-end: #9E42FD;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header, .site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header { border-bottom: 1px solid var(--border); }
.site-footer { border-top: 1px solid var(--border); color: var(--muted); }
.brand { font-weight: 800; letter-spacing: .2px; }
.gradient-text {
  background-image: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;                 /* padrão/Firefox */
  -webkit-text-fill-color: transparent; /* Safari/Chromium */
}

.site-header nav a { margin-left: 12px; color: var(--muted); font-weight: 600; }
.site-header nav a:hover { color: var(--text); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.page-title { margin: 0 0 12px 0; font-size: 24px; font-weight: 800; }
.section-title { margin: 0 0 10px 0; font-size: 18px; font-weight: 700; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card-narrow { max-width: 460px; margin: 0 auto; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
}

.form { display: grid; gap: 10px; }
.form label { color: var(--muted); font-size: 14px; }
.form input {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(254,106,42,.15); }
.form button, button {
  background: var(--brand);
  color: #111;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
/* hover só em botões comuns (não nos controles flutuantes do lightbox) */
button:not(.lb-close):not(.lb-prev):not(.lb-next):hover {
  transform: translateY(-1px);
}

button.secondary { background: #fff; color: var(--text); border: 1px solid var(--border); }
button.danger { background: var(--danger); color: #fff; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px; vertical-align: middle; text-align: left; }
.thumb-td { width: 120px; }
.thumb { width: 100%; max-width: 110px; height: auto; border-radius: 8px; display: block; }

.search-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.search-form { display: flex; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; }

.grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.item-card { position: relative; overflow: hidden; }
.item-title { margin: 10px 0 0 0; font-size: 16px; font-weight: 700; }

.remove { margin-top: 6px; }
.error { color: #b91c1c; }

/* === Ações do card (Ver/Abrir) === */
.item-card .actions {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 8px; z-index: 2;
}
.item-card .actions .view-btn,
.item-card .actions .open-btn {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  text-decoration: none;
}
.item-card .actions .view-btn:hover,
.item-card .actions .open-btn:hover { filter: brightness(0.98); }

/* Thumbnails */
.item-card .img-wrap {
  overflow: hidden; border-radius: 12px; border: 1px solid var(--border);
  background: #fafafa;
}
.item-card img {
  width: 100%; height: auto; display: block; transform: scale(1);
  transition: transform .2s ease-in-out;
}
.item-card:hover img { transform: scale(1.02); }

/* === LIGHTBOX === */
.no-scroll { overflow: hidden; }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.86);
  z-index: 9999; display: grid; grid-template-rows: auto 1fr auto;
  gap: 10px; padding: 16px;
}
/* garante que o atributo hidden funcione */
.lightbox[hidden] { display: none !important; }

.lb-header {
  display: flex; align-items: center; justify-content: space-between; color: #fff;
  padding-right: 72px; /* reserva espaço para o X no topo direito */
}
.lb-title { font-weight: 700; }
.lb-actions { display: flex; gap: 8px; }
.lb-actions button, .lb-actions a {
  background: #ffffff; color: #111; border: none; border-radius: 8px;
  padding: 8px 12px; text-decoration: none; cursor: pointer;
}
.lb-actions a.secondary { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }

.lb-content { overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.lightbox[data-fit="width"] #lbImg { max-width: min(100%, 1400px); height: auto; } /* mais largura para emails */
.lightbox[data-fit="original"] #lbImg { max-width: none; height: auto; }

.lb-hint { color: rgba(255,255,255,.7); font-size: 12px; text-align: center; }

/* Botões flutuantes */
.lb-close, .lb-prev, .lb-next {
  position: fixed; z-index: 10000;
  background: rgba(255,255,255,.9); color: #111; border: none; border-radius: 999px;
  width: 40px; height: 40px; display: grid; place-items: center; font-size: 22px; cursor: pointer;
}
.lb-close { top: 16px; right: 16px; }

/* mantém as setas estáveis no hover */
.lb-prev { top: 50%; left: 16px; transform: translateY(-50%); }
.lb-next { top: 50%; right: 16px; transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%); filter: brightness(0.95); }
.lb-close:hover { filter: brightness(0.95); }
