/* === DUTS Admin Panel === */
:root {
  --bg: #0d0d1a;
  --bg2: #12122a;
  --bg3: #1a1a35;
  --border: #2a2a4a;
  --red: #c0392b;
  --red-light: #e74c3c;
  --green: #1abc9c;
  --blue: #2980b9;
  --purple: #8e44ad;
  --text: #e0e0f0;
  --text-muted: #888aaa;
  --sidebar-w: 220px;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.sidebar-logo h2 {
  color: var(--red);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.sidebar-logo span {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: rgba(192, 57, 43, 0.15);
  color: var(--red-light);
  border-left-color: var(--red);
}

.nav-icon { font-size: 1.2rem; width: 1.5rem; text-align: center; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
}

/* === MAIN CONTENT === */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb strong { color: var(--text); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
}

.backend-status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot-online { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-offline { background: var(--red); }

.status-online { color: var(--green); }
.status-offline { color: var(--red); }

.content {
  padding: 2rem 1.5rem;
  flex: 1;
}

.section { display: none; }
.section.active { display: block; }

h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--text); }
h2 { font-size: 1.2rem; margin-bottom: 1rem; color: var(--text); }

/* === CARDS DASHBOARD === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--red); }

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--red);
  display: block;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.stat-icon { font-size: 1.5rem; margin-bottom: 0.5rem; display: block; }

/* === IMAGES GRID === */
.recent-images-section h2 { margin-bottom: 1rem; }

.img-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.img-thumb-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  padding: 0.5rem;
}

.img-thumb-card img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  margin-bottom: 0.5rem;
}

.img-thumb-card span {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === TABLES === */
.table-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.table-container {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

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

th {
  background: var(--bg3);
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

tr:hover td { background: rgba(192, 57, 43, 0.05); }

.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.thumb-sm { width: 32px; height: 32px; border-radius: 4px; }

.empty-msg { text-align: center; color: var(--text-muted); padding: 2rem; }

/* === BADGES === */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s;
  text-decoration: none;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--red); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--red-light); }

.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { border-color: var(--red); color: var(--red); }

.btn-success { background: var(--green); color: #000; }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* === MODAL === */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.modal-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1.1rem; }

.btn-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.btn-close:hover { color: var(--red); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* === FORMS === */
.form-group { margin-bottom: 1rem; }

label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.35rem; }

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
}

textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-zone:hover { border-color: var(--red); }
.upload-zone input[type="file"] { display: none; }

.img-preview {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 6px;
  margin-top: 0.75rem;
  background: var(--bg3);
  display: none;
}

/* === CARD PREVIEW === */
.card-preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1rem;
}

.card-preview {
  width: 180px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5);
  font-size: 0.75rem;
  color: white;
}

.card-preview-cost {
  position: absolute;
  top: 8px; left: 8px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid gold;
}

.card-preview-art {
  height: 100px;
  background: rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.card-preview-art img { width: 100%; height: 100%; object-fit: cover; }
.card-preview-no-art { font-size: 3rem; }

.card-preview-name {
  background: rgba(0,0,0,0.6);
  padding: 0.35rem 0.5rem;
  font-weight: 700;
  text-align: center;
  font-size: 0.8rem;
}

.card-preview-type {
  text-align: center;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.7);
  padding: 0.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.card-preview-desc {
  padding: 0.5rem;
  background: rgba(0,0,0,0.4);
  font-size: 0.7rem;
  min-height: 50px;
  line-height: 1.4;
}

/* === BATCH IMAGENS === */
.batch-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.batch-info { color: var(--text-muted); font-size: 0.9rem; }
.batch-info strong { color: var(--red); }

.batch-controls { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.batch-list {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.batch-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.batch-item:last-child { border-bottom: none; }
.batch-item.has-image { opacity: 0.6; }

.batch-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.batch-emoji { font-size: 1.2rem; }
.batch-nome { flex: 1; font-size: 0.9rem; }
.batch-tipo { font-size: 0.75rem; color: var(--text-muted); width: 80px; }

.batch-status { font-size: 0.75rem; }
.status-ok { color: var(--green); }
.status-pending { color: var(--text-muted); }

.batch-progress {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

.progress-bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.3s;
  width: 0;
}

.batch-log {
  background: #000;
  color: #00ff88;
  font-family: monospace;
  font-size: 0.8rem;
  padding: 1rem;
  border-radius: 8px;
  height: 200px;
  resize: vertical;
  width: 100%;
  border: 1px solid var(--border);
}

/* === TOASTS === */
#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s;
  pointer-events: auto;
  max-width: 320px;
  word-wrap: break-word;
}

.toast.show { opacity: 1; transform: translateX(0); }
.toast-success { background: #1a4a30; border: 1px solid var(--green); color: var(--green); }
.toast-error { background: #4a1a1a; border: 1px solid var(--red); color: #ff6b6b; }
.toast-info { background: var(--bg3); border: 1px solid var(--border); color: var(--text); }
.toast-warning { background: #4a3a1a; border: 1px solid #f39c12; color: #f39c12; }

/* === LOGIN PAGE === */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo { font-size: 3rem; margin-bottom: 1rem; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 0.5rem; color: var(--red); }
.login-card p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.login-card .form-group { text-align: left; }
.login-error { color: var(--red); font-size: 0.85rem; margin-top: 0.5rem; min-height: 1.2em; }

/* === SELECT === */
select option { background: var(--bg3); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* === JSON TEXTAREA === */
.json-textarea {
  font-family: 'Cascadia Code', 'Consolas', monospace;
  font-size: 0.8rem;
  min-height: 140px;
}

/* === UTILS === */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }
