:root {
  --bg: #0b1324;
  --panel: #131f38;
  --panel-2: #0f192e;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.22);
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #f59e0b;
  --primary-2: #f97316;
  --danger: #f43f5e;
  --success: #22c55e;
  --radius: 16px;
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--text);
  background: radial-gradient(circle at top right, #1b2c4e 0%, var(--bg) 55%);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.top-ribbon {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 50;
  background: linear-gradient(90deg, #22c55e, #facc15, #f97316, #f43f5e, #38bdf8);
}

/* Login */
.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 32px 26px;
  border-radius: 22px;
  background: rgba(19, 31, 56, 0.92);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.login-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde68a;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.login-subtitle {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.password-wrap {
  display: flex;
  gap: 8px;
}

.password-wrap input {
  flex: 1;
}

.ghost-mini-btn {
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

.ghost-mini-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.back-public-link {
  display: inline-block;
  margin-top: 18px;
  color: #7dd3fc;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.back-public-link:hover {
  text-decoration: underline;
}

.inline-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #fecdd3;
  font-size: 0.88rem;
}

/* Topbar */
.admin-topbar {
  position: sticky;
  top: 4px;
  z-index: 30;
  background: rgba(11, 19, 36, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px clamp(14px, 3vw, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-pill {
  padding: 6px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0b1324;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.topbar-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.18rem;
}

.topbar-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Layout principal */
.admin-container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px clamp(14px, 3vw, 24px) 54px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 24px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.card-head {
  margin-bottom: 16px;
}

.card-head h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* Previews */
.preview-box {
  position: relative;
  width: 100%;
  min-height: 150px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: var(--panel-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.header-preview-box img {
  display: block;
  width: 100%;
  max-height: 190px;
  object-fit: contain;
}

.preview-empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 16px;
  text-align: center;
}

.bg-preview-box {
  background:
    radial-gradient(circle at 15% 20%, rgba(34, 197, 94, 0.28), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(251, 191, 36, 0.28), transparent 45%),
    linear-gradient(150deg, #0a1426 0%, #152544 100%);
}

.bg-preview-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity 0.15s ease;
}

.bg-preview-overlay-label {
  position: relative;
  z-index: 2;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(10, 19, 36, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  max-width: 90%;
}

/* Formulários e campos */
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.upload-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.86rem;
  font-weight: 600;
  color: #e2e8f0;
}

.field input[type='text'],
.field input[type='url'],
.field input[type='password'],
.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.93rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
}

.file-input {
  width: 100%;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 0.86rem;
  cursor: pointer;
}

.file-input::file-selector-button {
  margin-right: 12px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
}

.file-input::file-selector-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.slider-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
}

.slider-header strong {
  color: #fde68a;
  font-size: 0.84rem;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.76rem;
}

.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: #e2e8f0;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

/* Botões */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

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

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-full {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #0b1324;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-danger-soft {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.35);
  color: #fda4af;
}

.btn-danger-soft:hover:not(:disabled) {
  background: rgba(244, 63, 94, 0.25);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Grids específicos */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-field {
  justify-content: center;
}

.settings-actions {
  grid-column: 1 / -1;
}

/* Editor de Barracas */
.stall-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(240px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.editor-mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.editor-mode-bar h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fde68a;
}

.checks-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.live-card-preview-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-caption {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.mock-stall-card {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.36);
  background: transparent;
}

.mock-stall-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mock-stall-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mock-stall-media::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(0deg, rgba(6, 12, 26, 0.34) 0%, transparent 30%);
  pointer-events: none;
}

.mock-stall-media.mock-media-clean::before {
  display: none;
}

.mock-placeholder {
  color: var(--muted);
  font-size: 0.86rem;
}

.mock-label-top {
  position: relative;
  padding: 10px 14px;
  background: rgba(10, 20, 38, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: #ffffff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
  text-align: center;
}

.mock-label-top.mock-label-solid {
  background: rgba(10, 20, 38, 0.94);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mock-cta {
  position: absolute;
  left: 12px;
  bottom: 10px;
  z-index: 2;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(10, 20, 38, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fde68a;
  font-size: 0.74rem;
  font-weight: 700;
}

/* Lista de barracas cadastradas */
.list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.list-header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.stalls-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stall-item {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.stall-thumb-wrap {
  position: relative;
  width: 128px;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  overflow: hidden;
  background: #0a1426;
  border: 1px solid var(--border);
}

.stall-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stall-info {
  min-width: 0;
}

.stall-info-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.stall-info-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
}

.status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.status-active {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.status-inactive {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.32);
}

.stall-info-url {
  display: block;
  color: #7dd3fc;
  font-size: 0.82rem;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stall-info-url:hover {
  text-decoration: underline;
}

.stall-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* Troca de senha */
.password-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.password-actions {
  grid-column: 1 / -1;
}

/* Toast */
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(92vw, 380px);
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border-strong);
  background: #172542;
  color: #ffffff;
}

.toast.toast-success {
  border-color: rgba(34, 197, 94, 0.55);
  background: #0d2b1d;
  color: #bbf7d0;
}

.toast.toast-error {
  border-color: rgba(244, 63, 94, 0.55);
  background: #33101a;
  color: #fecdd3;
}

/* Responsividade */
@media (max-width: 900px) {
  .panel-grid,
  .settings-grid,
  .stall-editor-layout,
  .password-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .stall-item {
    grid-template-columns: 1fr;
  }

  .stall-thumb-wrap {
    width: 100%;
    max-width: 240px;
  }

  .stall-actions {
    justify-content: flex-start;
  }
}
