/**
 * MONTENEGRO INTERIORES - DESIGN SYSTEM 2026
 * 04_modals.css
 *
 * Sistema Universal de Modais e Diálogos de Confirmação Institucionais.
 * Consolidado em 4 Arquétipos Oficiais:
 *
 * Arquétipo A: Formulário Operacional (.modal-form-layout)
 * Arquétipo B: Ficha Técnica & Inspeção com Mídia (.modal-split-layout / .modal-split-view)
 * Arquétipo C: Ledger / Auditoria, Histórico & OPs (.modal-ledger)
 * Arquétipo D: Diálogo Institucional de Confirmação & Risco (.mi-confirm-dialog)
 *
 * Inclui:
 * - Vitrine de Luxo Showroom (Showroom Premium para visualização do cliente)
 * - Carrossel Imersivo com miniaturas, navegação suave e swipe
 * - Ergonomia para uso prolongado (8h+)
 * - Responsividade mobile-first com bottom-sheet nativo
 */

/* ==========================================================================
   1. BACKDROPS E CAMADAS DE SOBREPOSIÇÃO (UNIVERSAL)
   ========================================================================== */

.modal,
.modal-overlay,
.showroom-modal,
.mi-confirm-backdrop,
.consultora-modal-backdrop,
.promo-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal, 1000);

  display: none;
  align-items: center;
  justify-content: center;

  padding: var(--space-4, 16px);
  box-sizing: border-box;

  background: rgba(7, 9, 13, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
    visibility 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modos ativos / abertos */
.modal.active,
.modal.open,
.modal.show,
.modal-overlay.active,
.showroom-modal.active,
.mi-confirm-backdrop.active,
.consultora-modal-backdrop.open,
.promo-modal-backdrop.active {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Compatibilidade com manipulação direta via JavaScript (style.display = 'flex' / 'block') */
.modal[style*="display: flex"],
.modal[style*="display: block"],
.showroom-modal[style*="display: flex"],
.showroom-modal[style*="display: block"] {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}


/* ==========================================================================
   2. CONTAINERS E DIÁLOGOS BÁSICOS
   ========================================================================== */

.modal-content,
.modal-container,
.mi-confirm-dialog,
.consultora-modal,
.promo-modal-wrapper {
  position: relative;

  display: flex;
  flex-direction: column;

  width: 100%;
  min-width: 0;
  max-width: 640px;
  max-height: 90vh;
  max-height: 90dvh;

  box-sizing: border-box;
  overflow: hidden;

  background: var(--bg-surface, #14171d);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);

  color: var(--text-main, #f0f2f5);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.85),
    0 4px 16px rgba(0, 0, 0, 0.6),
    0 0 1px rgba(255, 255, 255, 0.12);

  transform: scale(0.97) translateY(8px);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);

  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal.active .modal-content,
.modal.open .modal-content,
.modal.show .modal-content,
.modal[style*="display: flex"] .modal-content,
.modal-overlay.active .modal-content,
.showroom-modal.active .modal-container,
.showroom-modal.active .modal-content,
.showroom-modal[style*="display: flex"] .modal-content,
.mi-confirm-backdrop.active .mi-confirm-dialog,
.consultora-modal-backdrop.open .consultora-modal,
.promo-modal-backdrop.active .promo-modal-wrapper {
  transform: scale(1) translateY(0);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Linha superior de identidade visual corporativa Montenegro */
.modal-content::after,
.modal-container::after,
.mi-confirm-dialog::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--primary, #e53935) 0%, rgba(229, 57, 53, 0.4) 60%, transparent 100%);
  pointer-events: none;
  z-index: 10;
}

/* ==========================================================================
   3. MODIFICADORES DE TAMANHO
   ========================================================================== */

.modal-sm .modal-content,
.modal-content.modal-sm,
.modal.modal-sm .modal-content,
.mi-confirm-dialog {
  max-width: 480px;
}

.modal-md .modal-content,
.modal-content.modal-md,
.modal.modal-md .modal-content {
  max-width: 660px;
}

.modal-lg .modal-content,
.modal-content.large,
.modal-content.modal-lg,
.modal.modal-lg .modal-content {
  max-width: 860px;
}

.modal-xl .modal-content,
.modal-content.modal-xl,
.modal.modal-xl .modal-content,
.consultora-modal {
  max-width: 1080px;
}


/* ==========================================================================
   4. ANATOMIA FUNDAMENTAL: CABEÇALHO, CORPO E RODAPÉ
   ========================================================================== */

.modal-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4, 16px);

  min-width: 0;
  padding: var(--space-4, 16px) var(--space-6, 24px);

  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  background: rgba(255, 255, 255, 0.015);
}

.modal-header h2,
.modal-header h3 {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);

  min-width: 0;
  margin: 0;

  color: var(--text-main, #f0f2f5);
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.modal-header h2 svg,
.modal-header h3 svg {
  color: var(--primary, #e53935);
  flex-shrink: 0;
}

.close-button,
.close-immersive-btn,
.consultora-modal-close,
.promo-modal-close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;
  padding: 0;

  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 6px);

  color: var(--text-muted, #8a94a6);
  font-size: 1.4rem;
  line-height: 1;

  cursor: pointer;
  transition:
    color var(--transition-fast, 0.15s ease),
    background var(--transition-fast, 0.15s ease),
    border-color var(--transition-fast, 0.15s ease);
}

.close-button:hover,
.close-immersive-btn:hover,
.consultora-modal-close:hover,
.promo-modal-close:hover {
  color: var(--text-main, #ffffff);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.close-button:focus-visible,
.close-immersive-btn:focus-visible {
  outline: 2px solid var(--primary, #e53935);
  outline-offset: 2px;
}

.modal-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--space-5, 20px);

  min-width: 0;
  min-height: 0;
  padding: var(--space-6, 24px);

  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-body::-webkit-scrollbar,
.modal-scroll-content::-webkit-scrollbar,
.showroom-split-layout::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.modal-body::-webkit-scrollbar-track,
.modal-scroll-content::-webkit-scrollbar-track,
.showroom-split-layout::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

.modal-body::-webkit-scrollbar-thumb,
.modal-scroll-content::-webkit-scrollbar-thumb,
.showroom-split-layout::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.modal-footer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3, 12px);

  padding: var(--space-4, 16px) var(--space-6, 24px);

  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  background: rgba(11, 13, 17, 0.6);
}

.modal-error-message {
  display: none;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid rgba(229, 57, 53, 0.4);
  border-left: 3px solid var(--primary, #e53935);
  border-radius: var(--radius-sm, 6px);
  color: #ff6b6b;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  line-height: 1.45;
}


/* ==========================================================================
   5. ARQUÉTIPO A: FORMULÁRIO OPERACIONAL (.modal-form-layout)
   ========================================================================== */

.modal-form-layout .modal-body {
  padding: var(--space-5, 20px) var(--space-6, 24px);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
  width: 100%;
  min-width: 0;
}

.modal-form .form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
  min-width: 0;
  margin-bottom: 0;
}

.field-label,
.modal-form label {
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-form input[type="text"],
.modal-form input[type="number"],
.modal-form input[type="date"],
.modal-form input[type="url"],
.modal-form select,
.modal-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-3, 10px) var(--space-4, 14px);

  background: var(--bg-base, #0b0d11);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  border-radius: var(--radius-md, 8px);

  color: var(--text-main, #f0f2f5);
  font-family: inherit;
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.4;

  transition:
    border-color var(--transition-fast, 0.15s ease),
    box-shadow var(--transition-fast, 0.15s ease);
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--primary, #e53935);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.18);
}

.form-row,
.form-row-wide {
  display: grid;
  gap: var(--space-4, 16px);
  min-width: 0;
}

.form-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.form-row-wide {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
}

.form-group-static {
  padding: var(--space-3, 10px) var(--space-4, 14px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
}

.form-group-static p {
  margin: 0;
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-sm, 0.875rem);
}

.form-group-static strong {
  color: var(--text-main, #ffffff);
  font-variant-numeric: tabular-nums;
}

.segmented-control {
  display: inline-flex;
  gap: var(--space-2, 8px);
  padding: 4px;
  background: var(--bg-base, #0b0d11);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
}

.segmented-control label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2, 6px);
  padding: var(--space-2, 6px) var(--space-3, 12px);
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  font-size: var(--font-size-xs, 0.75rem);
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted, #8a94a6);
  transition: all var(--transition-fast, 0.15s ease);
}

.segmented-control input[type="radio"] {
  accent-color: var(--primary, #e53935);
}

.segmented-control label:hover {
  color: var(--text-main, #ffffff);
}

.modal-scroll-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
  max-height: 60vh;
  overflow-y: auto;
  padding-right: var(--space-2, 8px);
}


/* ==========================================================================
   6. ARQUÉTIPO B: FICHA TÉCNICA (ESTOQUE) & INSPEÇÃO COM MÍDIA
   ========================================================================== */

.modal-split-view .modal-content {
  max-width: 1040px;
}

.modal-split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 40%) minmax(0, 1fr);
  align-items: start;
  gap: var(--space-6, 24px);
  width: 100%;
}

.modal-gallery-area,
.modal-left {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
  min-width: 0;
}

.gallery-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  aspect-ratio: 4 / 3;

  background: linear-gradient(145deg, #161a22 0%, #0d0f14 100%);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.image-gallery-view {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.image-gallery-view img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-gallery-view img:hover {
  transform: scale(1.03);
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  transform: translateY(-50%);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 36px;
  height: 36px;
  padding: 0;

  background: rgba(11, 13, 17, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;

  color: #ffffff;
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
}

.gallery-arrow:hover {
  background: var(--primary, #e53935);
  border-color: var(--primary, #e53935);
  transform: translateY(-50%) scale(1.1);
}

.prev-arrow { left: 10px; }
.next-arrow { right: 10px; }

/* Slots de Edição de Foto */
.image-slots-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2, 8px);
  margin-top: var(--space-2, 8px);
}

.image-slot {
  position: relative;
  aspect-ratio: 1;
  background: var(--bg-base, #0b0d11);
  border: 1px dashed var(--border-color, rgba(255, 255, 255, 0.15));
  border-radius: var(--radius-md, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--transition-fast, 0.15s ease);
}

.image-slot:hover {
  border-color: var(--primary, #e53935);
}

.slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted, #8a94a6);
  font-size: 0.65rem;
  text-align: center;
}

.image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-info-area,
.modal-right {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 16px);
  min-width: 0;
}

.info-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2, 8px);
}

.badge-item,
.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-sm, 6px);
  font-size: var(--font-size-xs, 0.75rem);
  color: var(--text-muted, #8a94a6);
}

.badge-item strong,
.badge-tag strong {
  color: var(--text-main, #ffffff);
}

.sku-tag {
  background: rgba(229, 57, 53, 0.08);
  border-color: rgba(229, 57, 53, 0.25);
  color: var(--primary, #e53935);
  font-family: var(--font-mono, "SF Mono", monospace);
}

.price-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3, 12px);
  padding: var(--space-4, 16px);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
}

.price-showcase-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.price-label {
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.price-value-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.price-currency {
  color: var(--text-muted, #8a94a6);
  font-size: 0.9rem;
  font-weight: 500;
}

.price-value {
  margin: 0;
  color: var(--text-main, #ffffff);
  font-size: var(--font-size-xl, 1.25rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.price-value-row.highlight-sale .price-value,
.price-value.highlight-sale {
  color: var(--success, #2e7d32);
}

.stock-showcase {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3, 12px);
}

.stock-showcase-item,
.stock-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3, 10px) var(--space-4, 12px);
  background: var(--bg-surface-elevated, #1a1e27);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
}

.stock-label {
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stock-value {
  color: var(--text-main, #ffffff);
  font-size: 1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.specs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3, 10px);
}

.spec-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2, 8px) var(--space-3, 12px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
  border-radius: var(--radius-sm, 6px);
}

.spec-item.spec-item-full {
  grid-column: 1 / -1;
}

.spec-label {
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.72rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spec-value {
  color: var(--text-main, #f0f2f5);
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.obs-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 6px);
  padding: var(--space-3, 12px) var(--space-4, 14px);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-sm, 6px);
}

.obs-area h4 {
  margin: 0;
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.obs-area p {
  margin: 0;
  color: var(--text-main, #d1d5db);
  font-size: var(--font-size-sm, 0.875rem);
  font-style: italic;
  line-height: 1.45;
}

.modal-footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3, 12px);
  margin-top: var(--space-2, 8px);
  padding-top: var(--space-4, 16px);
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
}


/* ==========================================================================
   7. SHOWROOM PREMIUM - VITRINE IMERSIVA DO CLIENTE (LUXO & CONVERSÃO)
   ========================================================================== */

.showroom-modal {
  z-index: calc(var(--z-modal, 1000) + 20);
  background: rgba(5, 7, 10, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.showroom-modal .modal-content,
.showroom-modal .showroom-dialog,
.showroom-modal .immersive-modal {
  max-width: min(1200px, 94vw) !important;
  height: min(840px, 92vh) !important;
  max-height: 92vh !important;
  border-radius: var(--radius-xl, 16px);
  background: radial-gradient(ellipse at top left, rgba(229, 57, 53, 0.08), transparent 50%), #12151c;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.95),
    0 8px 24px rgba(0, 0, 0, 0.7),
    0 0 1px rgba(255, 255, 255, 0.2);
}

.showroom-modal .close-immersive-btn {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(11, 13, 17, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f0f2f5;
  cursor: pointer;
  transition: all 0.2s ease;
}

.showroom-modal .close-immersive-btn:hover {
  background: var(--primary, #e53935);
  border-color: var(--primary, #e53935);
  color: #ffffff;
  transform: scale(1.08);
}

.showroom-modal .modal-split-layout,
.showroom-split-layout {
  display: grid;
  grid-template-columns: minmax(440px, 54%) minmax(0, 46%);
  gap: var(--space-6, 28px);
  height: 100%;
  padding: var(--space-6, 28px);
  box-sizing: border-box;
  overflow-y: auto;
}

/* Lado Esquerdo: Galeria */
.showroom-gallery-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
  min-width: 0;
  height: 100%;
}

.gallery-viewport-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  min-height: 420px;
  background: #090b0e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Carrossel com Scroll Horizontal Ativo */
.showroom-modal .immersive-carousel {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-snap-type: x mandatory !important;
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: none !important;
  width: 100% !important;
  height: 100% !important;
  scroll-behavior: smooth !important;
}

.showroom-modal .immersive-carousel::-webkit-scrollbar {
  display: none !important;
}

.showroom-modal .immersive-carousel img {
  flex: 0 0 100% !important;
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  scroll-snap-align: start !important;
  user-select: none;
  cursor: grab;
}

/* Badges sobre a foto */
.gallery-badge-exclusive {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(11, 13, 17, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #f0f2f5;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary, #e53935);
  box-shadow: 0 0 10px var(--primary, #e53935);
}

.gallery-counter-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: rgba(11, 13, 17, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Botões de Navegação */
.showroom-modal .gallery-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: rgba(11, 13, 17, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.showroom-modal .gallery-nav-btn:hover {
  background: var(--primary, #e53935);
  border-color: var(--primary, #e53935);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 20px rgba(229, 57, 53, 0.5);
}

.showroom-modal .gallery-nav-btn.prev { left: 14px; }
.showroom-modal .gallery-nav-btn.next { right: 14px; }

.showroom-modal .gallery-nav-btn.hidden {
  display: none !important;
}

/* Dots da Galeria */
.showroom-modal .gallery-dots {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.showroom-modal .gallery-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.showroom-modal .gallery-dots .dot.active {
  width: 24px;
  border-radius: 4px;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

/* Miniaturas / Thumbnails Bar */
.gallery-thumbnails {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: none;
}

.gallery-thumbnails::-webkit-scrollbar {
  display: none;
}

.gallery-thumb-item {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 56px;
  padding: 0;
  background: #090b0e;
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.gallery-thumb-item:hover {
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}

.gallery-thumb-item.active {
  border: 2px solid var(--primary, #e53935);
  box-shadow: 0 0 12px rgba(229, 57, 53, 0.45);
  transform: scale(1.05);
}

.gallery-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Lado Direito: Informações e Venda */
.showroom-info-area {
  display: flex;
  flex-direction: column;
  gap: var(--space-4, 18px);
  min-width: 0;
  height: 100%;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.collection-tag {
  color: #f59e0b;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-title {
  margin: 0;
  color: #ffffff;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.sku-row {
  margin-top: 4px;
}

.showroom-price-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-4, 18px) var(--space-5, 20px);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--success, #10b981);
  border-radius: var(--radius-md, 10px);
}

.price-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.price-condition-badge {
  color: var(--success, #10b981);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.showroom-price-value {
  margin: 4px 0 0 0;
  color: #10b981;
  font-size: 2.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  text-shadow: 0 0 25px rgba(16, 185, 129, 0.25);
}

.price-installment-info {
  margin: 2px 0 0 0;
  color: var(--text-muted, #8a94a6);
  font-size: 0.8rem;
}

.showroom-stock-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md, 8px);
}

.stock-status-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-pill.disponivel {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
}

.status-pill.reservado {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.status-pill.esgotado {
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: #f87171;
}

.stock-details-text {
  margin: 0;
  color: var(--text-main, #d1d5db);
  font-size: 0.85rem;
  font-weight: 500;
}

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

.showroom-obs-area {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-md, 8px);
  padding: 12px 16px;
}

.showroom-obs-area h4 {
  margin: 0 0 6px 0;
  color: var(--text-muted, #8a94a6);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.showroom-obs-area p {
  margin: 0;
  color: #e2e8f0;
  font-size: 0.875rem;
  line-height: 1.5;
  white-space: pre-line;
}

.showroom-modal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
}


/* ==========================================================================
   8. ARQUÉTIPO C: LEDGER / AUDITORIA, HISTÓRICO & OPS (.modal-ledger)
   ========================================================================== */

.modal-ledger .modal-content {
  max-width: 1060px;
}

.ledger-kpis,
.history-kpis,
.op-summary-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-4, 16px);
}

.kpi-mini-card,
.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: var(--bg-surface-elevated, #1a1e27);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
}

.kpi-mini-card .label,
.summary-item .label {
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.kpi-mini-card .value,
.summary-item .value {
  color: var(--text-main, #ffffff);
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.destaque-financeiro {
  color: #f59e0b !important;
  font-weight: 700 !important;
}

.hero-code {
  color: var(--primary, #e53935) !important;
  font-family: var(--font-mono, monospace);
  font-weight: 700 !important;
}

.op-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3, 12px);
  margin-bottom: var(--space-4, 16px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
}

.ledger-table,
.production-table,
.history-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}

.ledger-table thead th,
.production-table thead th,
.history-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;

  padding: var(--space-3, 10px) var(--space-4, 14px);

  background: var(--bg-surface-elevated, #1a1e27);
  border-bottom: 2px solid var(--border-color, rgba(255, 255, 255, 0.12));

  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.ledger-table tbody td,
.production-table tbody td,
.history-table tbody td {
  padding: var(--space-3, 10px) var(--space-4, 14px);
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
  color: var(--text-main, #d1d5db);
  font-size: var(--font-size-sm, 0.875rem);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  vertical-align: middle;
}

.ledger-table tbody tr:hover,
.production-table tbody tr:hover,
.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
  margin-top: var(--space-3, 12px);
  padding-left: var(--space-4, 16px);
  border-left: 2px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
}

.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--font-size-sm, 0.875rem);
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary, #e53935);
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2);
}

.history-chart-container,
.financial-modal-chart-container {
  width: 100%;
  min-height: 140px;
  max-height: 260px;
}

.alert-banner {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 6px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  border-radius: var(--radius-md, 8px);
}

.alert-banner-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid #f59e0b;
}

.alert-banner-info {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-left: 4px solid #3b82f6;
}

.alert-banner-header {
  display: flex;
  align-items: center;
  gap: var(--space-2, 8px);
}

.alert-banner-header .label {
  color: #f59e0b;
  font-size: var(--font-size-xs, 0.75rem);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.alert-banner-body {
  color: #fef3c7;
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.45;
  white-space: pre-line;
}

.agenda-notes-box {
  background: var(--bg-base, #0b0d11);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--radius-md, 8px);
  padding: var(--space-3, 12px) var(--space-4, 14px);
  color: var(--text-muted, #8a94a6);
  font-style: italic;
  font-size: var(--font-size-sm, 0.875rem);
  min-height: 50px;
  white-space: pre-line;
}

.prorrogar-box {
  margin-top: var(--space-4, 16px);
  padding: var(--space-4, 16px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
}

.prorrogar-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3, 10px);
  margin-top: var(--space-3, 12px);
}

.ranking-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5, 20px);
}

.ranking-details-column h3 {
  margin: 0 0 var(--space-3, 12px);
  color: var(--text-main, #ffffff);
  font-size: var(--font-size-md, 1rem);
  font-weight: 600;
}

.modal-list,
.tasks-modal-list,
.modal-product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2, 8px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tasks-modal-list li,
.modal-product-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3, 12px);
  padding: var(--space-3, 10px) var(--space-4, 14px);
  background: var(--bg-surface-elevated, #1a1e27);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  border-radius: var(--radius-md, 8px);
  font-size: var(--font-size-sm, 0.875rem);
}


/* ==========================================================================
   9. ARQUÉTIPO D: CONFIRMAÇÃO INSTITUCIONAL & DIÁLOGOS DE RISCO (.mi-confirm-dialog)
   ========================================================================== */

.mi-confirm-dialog {
  padding: var(--space-6, 24px);
  text-align: left;
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: var(--radius-lg, 12px);
}

.mi-confirm-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4, 16px);
  border-radius: var(--radius-md, 8px);
  background: rgba(229, 57, 53, 0.12);
  color: var(--primary, #e53935);
}

.mi-confirm-icon-wrapper.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.mi-confirm-icon-wrapper.info {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.mi-confirm-icon-wrapper.success {
  background: rgba(46, 125, 50, 0.12);
  color: var(--success, #2e7d32);
}

.mi-confirm-dialog h3,
.mi-confirm-title {
  margin: 0 0 var(--space-2, 8px);
  color: var(--text-main, #ffffff);
  font-size: var(--font-size-lg, 1.125rem);
  font-weight: 600;
}

.mi-confirm-dialog p,
.mi-confirm-message {
  margin: 0 0 var(--space-5, 20px);
  color: var(--text-muted, #8a94a6);
  font-size: var(--font-size-sm, 0.875rem);
  line-height: 1.5;
}

.mi-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3, 12px);
  padding: 0;
  border-top: none;
  background: transparent;
}

.mi-confirm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2, 8px) var(--space-4, 16px);
  border-radius: var(--radius-md, 8px);
  font-family: inherit;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast, 0.15s ease);
}

.mi-confirm-btn-cancel {
  background: transparent;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  color: var(--text-muted, #8a94a6);
}

.mi-confirm-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main, #ffffff);
}

.mi-confirm-btn-action {
  background: var(--primary, #e53935);
  border: 1px solid transparent;
  color: #ffffff;
}

.mi-confirm-btn-action:hover {
  background: #d32f2f;
  transform: translateY(-1px);
}

.mi-confirm-btn-action.warning {
  background: #f59e0b;
}

.mi-confirm-btn-action.warning:hover {
  background: #d97706;
}

.promo-modal-wrapper {
  max-width: 540px;
  background: transparent;
  border: none;
  box-shadow: none;
}

.promo-modal-content img {
  display: block;
  width: 100%;
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-xl, 0 20px 50px rgba(0, 0, 0, 0.8));
}


/* ==========================================================================
   10. BOTÕES E COMPONENTES DE AÇÃO PADRÃO
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2, 8px);

  padding: var(--space-3, 10px) var(--space-5, 20px);

  border-radius: var(--radius-md, 8px);
  font-family: inherit;
  font-size: var(--font-size-sm, 0.875rem);
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  white-space: nowrap;

  cursor: pointer;
  transition:
    background-color var(--transition-fast, 0.15s ease),
    border-color var(--transition-fast, 0.15s ease),
    color var(--transition-fast, 0.15s ease),
    box-shadow var(--transition-fast, 0.15s ease),
    transform var(--transition-fast, 0.15s ease);
}

.btn-primary,
.confirm-btn,
.action-btn-primary {
  background: var(--primary, #e53935);
  border: 1px solid var(--primary, #e53935);
  color: #ffffff;
}

.btn-primary:hover,
.confirm-btn:hover,
.action-btn-primary:hover {
  background: #d32f2f;
  border-color: #d32f2f;
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.35);
  transform: translateY(-1px);
}

.btn-secondary,
.action-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
  color: var(--text-main, #f0f2f5);
}

.btn-secondary:hover,
.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-danger-outline,
.delete-btn {
  background: transparent;
  border: 1px solid rgba(229, 57, 53, 0.4);
  color: #ff6b6b;
}

.btn-danger-outline:hover,
.delete-btn:hover {
  background: rgba(229, 57, 53, 0.12);
  border-color: var(--primary, #e53935);
  color: #ffffff;
}

/* Botão Específico da Agenda (Adicionar Outro Móvel) */
.btn-add-gray,
.btn-add-furniture {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 11px 16px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px dashed rgba(255, 255, 255, 0.22) !important;
  border-radius: var(--radius-md, 8px) !important;
  color: var(--text-main, #f0f2f5) !important;
  font-family: inherit !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.btn-add-gray:hover,
.btn-add-furniture:hover {
  background: rgba(229, 57, 53, 0.1) !important;
  border-color: var(--primary, #e53935) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 10px rgba(229, 57, 53, 0.2) !important;
  transform: translateY(-1px) !important;
}

.w-full {
  width: 100% !important;
}


/* ==========================================================================
   11. RESPONSIVIDADE E MOBILE BOTTOM-SHEET
   ========================================================================== */

@media (max-width: 900px) {
  .showroom-modal .modal-split-layout,
  .showroom-split-layout,
  .modal-split-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5, 20px);
    padding: var(--space-4, 16px);
  }

  .gallery-viewport-card {
    min-height: 340px;
    aspect-ratio: 16 / 10;
  }

  .ranking-details-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .modal,
  .showroom-modal {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content,
  .modal-container,
  .showroom-modal .modal-content {
    max-width: 100% !important;
    height: auto !important;
    max-height: 90vh !important;
    max-height: 90dvh !important;

    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    border-bottom: none;
    border-left: none;

    transform: translateY(100%);
    animation: mobileSheetEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  @keyframes mobileSheetEnter {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }

  .modal-content::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 2px;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 20;
  }

  .modal-header,
  .modal-footer {
    padding: var(--space-3, 12px) var(--space-4, 16px);
  }

  .modal-body {
    padding: var(--space-4, 16px);
  }

  .form-row,
  .form-row-wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .stock-showcase {
    grid-template-columns: minmax(0, 1fr);
  }

  .specs-grid,
  .showroom-specs-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gallery-viewport-card {
    min-height: 260px;
    aspect-ratio: 1 / 1;
  }
}
