/* BoothShare Mosaic — tokens portados de "BoothShare SaaS/assets/css/app.css"
   pra manter a identidade visual (verde floresta + champagne), mas com um
   conjunto de componentes bem mais enxuto: só o que este app usa. */
:root {
  --ivory-0: #FFFCF6; --ivory-1: #F7F2EA; --ivory-2: #EFE6D9; --ivory-3: #E3D6C4;
  --ink: #1C1C1A; --ink-2: #2D261E; --muted: #7F7568; --faint: #B9AFA1;
  --forest: #103B35; --forest-2: #072724;
  --forest-soft: rgba(22, 59, 57, .08); --forest-rim: rgba(22, 59, 57, .18);
  --champagne: #C6A15B; --champagne-2: #D8B66F;
  --champagne-soft: rgba(184, 135, 74, .12); --champagne-rim: rgba(184, 135, 74, .26);
  --danger: #a85a52; --success: #527b58; --warning: #A0712E;
  --line: rgba(39, 31, 22, .075); --line-2: rgba(39, 31, 22, .13);
  --r-sm: 12px; --r-md: 18px; --r-lg: 24px; --r-xl: 34px;
  --shadow-soft: 0 1px 2px rgba(39,31,22,.04), 0 10px 28px rgba(39,31,22,.055);
  --shadow-elevated: 0 8px 24px rgba(39,31,22,.08), 0 28px 70px rgba(39,31,22,.10);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--ivory-1); color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: 'Fraunces', Georgia, serif; color: var(--ink-2); margin: 0; }
a { color: inherit; text-decoration: none; }
.caption { color: var(--muted); font-size: 13px; }

.bs-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--ivory-0); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.logo-lockup { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 32px; height: 32px; border-radius: 9px; overflow: hidden; background: var(--forest); display: flex; align-items: center; justify-content: center; }
.logo-mark img { width: 100%; height: 100%; object-fit: cover; }
.logo-word { font-family: 'Fraunces', Georgia, serif; font-weight: 650; font-size: 17px; color: var(--ink-2); }
.logo-word span { color: var(--champagne); }
.logo-sub { font-size: 10px; letter-spacing: .16em; color: var(--muted); font-weight: 700; margin-top: -2px; }

.bs-main { max-width: 1080px; margin: 0 auto; padding: 26px 20px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--forest), var(--forest-2)); color: #fff;
  font-weight: 700; font-size: 14px; box-shadow: var(--shadow-soft);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-elevated); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px; cursor: pointer;
  background: transparent; border: 1.5px solid var(--line-2); color: var(--ink-2);
  font-weight: 700; font-size: 14px;
}
.btn-champagne {
  background: linear-gradient(145deg, var(--champagne-2), var(--champagne)); color: var(--ink-2);
}
.btn-danger { color: var(--danger); border-color: rgba(168,90,82,.3); }
.btn-block { width: 100%; }
.btn-lg { height: 58px; font-size: 16px; border-radius: var(--r-md); }

.panel {
  background: var(--ivory-0); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft); padding: 22px;
}
.card {
  background: var(--ivory-0); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--shadow-soft); padding: 18px;
}

.flash { background: var(--forest-soft); color: var(--forest); border: 1px solid var(--forest-rim); border-radius: var(--r-sm); padding: 10px 16px; margin: 0 0 16px; font-size: 13px; font-weight: 600; }
.alert { background: rgba(168,90,82,.08); color: var(--danger); border: 1px solid rgba(168,90,82,.25); border-radius: var(--r-sm); padding: 10px 16px; margin: 0 0 16px; font-size: 13px; font-weight: 600; }

/* --- Dashboard: grid de mosaicos --- */
.mosaic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 18px; }
.mosaic-card { display: block; overflow: hidden; }
.mosaic-card-cover { width: 100%; aspect-ratio: 4/3; background: var(--ivory-2); object-fit: cover; display: block; }
.mosaic-card-body { padding: 14px 4px 2px; }
.mosaic-card-title { font-family: 'Fraunces', Georgia, serif; font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.mosaic-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.mosaic-progress-bar { height: 6px; border-radius: 99px; background: var(--ivory-2); overflow: hidden; margin-bottom: 6px; }
.mosaic-progress-fill { height: 100%; background: linear-gradient(90deg, var(--champagne), var(--forest)); }
.mosaic-progress-label { font-size: 12px; font-weight: 700; color: var(--ink-2); display: flex; justify-content: space-between; }
.status-pill { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; margin-top: 8px; }
.status-draft { background: var(--ivory-2); color: var(--muted); }
.status-ready { background: var(--champagne-soft); color: var(--champagne); }
.status-in_progress { background: var(--forest-soft); color: var(--forest); }
.status-completed { background: rgba(82,123,88,.12); color: var(--success); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

/* --- Wizard de criação --- */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 22px; }
.wizard-step { flex: 1; height: 4px; border-radius: 99px; background: var(--ivory-2); }
.wizard-step.is-active, .wizard-step.is-done { background: var(--forest); }
.wizard-pane { display: none; }
.wizard-pane.is-active { display: block; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=number], .field textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line-2);
  font-family: inherit; font-size: 14px; background: var(--ivory-0); color: var(--ink);
}
.field textarea { resize: vertical; min-height: 70px; }

