/* ─────────────────────────────────────────────────────────────
   DTF Online — Tema dark (mesma paleta do desktop)
   ───────────────────────────────────────────────────────────── */
:root {
  --bg:        #0f1117;
  --panel:    #16181f;
  --surface:  #1e2130;
  --surface2: #252a3d;
  --border:   #2a2d3a;
  --accent:   #f97316;
  --accent2:  #3b82f6;
  --success:  #22c55e;
  --warning:  #f59e0b;
  --error:    #ef4444;
  --text:     #e2e8f0;
  --text-dim: #64748b;
  --roll-bg:  #1a1a2e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* ── Header ───────────────────────────────────────────────── */
.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
}
.gap-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 8px;
  padding: 4px 10px;
  background: var(--surface);
  border-radius: 6px;
}
.gap-control input[type="range"] {
  width: 80px;
  vertical-align: middle;
}
.gap-control span {
  min-width: 24px;
  display: inline-block;
  font-weight: 600;
  color: var(--text);
}
.topbar .back-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  background: var(--accent);
  color: white;
  font-weight: 600;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
}
.topbar .back-btn:hover {
  background: var(--accent-hover, #ea580c);
  filter: brightness(1.1);
}
.topbar .brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.topbar .brand .sub {
  color: var(--text-dim);
  font-weight: 400;
  margin-left: 8px;
  font-size: 13px;
}
.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── Layout ───────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 24px; }
.center-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Botões ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
  gap: 6px;
  text-decoration: none;
}
.btn:hover { background: var(--surface2); border-color: var(--accent); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn.primary:hover { background: #ea6306; }
.btn.success { background: var(--success); color: white; border-color: var(--success); }
.btn.success:hover { filter: brightness(1.1); }
.btn.danger { background: var(--error); color: white; border-color: var(--error); }
.btn.danger:hover { filter: brightness(1.1); }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn.ghost { background: transparent; }

/* ── Inputs ───────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; }

/* ── Tabela ───────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
}
.table th, .table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--surface);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  font-weight: 600;
}
.table tr:hover { background: var(--surface); }
.table .empty { text-align: center; color: var(--text-dim); padding: 32px; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge.open       { background: rgba(59,130,246,0.15); color: var(--accent2); }
.badge.processing { background: rgba(249,115,22,0.15); color: var(--accent); }
.badge.submitted  { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge.printed    { background: rgba(34,197,94,0.15);  color: var(--success); }
.badge.error      { background: rgba(239,68,68,0.15);  color: var(--error); }
.badge.inactive   { background: rgba(239,68,68,0.15);  color: var(--error); }

/* Tipo de rolo (kind) */
.badge-kind {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-kind.design { background: rgba(59,130,246,0.15); color: var(--accent2); }
.badge-kind.ready  { background: rgba(34,197,94,0.15);  color: var(--success); }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface);
  border-left: 4px solid var(--accent2);
  padding: 12px 18px;
  border-radius: 8px;
  min-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideIn 0.25s ease;
  font-size: 13px;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin: 0 0 18px; font-size: 18px; }

/* ── Login ────────────────────────────────────────────────── */
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px;
  width: 100%;
  max-width: 400px;
}
.login-card h1 {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 28px;
  text-align: center;
}
.login-card .subtitle {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 28px;
  font-size: 13px;
}

/* ── Cards de rolo / clientes ─────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.roll-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.roll-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.roll-card.disabled {
  cursor: default;
  opacity: 0.75;
}
.roll-card.disabled:hover {
  border-color: var(--border);
  transform: none;
}
.roll-card .title {
  font-weight: 600;
  margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.roll-card .meta {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

/* ── Editor / Canvas ──────────────────────────────────────── */
.editor-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  gap: 16px;
  padding: 16px;
  height: calc(100vh - 60px);
}
.sidebar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  overflow-y: auto;
}
.sidebar-panel h4 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.canvas-area {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.canvas-toolbar {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
}
.canvas-stage-wrap {
  flex: 1; overflow: auto;
  display: flex; align-items: flex-start; justify-content: center;
  background: #0a0c12;
  padding: 24px;
}

.image-list {
  list-style: none;
  margin: 0; padding: 0;
}
.image-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.image-list li.selected { border-color: var(--accent); }
.image-list li .thumb {
  width: 40px; height: 40px;
  border-radius: 4px;
  background: var(--bg) center/contain no-repeat;
  flex-shrink: 0;
}
.image-list li .info { flex: 1; min-width: 0; }
.image-list li .info .name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.image-list li .info .size { color: var(--text-dim); font-size: 11px; }
.image-list li .del {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 16px;
}
.image-list li .del:hover { color: var(--error); }

.image-list li.group-head {
  border-left: 3px solid var(--accent);
  cursor: pointer;
}
.image-list li.group-head:hover { background: var(--surface2); }
.image-list li.group-child {
  background: transparent;
  border: 1px solid transparent;
  border-left: 2px solid var(--border);
  padding: 4px 8px;
  margin-bottom: 2px;
  font-size: 11px;
}
.image-list li.group-child.selected { border-color: var(--accent); background: var(--surface); }

/* ── Drop zone ────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  color: var(--text-dim);
  transition: all 0.15s;
  margin-bottom: 14px;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(249,115,22,0.05);
}
.dropzone .big { font-size: 28px; margin-bottom: 6px; }

/* ── Inputs lado a lado ───────────────────────────────────── */
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* ── Misc ─────────────────────────────────────────────────── */
.muted { color: var(--text-dim); font-size: 12px; }
.spacer { flex: 1; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Senha gerada (cópia) ─────────────────────────────────── */
.password-display {
  background: var(--bg);
  border: 1px dashed var(--accent);
  padding: 14px;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", monospace;
  font-size: 16px;
  text-align: center;
  letter-spacing: 1px;
  color: var(--accent);
  user-select: all;
  margin: 10px 0;
}

/* ── Responsivo ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .sidebar-panel { max-height: 300px; }
}
