/**
 * Estilos do Editor de Croqui de Sinistros de Trânsito
 * Design profissional, limpo e intuitivo
 */

:root {
  --cq-bg: #0f172a;
  --cq-bg-surface: #1e293b;
  --cq-border: #334155;
  --cq-primary: #2563eb;
  --cq-primary-hover: #1d4ed8;
  --cq-accent: #f59e0b;
  --cq-danger: #ef4444;
  --cq-success: #10b981;
  --cq-text: #f8fafc;
  --cq-text-muted: #94a3b8;
  --cq-canvas-bg: #f1f5f9;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: #0b1120;
  color: var(--cq-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  user-select: none;
}

/* =========================================================
   NAVBAR SUPERIOR
   ========================================================= */
.cq-navbar {
  height: 56px;
  min-height: 56px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 1px solid var(--cq-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
}

.cq-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  text-decoration: none;
}

.cq-brand .badge-icon {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.cq-brand small {
  display: block;
  font-size: 10px;
  color: var(--cq-text-muted);
  font-weight: 500;
}

.cq-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================================================
   ÁREA PRINCIPAL (SIDEBAR + WORKSPACE)
   ========================================================= */
.cq-main {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* SIDEBAR DE FERRAMENTAS */
.cq-sidebar {
  width: 380px;
  min-width: 380px;
  max-width: 380px;
  background-color: #1e293b;
  border-right: 1px solid var(--cq-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.cq-sidebar-tabs {
  background-color: #0f172a;
  border-bottom: 1px solid var(--cq-border);
  padding: 6px 8px 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.cq-sidebar-tabs .nav-link {
  color: var(--cq-text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border: none;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cq-sidebar-tabs .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.cq-sidebar-tabs .nav-link.active {
  color: #fff;
  background-color: #1e293b;
  border-top: 2px solid var(--cq-primary);
}

.cq-sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* SEÇÕES DE FERRAMENTAS */
.cq-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cq-text-muted);
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cq-section-title:first-child {
  margin-top: 0;
}

/* BOTÕES DE FERRAMENTAS */
.cq-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.cq-tool-btn {
  background-color: #0f172a;
  color: #e2e8f0;
  border: 1px solid var(--cq-border);
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
  width: 100%;
}

.cq-tool-btn:hover {
  background-color: #27354a;
  border-color: #475569;
  color: #fff;
  transform: translateY(-1px);
}

.cq-tool-btn.active {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  border-color: #1d4ed8;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.cq-tool-btn .tool-ico {
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
}

/* GRID DE MINIATURAS (VEÍCULOS / SINAIS) */
.cq-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.cq-thumb-item {
  background-color: #0f172a;
  border: 1px solid var(--cq-border);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  height: 94px;
  position: relative;
}

.cq-thumb-item:hover {
  background-color: #243044;
  border-color: var(--cq-primary);
  transform: scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.cq-thumb-item .thumb-img-wrapper {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px;
}

.cq-thumb-item img, .cq-thumb-item svg {
  max-width: 100%;
  max-height: 52px;
  object-fit: contain;
  pointer-events: none;
}

.cq-thumb-item .thumb-caption {
  font-size: 10px;
  font-weight: 700;
  color: var(--cq-text-muted);
  text-align: center;
  margin-top: 3px;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   WORKSPACE / ÁREA DO CANVAS
   ========================================================= */
.cq-workspace {
  flex: 1;
  background: radial-gradient(circle at center, #1e293b 0%, #0b1120 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 16px;
}

/* BARRA DE CONTROLE DO CANVAS */
.cq-canvas-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 960px;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 4px 6px;
}

.cq-canvas-wrapper {
  position: relative;
  background-color: var(--cq-canvas-bg);
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 40px 40px;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: transform 0.1s ease;
}

/* FLOATING OBJECT TOOLBAR */
.cq-obj-toolbar {
  position: absolute;
  top: -48px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.95);
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 4px 6px;
  display: none;
  align-items: center;
  gap: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.cq-obj-toolbar.active {
  display: flex;
}

.cq-obj-btn {
  background: transparent;
  border: none;
  color: #e2e8f0;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
}

.cq-obj-btn:hover {
  background-color: #334155;
  color: #fff;
}

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

.cq-obj-sep {
  width: 1px;
  height: 20px;
  background-color: #334155;
  margin: 0 2px;
}

/* PALETA DE CORES */
.cq-color-swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.cq-swatch {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid #334155;
  cursor: pointer;
  transition: transform 0.1s;
}

.cq-swatch:hover {
  transform: scale(1.15);
  border-color: #fff;
}

/* STATUS E DICAS NO RODAPÉ */
.cq-footer-status {
  height: 28px;
  min-height: 28px;
  background-color: #0b1120;
  border-top: 1px solid var(--cq-border);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--cq-text-muted);
  z-index: 100;
}

/* MODAIS */
.modal-content {
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
  border-bottom: 1px solid #334155;
}

.modal-footer {
  border-top: 1px solid #334155;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 3px;
}

.form-control, .form-select {
  background-color: #0f172a;
  border: 1px solid #334155;
  color: #fff;
  border-radius: 8px;
  font-size: 13px;
}

.form-control:focus, .form-select:focus {
  background-color: #0f172a;
  color: #fff;
  border-color: var(--cq-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

/* CARD DE TEMPLATE / MODELO */
.cq-template-card {
  background-color: #0f172a;
  border: 1px solid var(--cq-border);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cq-template-card:hover {
  border-color: var(--cq-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.15);
}

.cq-template-card .tpl-ico {
  font-size: 28px;
  margin-bottom: 8px;
}

.cq-template-card h6 {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
}

.cq-template-card p {
  color: var(--cq-text-muted);
  font-size: 11px;
  margin: 0;
}

/* SLOTS DE LOGOTIPO NO MODAL DE LAUDO */
.cq-logo-slot {
  background-color: #0f172a;
  border: 2px dashed #334155;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cq-logo-slot img {
  max-width: 100%;
  max-height: 80px;
  object-fit: contain;
}

/* CARDS DE ESCOLHA NO MODAL DE EXPORTAÇÃO PDF */
.cq-choice-card {
  display: block;
  position: relative;
  background-color: #0f172a;
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.cq-choice-card:hover {
  border-color: #475569;
  transform: translateY(-2px);
}

.cq-choice-card input[type="radio"] {
  position: absolute;
  top: 12px;
  right: 12px;
}

.cq-choice-card.active,
.cq-choice-card:has(input[type="radio"]:checked) {
  border-color: var(--cq-primary);
  background: linear-gradient(145deg, #1e293b, #0f172a);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.25);
}

.cq-choice-card .choice-icon {
  font-size: 26px;
  margin-bottom: 6px;
  display: inline-block;
}

.cq-choice-card .choice-title {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 3px;
}

.cq-choice-card .choice-desc {
  color: var(--cq-text-muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
}

.cq-choice-card .choice-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  background-color: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border-radius: 4px;
  padding: 2px 6px;
  margin-top: 6px;
}

/* PAINEL DE PRÉ-VISUALIZAÇÃO DE METADADOS */
.cq-meta-preview-box {
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 12px 14px;
}

.cq-meta-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #1e293b;
  font-size: 12px;
}

.cq-meta-preview-row:last-child {
  border-bottom: none;
}

.cq-meta-preview-label {
  color: #94a3b8;
  font-size: 11px;
}

.cq-meta-preview-val {
  color: #e2e8f0;
  font-weight: 600;
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