.format-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.format-tab { padding: 8px 16px; border-radius: 99px; border: 1.5px solid var(--line-2); background: var(--ivory-0); font-size: 13px; font-weight: 700; cursor: pointer; }
.format-tab.is-active { background: var(--forest); border-color: var(--forest); color: #fff; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.preset-card { border: 1.5px solid var(--line-2); border-radius: var(--r-sm); padding: 12px; cursor: pointer; text-align: center; background: var(--ivory-0); }
.preset-card.is-selected { border-color: var(--forest); background: var(--forest-soft); }
.preset-card strong { display: block; font-size: 15px; margin-bottom: 2px; }
.preset-card span { font-size: 11px; color: var(--muted); }
.custom-grid-fields { display: flex; gap: 12px; align-items: flex-end; }
.custom-grid-fields .field { flex: 1; margin-bottom: 0; }

.grid-preview-wrap { background: var(--ivory-2); border-radius: var(--r-md); padding: 18px; text-align: center; }
.grid-preview { display: inline-grid; gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); margin: 0 auto 10px; max-width: 100%; }
.grid-preview-cell { background: var(--ivory-0); aspect-ratio: 1/1; }
.grid-preview-total { font-family: 'Fraunces', Georgia, serif; font-size: 22px; font-weight: 650; }
.grid-preview-sub { font-size: 12px; color: var(--muted); }

.crop-stage { position: relative; overflow: hidden; border-radius: var(--r-md); background: #000; margin-bottom: 10px; touch-action: none; }
.crop-stage img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 2px solid var(--champagne); box-shadow: 0 0 0 2000px rgba(0,0,0,.5); cursor: move; }
.crop-box::after { content: ''; position: absolute; inset: 0; border: 1px dashed rgba(255,255,255,.6); }
.crop-handle { position: absolute; width: 18px; height: 18px; background: var(--champagne); border-radius: 50%; right: -9px; bottom: -9px; cursor: nwse-resize; }

/* --- Tela de operação: mobile-first, botões grandes --- */
.operate-wrap { max-width: 480px; margin: 0 auto; padding: 16px; }
.operate-header { text-align: center; margin-bottom: 14px; }
.operate-header .event-name { font-family: 'Fraunces', Georgia, serif; font-size: 20px; }
.operate-progress { text-align: center; margin-bottom: 18px; }
.operate-progress .count { font-size: 15px; font-weight: 800; }
.operate-preview {
  width: 100%; aspect-ratio: 1/1; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: var(--shadow-elevated); margin-bottom: 18px; background: var(--ivory-3);
  display: grid; gap: 1px;
}
.operate-preview-cell { background-size: cover; background-position: center; position: relative; }
.operate-preview-cell.is-filled { animation: tileIn .35s ease; }
@keyframes tileIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
.operate-preview-cell.is-filled img { width: 100%; height: 100%; object-fit: cover; display: block; }
.operate-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.operate-btn-camera {
  background: linear-gradient(145deg, var(--forest), var(--forest-2)); color: #fff;
  border: none; border-radius: var(--r-lg); height: 84px; font-size: 19px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 12px; cursor: pointer;
  box-shadow: var(--shadow-elevated);
}
.operate-btn-upload {
  background: var(--ivory-0); border: 1.5px solid var(--line-2); border-radius: var(--r-md);
  height: 56px; font-size: 15px; font-weight: 700; color: var(--ink-2); cursor: pointer;
}
.operate-result {
  text-align: center; padding: 22px; border-radius: var(--r-lg); background: var(--ivory-0);
  border: 1px solid var(--line); box-shadow: var(--shadow-soft); margin-bottom: 18px;
}
.operate-result-check { color: var(--success); font-weight: 800; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
.operate-result img { width: 200px; height: 200px; object-fit: cover; border-radius: var(--r-md); box-shadow: var(--shadow-soft); }
.operate-result-position { font-family: 'Fraunces', Georgia, serif; font-size: 15px; color: var(--muted); margin: 14px 0 4px; }
.operate-result-code { font-family: 'Fraunces', Georgia, serif; font-size: 44px; font-weight: 650; color: var(--forest); line-height: 1; }
.operate-result-actions { display: flex; gap: 10px; margin-top: 18px; }
.operate-result-actions .btn-primary, .operate-result-actions .btn-ghost { flex: 1; }
.operate-complete { text-align: center; padding: 40px 20px; }
.operate-complete .display { font-size: 24px; margin-bottom: 8px; }
.operate-loading { text-align: center; padding: 40px 0; color: var(--muted); font-weight: 700; }
.operate-loading .spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ivory-2); border-top-color: var(--forest); animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Lista de fotos --- */
.photos-toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.photos-toolbar input[type=search] { flex: 1; min-width: 180px; padding: 10px 14px; border-radius: 99px; border: 1.5px solid var(--line-2); font-size: 13px; }
.photos-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.photos-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line-2); }
.photos-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.photos-table img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.photos-table .actions { display: flex; gap: 6px; }
.photos-table .actions a, .photos-table .actions button { font-size: 12px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--ivory-0); cursor: pointer; }

