﻿/* ============================================================
   AutoMidia — Light Modern Theme
   ============================================================ */

:root {
  --bg-body:       #f1f5f9;
  --bg-card:       #ffffff;
  --bg-input:      #ffffff;
  --bg-hover:      #f8fafc;
  --border-color:  #e2e8f0;
  --text-primary:  #0f172a;
  --text-secondary:#334155;
  --text-muted:    #64748b;
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-light:  rgba(99, 102, 241, 0.08);
  --accent-mid:    rgba(99, 102, 241, 0.15);
  --success:       #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning:       #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger:        #ef4444;
  --danger-light:  rgba(239, 68, 68, 0.1);
  --info:          #3b82f6;
  --info-light:    rgba(59, 130, 246, 0.1);
  --sidebar-width: 260px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:        0 4px 6px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md:     0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.05);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  background: var(--bg-body);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img, video, canvas, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  height: 100dvh;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 1.25rem 1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.sidebar-brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.35));
}
.brand-icon {
  font-size: 3.2rem;
  background: linear-gradient(135deg, var(--accent-primary, #6366f1), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.35));
  line-height: 1;
}
.brand-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0.75rem 0.75rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.sidebar-menu li { margin-bottom: 2px; }

.sidebar-section-title {
  padding: 1rem 0.75rem 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.9rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.sidebar-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.sidebar-link i { font-size: 1rem; width: 18px; text-align: center; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.9rem 1.1rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
  background: var(--bg-card);
}
.sidebar-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-color);
}
.sidebar-avatar-fallback {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  display: block;
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-email {
  display: block;
  font-size: 0.7rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logout {
  color: var(--text-muted); font-size: 1.1rem;
  flex-shrink: 0; transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}
.sidebar-logout:hover { color: var(--danger); background: var(--danger-light); }

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; }
.main-content { padding: 2rem; max-width: 1400px; width: 100%; }
.flash-container { margin-bottom: 1.5rem; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header { margin-bottom: 1.75rem; }
.page-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary); margin: 0 0 0.25rem;
  letter-spacing: -0.3px;
}
.page-subtitle { color: var(--text-muted); margin: 0; font-size: 0.875rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  color: var(--text-primary);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 1.25rem; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.35rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon--purple { background: var(--accent-light); color: var(--accent); }
.stat-icon--yellow { background: var(--warning-light); color: var(--warning); }
.stat-icon--green  { background: var(--success-light); color: var(--success); }
.stat-icon--blue   { background: var(--info-light);    color: var(--info); }

.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ============================================================
   TABLES
   ============================================================ */
.table { color: var(--text-primary); border-color: var(--border-color); }
.table th {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
}
.table td {
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1rem; vertical-align: middle;
  color: var(--text-secondary);
}
.table-hover tbody tr:hover { background: var(--bg-hover); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { font-weight: 500; font-size: 0.875rem; border-radius: var(--radius-sm); transition: all 0.2s; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; box-shadow: 0 4px 12px rgba(99,102,241,0.35); }
.btn-primary:disabled { background: #a5b4fc; border-color: #a5b4fc; }

.btn-outline-primary { color: var(--accent); border-color: var(--accent); }
.btn-outline-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-color); background: var(--bg-card); }
.btn-outline-secondary:hover { background: var(--bg-hover); border-color: #cbd5e1; color: var(--text-primary); }

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #059669; border-color: #059669; color: #fff; }

.btn-outline-danger { color: var(--danger); border-color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
}
.form-control:focus, .form-select:focus {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}
.form-control::placeholder { color: #94a3b8; }
.form-label { color: var(--text-secondary); font-size: 0.875rem; font-weight: 500; }
.form-text { color: var(--text-muted); font-size: 0.8rem; }
.input-group-text { background: var(--bg-hover); border-color: var(--border-color); color: var(--text-muted); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
}
.modal-header { border-bottom: 1px solid var(--border-color); padding: 1.1rem 1.5rem; }
.modal-footer { border-top: 1px solid var(--border-color); padding: 1rem 1.5rem; }
.modal-title { font-weight: 600; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert { border-radius: var(--radius-sm); font-size: 0.875rem; }
.alert-success { background: var(--success-light); border-color: rgba(16,185,129,.25); color: #065f46; }
.alert-danger, .alert-error { background: var(--danger-light); border-color: rgba(239,68,68,.25); color: #991b1b; }
.alert-warning { background: var(--warning-light); border-color: rgba(245,158,11,.25); color: #92400e; }
.alert-info { background: var(--info-light); border-color: rgba(59,130,246,.25); color: #1e40af; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-weight: 500; border-radius: 6px; }
.bg-purple { background-color: var(--accent) !important; }

.status-pendente          { background: #fef3c7; color: #92400e !important; border: 1px solid #fde68a; }
.status-pendente_whatsapp { background: #fef3c7; color: #92400e !important; border: 1px solid #fde68a; }
.status-aprovado          { background: #d1fae5; color: #065f46 !important; border: 1px solid #a7f3d0; }
.status-rejeitado         { background: #fee2e2; color: #991b1b !important; border: 1px solid #fecaca; }
.status-postado           { background: #d1fae5; color: #065f46 !important; border: 1px solid #a7f3d0; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.filter-btn {
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem; font-weight: 500;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}
.filter-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: #cbd5e1; }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(99,102,241,.3); }

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.gallery-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.gallery-img-wrapper {
  position: relative; aspect-ratio: 1;
  overflow: hidden; background: var(--bg-hover);
}
.gallery-img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.gallery-card:hover .gallery-img { transform: scale(1.04); }

.gallery-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.gallery-card:hover .gallery-overlay { opacity: 1; }

.gallery-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 0.68rem; font-weight: 600;
  padding: 0.2rem 0.5rem; border-radius: 5px;
  text-transform: capitalize;
}
.gallery-info { padding: 0.75rem; }
.gallery-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.gallery-prompt-text { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.6rem; line-height: 1.4; }
.gallery-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ── Player de vídeo customizado na galeria ───────────────────────── */
.gvid-wrapper { overflow: hidden; }
/* Desativa zoom no hover para cards de vídeo */
.gvid-wrapper .gvid-el { transition: none !important; }
.gallery-card:hover .gvid-el { transform: none !important; }

.gvid-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 4; transition: opacity .2s; cursor: pointer;
}
.gvid-play-overlay i {
  font-size: 3rem; color: rgba(255,255,255,.85);
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
  transition: transform .15s;
}
.gvid-play-overlay:hover i { transform: scale(1.12); }
.gvid-play-overlay.playing { opacity: 0; pointer-events: none; }
.gvid-play-overlay.playing:hover { opacity: 1; pointer-events: all; }

.gvid-controls {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  z-index: 5;
  opacity: 0; transition: opacity .2s;
}
.gvid-wrapper:hover .gvid-controls { opacity: 1; }

.gvid-btn-play, .gvid-btn-mute {
  background: none; border: none; color: #fff;
  font-size: .85rem; padding: 0 2px; cursor: pointer; flex-shrink: 0;
  line-height: 1;
}
.gvid-btn-play:hover, .gvid-btn-mute:hover { color: #ffd; }

.gvid-progress {
  flex: 1; height: 4px; background: rgba(255,255,255,.3);
  border-radius: 2px; cursor: pointer; position: relative;
}
.gvid-progress-fill {
  height: 100%; width: 0%; background: #dc3545;
  border-radius: 2px; transition: width .1s linear; pointer-events: none;
}
.gvid-progress:hover { height: 6px; }

.gvid-time {
  font-size: .65rem; color: rgba(255,255,255,.85);
  white-space: nowrap; flex-shrink: 0;
}

/* Variáveis de texto nos cards (galeria e postagem) */
.vars-block {
  display: flex; flex-direction: column; gap: 6px;
  border-top: 1px solid var(--border-color); padding-top: 8px;
}
.var-item { display: flex; flex-direction: column; gap: 2px; }
.var-label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--primary, #0d6efd); opacity: .8;
}
.var-valor-row { display: flex; align-items: flex-start; gap: 4px; }
.var-valor { font-size: 0.78rem; line-height: 1.4; color: var(--text-primary); flex: 1; }
.var-copy-btn {
  flex-shrink: 0; background: none; border: none;
  padding: 0 2px; cursor: pointer;
  color: var(--text-muted, #6c757d); font-size: 0.72rem;
  opacity: .6; transition: opacity .15s; line-height: 1.4;
}
.var-copy-btn:hover { opacity: 1; }

/* ============================================================
   IMAGE THUMBS (dashboard)
   ============================================================ */
.img-thumb-card {
  position: relative; border-radius: var(--radius-sm);
  overflow: hidden; aspect-ratio: 1; background: var(--bg-hover);
  box-shadow: var(--shadow-sm);
}
.img-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.img-thumb-card:hover .img-thumb { transform: scale(1.08); }
.img-thumb-zoom-hint {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0); color: #fff;
  font-size: 1.4rem; opacity: 0;
  transition: background 0.2s, opacity 0.2s;
  pointer-events: none;
}
.img-thumb-card:hover .img-thumb-zoom-hint {
  background: rgba(0,0,0,0.35); opacity: 1;
}
.img-thumb-status {
  position: absolute; bottom: 6px; left: 6px;
  font-size: 0.65rem; font-weight: 600;
  padding: 0.15rem 0.45rem; border-radius: 4px; text-transform: capitalize;
}

/* ============================================================
   PROMPT CARDS (com imagens de referência)
   ============================================================ */
.prompt-card { overflow: visible; }

.prompt-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.25rem 1rem;
}

.prompt-card-info { flex: 1; min-width: 0; }

.prompt-card-title {
  font-size: 1rem; font-weight: 600;
  color: var(--text-primary); margin: 0 0 0.4rem;
}

.prompt-card-content {
  font-size: 0.85rem; color: var(--text-muted);
  margin: 0; line-height: 1.5;
}

.prompt-card-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 0.5rem;
}

.prompt-refs-section {
  border-top: 1px solid var(--border-color);
  padding: 0.9rem 1.25rem;
  background: var(--bg-hover);
  border-radius: 0 0 var(--radius) var(--radius);
}

.prompt-refs-label {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.75rem;
}

.prompt-refs-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

/* Thumbnail de referência */
.ref-thumb {
  position: relative;
  width: 72px; height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.ref-thumb-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  cursor: pointer; transition: transform 0.2s;
}
.ref-thumb:hover .ref-thumb-img { transform: scale(1.08); }

.ref-thumb-del {
  position: absolute; top: 3px; right: 3px;
  background: rgba(239,68,68,0.85);
  border: none; color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
  padding: 0;
}
.ref-thumb:hover .ref-thumb-del { opacity: 1; }

/* Botão adicionar imagem */
.ref-add-btn {
  width: 72px; height: 72px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  color: var(--text-muted); font-size: 0.7rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  flex-shrink: 0; text-align: center;
}
.ref-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.ref-add-btn i { font-size: 1.1rem; }

/* Grupo de botões Rosto / Elementos */
.ref-add-group {
  display: flex; flex-direction: row; gap: 6px;
  flex-shrink: 0; align-items: center;
}
.ref-add-rosto {
  border-color: #9b59b6;
  color: #9b59b6;
}
.ref-add-rosto:hover { border-color: #8e44ad; color: #8e44ad; background: #f5eef8; }
.ref-add-elementos {
  border-color: #2980b9;
  color: #2980b9;
}
.ref-add-elementos:hover { border-color: #1a6fa3; color: #1a6fa3; background: #eaf4fb; }

/* Badge de tipo na thumbnail */
.ref-type-badge {
  position: absolute; bottom: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6rem;
}
.badge-rosto   { background: rgba(155,89,182,0.85); color: #fff; }
.badge-estilo  { background: rgba(41,128,185,0.85);  color: #fff; }

/* ============================================================
   REFERENCE IMAGES (Prompts page) — mantido para compatibilidade
   ============================================================ */
.ref-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.ref-card:hover { box-shadow: var(--shadow); }
.ref-img {
  width: 100%; aspect-ratio: 1;
  object-fit: cover; display: block;
  background: var(--bg-hover);
}
.ref-info {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border-color);
}
.ref-nome {
  font-size: 0.75rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; margin-right: 0.5rem;
}
.ref-del-btn {
  background: none; border: none; padding: 0;
  color: var(--text-muted); font-size: 0.85rem; cursor: pointer;
  transition: color 0.15s; flex-shrink: 0;
}
.ref-del-btn:hover { color: var(--danger); }

/* ============================================================
   PROMPT PREVIEW
   ============================================================ */
.prompt-preview-box {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem; color: var(--text-muted);
  line-height: 1.6; white-space: pre-wrap;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.page-link { background: var(--bg-card); border-color: var(--border-color); color: var(--text-muted); }
.page-link:hover { background: var(--bg-hover); border-color: var(--border-color); color: var(--text-primary); }
.page-item.active .page-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-item.disabled .page-link { background: var(--bg-card); border-color: var(--border-color); color: #cbd5e1; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state .card-body { color: var(--text-muted); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999; display: none;
  align-items: center; justify-content: center;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw; max-height: 90vh;
  object-fit: contain; border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute; top: 1.5rem; right: 1.5rem;
  background: rgba(0,0,0,0.4); border: none; color: #fff;
  font-size: 1.3rem; width: 42px; height: 42px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(0,0,0,0.7); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 40%, #f0f9ff 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.login-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  width: 100%; max-width: 420px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}
.login-logo { font-size: 3rem; color: var(--accent); margin-bottom: 1rem; }
.login-title { font-size: 1.8rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.5rem; letter-spacing: -0.5px; }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 2rem; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  width: 100%; padding: 0.85rem 1.5rem;
  background: #fff; color: #1f1f1f;
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius);
  font-weight: 600; font-size: 0.95rem;
  cursor: pointer; transition: all 0.2s;
  text-decoration: none; box-shadow: var(--shadow-sm);
}
.btn-google:hover { background: #f8fafc; box-shadow: var(--shadow); color: #1f1f1f; border-color: #cbd5e1; transform: translateY(-1px); }
.google-icon { width: 20px; height: 20px; flex-shrink: 0; }
.login-note { color: var(--text-muted); font-size: 0.78rem; margin-top: 1.5rem; margin-bottom: 0; }

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

/* ============================================================
   MOBILE TOPBAR
   ============================================================ */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}
.mobile-brand {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.mobile-tokens {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--warning);
  text-decoration: none;
  padding: 0.3rem 0.65rem;
  background: var(--warning-light);
  border-radius: 999px;
}
.mobile-tokens i { font-size: 0.85rem; }

.hamburger-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px; height: 38px;
  padding: 6px;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s;
}
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   SIDEBAR OVERLAY
   ============================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   RESPONSIVE — Tablet (≤ 992px)
   ============================================================ */
@media (max-width: 992px) {
  :root { --sidebar-width: 230px; }

  .main-content { padding: 1.5rem; }

  .stat-value { font-size: 1.5rem; }

  .card-header,
  .card-body { overflow-wrap: anywhere; }

  .btn {
    white-space: normal;
  }

  /* Tabelas: scroll horizontal */
  .table-responsive,
  .table-responsive-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
}

/* ============================================================
   RESPONSIVE — Mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Topbar visível */
  .mobile-topbar { display: flex; }

  /* Sidebar desliza fora da tela; abre com .open */
  .sidebar {
    width: min(88vw, 320px);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    z-index: 220;
    top: 0;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { z-index: 210; }

  .sidebar-brand {
    padding: 0.9rem 0.85rem 0.75rem;
    gap: 4px;
  }
  .brand-icon { font-size: 2.4rem; }
  .brand-name { font-size: 0.78rem; }

  .sidebar-menu {
    padding: 0.55rem 0.65rem;
    padding-bottom: 1rem;
  }
  .sidebar-link {
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    font-size: 0.86rem;
  }

  .sidebar-user {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0.85rem calc(0.75rem + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 18px rgba(15, 23, 42, 0.06);
  }
  .sidebar-user-name { font-size: 0.78rem; }
  .sidebar-user-email { font-size: 0.68rem; }
  .sidebar-logout {
    width: 42px;
    height: 42px;
    font-size: 1.2rem;
    background: var(--danger-light);
    color: var(--danger);
  }

  /* Conteúdo começa abaixo da topbar */
  .main-wrapper { margin-left: 0; padding-top: 56px; }
  .main-content { padding: 1rem; }

  /* Page header empilha em telas pequenas */
  .page-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .page-header .d-flex { flex-wrap: wrap; gap: 0.5rem; }

  /* Stat cards: 2 colunas em mobile */
  .row.g-3 > [class*="col-md-"] { flex: 0 0 50%; max-width: 50%; }
  .stat-card { padding: 1rem; gap: 0.75rem; }
  .stat-icon { width: 44px; height: 44px; font-size: 1.2rem; }
  .stat-value { font-size: 1.4rem; }

  /* Tabelas com scroll horizontal */
  .table-responsive, .table-responsive-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
  }
  .table { min-width: 520px; font-size: 0.85rem; }
  .table th, .table td { padding: 0.6rem 0.75rem; }

  /* Cards: padding menor */
  .card-body { padding: 1rem; }
  .card-header { padding: 0.85rem 1rem; }

  /* Galeria: 2 colunas */
  .gallery-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Botões de ação: texto esconde, só ícone */
  .btn-hide-mobile { display: none !important; }
  .btn,
  .form-control,
  .form-select {
    min-height: 42px;
  }
  .d-flex.gap-2,
  .d-flex.gap-3 {
    flex-wrap: wrap;
  }

  /* Filtros em scroll horizontal */
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filter-bar::-webkit-scrollbar { height: 0; }

  /* Modals: tela cheia no mobile */
  .modal-dialog { margin: 0.5rem; }
  .modal-dialog-centered { align-items: flex-end; }
  .modal-content {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: calc(100dvh - 1rem);
    overflow: hidden;
  }
  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #toast-container {
    left: 1rem !important;
    right: 1rem !important;
    bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    width: auto !important;
  }
  #toast-container .alert {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Login card mais compacto */
  .login-card { padding: 2rem 1.5rem; }
}

/* ============================================================
   RESPONSIVE — Mobile pequeno (≤ 400px)
   ============================================================ */
@media (max-width: 400px) {
  .row.g-3 > [class*="col-md-"] { flex: 0 0 100%; max-width: 100%; }
  .stat-value { font-size: 1.25rem; }
  .main-content { padding: 0.75rem; }
  .mobile-topbar { padding: 0 0.75rem; gap: 0.5rem; }
  .mobile-brand { font-size: 0.95rem; }
  .mobile-tokens { padding: 0.3rem 0.5rem; }
  .gallery-grid { grid-template-columns: 1fr !important; }
}

/* ── Preview de formato de imagem ── */
.formato-preview-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.formato-preview {
  background: #6c757d;
  border-radius: 3px;
  transition: width .25s, height .25s;
}
.formato-preview-label { font-size: .7rem; color: #6c757d; white-space: nowrap; }

/* ── Destaque de imagens recém-chegadas (polling automático) ── */
@keyframes imgFlashNew {
  0%   { box-shadow: 0 0 0 0 rgba(13,110,253,.0); transform: scale(1); }
  20%  { box-shadow: 0 0 0 6px rgba(13,110,253,.55); transform: scale(1.02); }
  60%  { box-shadow: 0 0 0 4px rgba(13,110,253,.25); transform: scale(1); }
  100% { box-shadow: 0 0 0 0 rgba(13,110,253,0);    transform: scale(1); }
}
.img-flash-new > .gallery-card,
.img-flash-new > .draggable-card {
  animation: imgFlashNew 4.2s ease;
  border-radius: .75rem;
}
.img-flash-new::after {
  content: 'NOVA';
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: #0d6efd;
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 2px 8px;
  border-radius: 999px;
  pointer-events: none;
  animation: imgFlashNew 4.2s ease;
  box-shadow: 0 2px 8px rgba(13,110,253,.4);
}
.img-flash-new { position: relative; }