/* --- Impressão de uma foto (print.php) --- */
@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea { position: fixed; inset: 0; margin: 0; display: flex; align-items: center; justify-content: center; }
  #printArea img { max-width: 100%; max-height: 100%; }
  @page { margin: 0; }
}

@media (max-width: 640px) {
  .bs-main { padding: 16px 12px 60px; }
  .mosaic-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* --- Tela ao vivo (mosaic_live.php): TV/projetor do evento --- */
.live-body { background: #06201d; color: var(--ivory-1); overflow: hidden; }
.live { position: fixed; inset: 0; display: flex; flex-direction: column; padding: clamp(14px, 2.4vh, 32px) clamp(16px, 2.6vw, 44px); gap: clamp(10px, 2vh, 22px); }
.live-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.live-eyebrow { font-size: clamp(11px, 1.3vh, 14px); letter-spacing: .2em; text-transform: uppercase; color: var(--champagne-2); font-weight: 700; margin-bottom: 6px; }
.live-title { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: clamp(22px, 4.4vh, 56px); line-height: 1.02; color: var(--ivory-0); }
.live-count { font-family: 'Fraunces', Georgia, serif; font-size: clamp(26px, 5vh, 64px); font-weight: 600; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; color: var(--ivory-0); }
.live-count-sep { color: rgba(255,255,255,.35); margin: 0 .12em; }
.live-count-label { font-family: 'Manrope', system-ui, sans-serif; font-size: clamp(11px, 1.3vh, 14px); letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.55); font-weight: 700; margin-top: 6px; }
.live-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; container-type: size; }
.live-grid {
  aspect-ratio: var(--aspect); width: min(100cqw, calc(100cqh * var(--aspect)));
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr);
  gap: 1px; background: rgba(255,255,255,.06);
}
.live-cell { position: relative; overflow: hidden; background-color: #0b2b27; background-repeat: no-repeat; filter: grayscale(.55) opacity(.38); }
.live-cell.is-filled { filter: none; }
.live-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.live-cell.is-new { animation: liveIn .7s cubic-bezier(.2,.8,.2,1); z-index: 2; outline: 2px solid var(--champagne-2); outline-offset: -1px; }
@keyframes liveIn { 0% { transform: scale(2.2); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); } }
.live-bottom { display: flex; align-items: center; gap: 24px; }
.live-bar { flex: 1; height: 3px; background: rgba(255,255,255,.12); }
.live-bar-fill { height: 100%; background: var(--champagne-2); transition: width .6s ease; }
.live-qr { display: flex; align-items: center; gap: 14px; }
.live-qr img { display: block; background: #fff; padding: 8px; width: clamp(84px, 11vh, 140px); height: auto; image-rendering: pixelated; }
.live-qr-text { font-size: clamp(12px, 1.6vh, 18px); line-height: 1.35; color: rgba(255,255,255,.8); font-weight: 600; }
.live-spot { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4, 22, 20, .86); animation: liveSpotIn .45s ease; }
.live-spot img { width: min(58vh, 70vw); height: min(58vh, 70vw); object-fit: cover; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.live-spot-label { margin-top: 3vh; font-size: clamp(12px, 1.6vh, 18px); letter-spacing: .24em; text-transform: uppercase; color: rgba(255,255,255,.6); font-weight: 700; }
.live-spot-code { font-family: 'Fraunces', Georgia, serif; font-size: clamp(48px, 11vh, 140px); font-weight: 600; line-height: 1; color: var(--champagne-2); }
.live-spot.is-out { animation: liveSpotOut .45s ease forwards; }
@keyframes liveSpotIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes liveSpotOut { to { opacity: 0; transform: scale(.9); } }
.live-done { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5; font-family: 'Fraunces', Georgia, serif; font-size: clamp(32px, 8vh, 96px); color: var(--ivory-0); background: rgba(4,22,20,.72); padding: .2em .6em; pointer-events: none; }
.live-offline { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 12; font-size: 13px; font-weight: 700; color: #fff; background: rgba(168,90,82,.92); padding: 8px 16px; border-radius: 99px; }
.live-fs { position: fixed; right: 16px; top: 16px; z-index: 12; height: 34px; padding: 0 14px; border-radius: 99px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.25); color: #fff; font: 700 12px 'Manrope', system-ui, sans-serif; cursor: pointer; transition: opacity .3s; }
.live-body.is-idle { cursor: none; }
.live-body.is-idle .live-fs { opacity: 0; pointer-events: none; }
@media (max-width: 700px) { .live-top { align-items: flex-start; } .live-qr-text { display: none; } }
