/* Variáveis de design inspirado no AutoCAD */
:root {
  /* Cores principais */
  --autocad-blue: #0078d7;
  --autocad-dark-blue: #005a9e;
  --autocad-light-blue: #00b0ff;
  --autocad-highlight: #2196f3;
  --autocad-accent: #1e88e5;

  /* Cores de fundo */
  --autocad-bg: #252526;
  --autocad-panel: #333333;
  --autocad-panel-header: #2d2d2d;
  --autocad-panel-hover: #3f3f3f;

  /* Cores de texto */
  --autocad-text: #f1f1f1;
  --autocad-text-muted: #aaa; /* Um pouco mais claro */
  --autocad-text-dim: #888;  /* Um pouco mais claro */

  /* Cores de grade e linhas */
  --autocad-grid: #404040;
  --autocad-grid-minor: #383838;
  --autocad-line: #888;

  /* Estados */
  --autocad-success: #4caf50;
  --autocad-warning: #ff9800;
  --autocad-error: #f44336;

  /* Dimensões */
  --header-height: 50px;
  --footer-height: 26px; /* Um pouco menor */
  --panel-header-height: 36px; /* Um pouco menor */
  --side-panel-width: 300px; /* Um pouco menor */
}

/* Reset e estilos base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Base font size */
}

body {
  font-family: 'Roboto', 'Segoe UI', Arial, sans-serif;
  background-color: var(--autocad-bg);
  color: var(--autocad-text);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  overflow: hidden; /* Previne scroll do body por padrão */
  height: 100vh;
  -webkit-tap-highlight-color: transparent; /* Remove highlight azul ao tocar em mobile */
}

/* Estrutura principal do aplicativo */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Cabeçalho */
.app-header {
  background-color: var(--autocad-panel);
  height: var(--header-height);
  border-bottom: 2px solid var(--autocad-blue);
  display: flex;
  align-items: center;
  padding: 0 0.8rem; /* Padding reduzido */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  z-index: 100;
  flex-shrink: 0; /* Não encolher */
}

.logo {
  width: 30px; /* Reduzido */
  height: 30px; /* Reduzido */
  background-color: var(--autocad-blue);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px; /* Reduzido */
  margin-right: 8px; /* Reduzido */
  transition: all 0.2s ease;
}

.logo:hover {
  background-color: var(--autocad-light-blue);
  transform: scale(1.05);
}

.app-title {
  font-size: 1.1rem; /* Reduzido */
  font-weight: 500;
  color: var(--autocad-blue);
  margin-right: 16px; /* Reduzido */
  letter-spacing: 0.5px;
  white-space: nowrap; /* Evita quebra de linha */
}

.ribbon {
  display: flex;
  margin-left: auto;
}

.ribbon-item {
  padding: 0 10px; /* Reduzido */
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 6px; /* Reduzido */
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
  color: var(--autocad-text-muted);
}

.ribbon-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--autocad-text);
}

.ribbon-item.active {
  border-bottom: 3px solid var(--autocad-blue);
  color: var(--autocad-light-blue);
  background-color: rgba(0, 120, 215, 0.1);
}

.ribbon-item i {
  font-size: 16px; /* Mantido */
}

/* Container principal - permite scroll interno */
.container {
  flex: 1;
  overflow-y: auto; /* Permite scroll vertical se necessário */
  overflow-x: hidden; /* Evita scroll horizontal */
  display: flex;
  flex-direction: column;
}

/* Área de trabalho (workspace) */
.workspace {
  display: flex;
  flex: 1; /* Ocupa espaço disponível */
  overflow: hidden; /* Conteúdo interno controla scroll */
  min-height: 0; /* Necessário para flexbox em alguns casos */
}

/* Painel lateral (desktop) */
.side-panel {
  width: var(--side-panel-width);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto; /* Scroll se conteúdo for maior */
  background-color: var(--autocad-bg);
  border-right: 1px solid var(--autocad-grid);
  flex-shrink: 0; /* Não encolher */
}

/* Painel principal (desktop) */
.main-panel {
  flex: 1; /* Ocupa espaço restante */
  padding: 8px;
  overflow: hidden; /* Conteúdo interno controla scroll */
  display: flex; /* Para o painel de visualização preencher */
  flex-direction: column;
}

/* Painel de visualização dentro do main-panel */
.visualization-panel {
    flex: 1; /* Ocupa espaço disponível no main-panel */
    display: flex;
    flex-direction: column;
}

.visualization-panel .panel-content {
    flex: 1; /* Faz o conteúdo (com o SVG) crescer */
    padding: 0; /* Remover padding padrão para SVG ocupar tudo */
    display: flex; /* Para o container SVG preencher */
    position: relative; /* Para a status bar */
}


/* Estilos de painéis genéricos */
.panel {
  background-color: var(--autocad-panel);
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); /* Sombra mais sutil */
  overflow: hidden;
  margin-bottom: 8px;
  display: flex; /* Usar flex para controlar header e content */
  flex-direction: column;
}

.panel-header {
  background-color: var(--autocad-panel-header);
  padding: 0 0.8rem; /* Padding reduzido */
  height: var(--panel-header-height);
  font-weight: 500;
  font-size: 0.9rem; /* Tamanho da fonte do header */
  display: flex;
  align-items: center;
  border-bottom: 1px solid #444;
  position: relative;
  flex-shrink: 0; /* Não encolher */
}

.panel-header-icon {
  margin-right: 0.5rem;
  font-size: 0.9rem; /* Ícone do header */
  color: var(--autocad-blue);
}

.panel-controls {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.panel-button {
  background: none;
  border: none;
  color: var(--autocad-text-muted);
  width: 28px; /* Aumentado para toque */
  height: 28px; /* Aumentado para toque */
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.panel-button:hover, .panel-button:active { /* :active para feedback no toque */
  background-color: var(--autocad-panel-hover);
  color: var(--autocad-text);
}

.panel-content {
  padding: 1rem; /* Padding interno */
  overflow-y: auto; /* Scroll interno se necessário */
  flex: 1; /* Ocupa espaço restante no painel */
  min-height: 0; /* Necessário para flexbox */
}

/* Estilos para campos de entrada */
.inputs {
  display: flex;
  flex-direction: column;
  gap: 0.8rem; /* Espaçamento reduzido */
}

.field label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  color: #ccc;
  font-size: 0.85rem; /* Tamanho da label */
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.field input, .field select {
  width: 100%;
  padding: 0.6rem 0.8rem; /* Padding ajustado */
  font-size: 0.95rem; /* Tamanho da fonte do input */
  background-color: #1e1e1e;
  border: 1px solid #444;
  color: var(--autocad-text);
  border-radius: 3px;
  transition: all 0.25s ease;
  height: 38px; /* Altura fixa para consistência */
}
.field select {
  padding-right: 25px; /* Espaço para a seta do select */
}

.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--autocad-blue);
  box-shadow: 0 0 0 2px rgba(0, 120, 215, 0.3);
}

.field input:hover, .field select:hover {
  border-color: #666;
}

.field input::placeholder {
  color: #666;
}

.input-addon {
  position: absolute;
  right: 10px;
  color: var(--autocad-text-muted);
  font-size: 0.8rem; /* Tamanho do addon */
  pointer-events: none;
}
.field select + .input-addon { /* Esconde addon se for select */
    display: none;
}

/* Checkbox estilizado */
.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px; /* Altura mínima para toque */
}

.checkbox-field input[type="checkbox"] {
  width: 18px; /* Tamanho checkbox */
  height: 18px;
  margin-right: 8px;
  cursor: pointer;
  accent-color: var(--autocad-blue);
  flex-shrink: 0;
}

.checkbox-field label {
  margin-bottom: 0;
  cursor: pointer;
  font-size: 0.9rem; /* Tamanho label checkbox */
}

/* Área de predefinições */
.presets {
  margin-top: 1rem; /* Espaçamento reduzido */
  border-top: 1px solid #444;
  padding-top: 0.8rem; /* Espaçamento reduzido */
}

.preset-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.6rem; /* Espaçamento reduzido */
  color: var(--autocad-text-muted);
  font-size: 0.85rem;
}
.preset-header i {
    font-size: 0.9em;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px; /* Espaçamento reduzido */
}

.preset-button {
  background-color: var(--autocad-panel-hover);
  border: 1px solid #555;
  border-radius: 3px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.25s ease;
  color: var(--autocad-text);
  min-height: 50px; /* Altura mínima */
  justify-content: center;
}

.preset-button:hover, .preset-button:active {
  background-color: var(--autocad-dark-blue);
  border-color: var(--autocad-blue);
}

.preset-button span {
  font-weight: 500;
  font-size: 0.85rem;
}

.preset-button small {
  color: var(--autocad-text-muted);
  font-size: 0.75rem; /* Reduzido */
  margin-top: 2px; /* Reduzido */
}

/* Botões */
.buttons {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem; /* Reduzido */
}

.btn {
  padding: 0.6rem 1rem; /* Padding ajustado */
  background-color: var(--autocad-panel-hover);
  color: white;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9rem; /* Reduzido */
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center; /* Centraliza conteúdo */
  gap: 6px; /* Reduzido */
  height: 38px; /* Altura fixa */
  flex: 1; /* Ocupa espaço igualitário */
}

.btn:hover, .btn:active {
  background-color: #4a4a4a;
  border-color: #666;
}

.btn-primary {
  background-color: var(--autocad-dark-blue);
  border-color: var(--autocad-blue);
}

.btn-primary:hover, .btn-primary:active {
  background-color: var(--autocad-blue);
  border-color: var(--autocad-light-blue);
}

.btn-small {
  padding: 5px 10px; /* Reduzido */
  font-size: 0.8rem; /* Reduzido */
  background-color: var(--autocad-panel-hover);
  border: 1px solid #555;
  border-radius: 3px;
  color: var(--autocad-text);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 5px; /* Reduzido */
  height: 30px; /* Altura fixa */
}

.btn-small:hover, .btn-small:active {
  background-color: var(--autocad-dark-blue);
}

/* Estilos para resultados */
.results {
  text-align: center;
}
.results-panel .panel-content {
    padding: 0.8rem; /* Padding menor no painel de resultados */
}

.result-group {
  margin-bottom: 0.8rem; /* Reduzido */
}

.result-label {
  font-size: 0.8rem; /* Reduzido */
  color: var(--autocad-text-muted);
  margin-bottom: 0.1rem; /* Reduzido */
}

.result-value {
  font-size: 2rem; /* Reduzido */
  font-weight: 300;
  color: var(--autocad-light-blue);
  transition: all 0.3s ease;
  line-height: 1.1;
}

.result-value.changed {
  color: var(--autocad-highlight);
  text-shadow: 0 0 10px rgba(33, 150, 243, 0.4);
}

.result-secondary {
  font-size: 1rem; /* Reduzido */
  color: var(--autocad-text);
}

/* Estilos para visualização */
.visualization-container {
  flex: 1; /* Ocupa todo o espaço do panel-content */
  overflow: hidden; /* Importante para conter o SVG */
  position: relative;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 3px; /* Adiciona borda arredondada */
}

.visualization {
  width: 100%;
  height: 100%;
  position: relative;
  background-image: radial-gradient(var(--autocad-grid-minor) 1px, transparent 0);
  background-size: 20px 20px;
  overflow: hidden; /* Garante que SVG não transborde */
  cursor: default; /* Cursor padrão */
}

/* Estilos SVG */
#triangleSvg {
  width: 100%;
  height: 100%;
  display: block; /* Remove espaço extra embaixo */
  transition: transform 0.1s ease-out; /* Transição mais rápida para pan/zoom */
  touch-action: none; /* Previne ações padrão do browser no toque (scroll, zoom) */
}

/* Elementos do triângulo */
#riseLine, #runLine {
  stroke: var(--autocad-light-blue);
  stroke-width: 1.5; /* Linha mais fina */
  stroke-linecap: round;
  transition: all 0.2s ease; /* Animação mais rápida */
}

#hypLine {
  stroke: var(--autocad-highlight);
  stroke-width: 2; /* Linha mais fina */
  stroke-linecap: round;
  transition: all 0.2s ease;
}

.angleArc {
  fill: none;
  stroke: var(--autocad-accent);
  stroke-width: 1.5; /* Linha mais fina */
  transition: all 0.2s ease;
}

/* Linhas de dimensão */
.dimension-line {
  stroke: var(--autocad-light-blue);
  stroke-width: 0.8; /* Mais fino */
  stroke-dasharray: 4,2; /* Traço menor */
  transition: all 0.2s ease;
}

.extension-line {
  stroke: var(--autocad-text-muted);
  stroke-width: 0.8; /* Mais fino */
}

.dimension-text {
  fill: var(--autocad-text);
  font-size: 10px; /* Menor */
  text-anchor: middle;
  transition: all 0.2s ease;
}

.angle-text {
  fill: var(--autocad-light-blue);
  font-weight: 500;
  font-size: 11px; /* Um pouco maior que dimensão */
}

/* Coordenadas (pode ser escondido em mobile) */
.coords-text {
  fill: var(--autocad-text-dim);
  font-size: 9px; /* Menor */
  font-family: monospace;
}

/* Recomendação */
.recommendation-box {
  margin: 0.8rem 0; /* Reduzido */
  padding: 0.6rem; /* Reduzido */
  background-color: rgba(0, 0, 0, 0.2);
  border-left: 3px solid var(--autocad-blue);
  border-radius: 2px;
  display: flex;
  align-items: flex-start;
  gap: 8px; /* Reduzido */
  text-align: left;
}

.recommendation-icon {
  color: var(--autocad-blue);
  font-size: 1rem; /* Reduzido */
  margin-top: 1px;
  flex-shrink: 0;
}

.recommendation-text {
  font-size: 0.8rem; /* Reduzido */
  color: var(--autocad-text-muted);
  line-height: 1.4; /* Melhor legibilidade */
}

/* Conversões */
.conversions {
  margin-top: 0.8rem; /* Reduzido */
  padding: 0.6rem; /* Reduzido */
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  font-size: 0.75rem; /* Reduzido */
  color: var(--autocad-text-muted);
  text-align: left;
  line-height: 1.4;
}

.export-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 0.8rem; /* Reduzido */
}

/* Barra de status dentro da visualização */
.status-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 22px; /* Menor */
  background-color: rgba(45, 45, 45, 0.85); /* Fundo semi-transparente */
  border-top: 1px solid #444;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 10px; /* Menor */
  color: var(--autocad-text-dim);
  z-index: 10; /* Acima do SVG */
}

.status-item {
  margin-right: 15px; /* Reduzido */
  display: flex;
  align-items: center;
  gap: 4px; /* Reduzido */
  white-space: nowrap;
}
.status-item i {
    font-size: 1em; /* Ícone relativo ao texto */
}

#calculation-status.updated {
  color: var(--autocad-success);
}

#calculation-status.calculating {
  color: var(--autocad-warning);
}

/* Painéis de abas */
.tab-panels {
  display: none; /* Mostrado apenas quando uma aba é selecionada */
  padding: 8px;
  overflow: auto;
  flex: 1;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Tabela de dados */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem; /* Reduzido */
  font-size: 0.85rem; /* Menor */
}

.data-table th, .data-table td {
  padding: 0.5rem; /* Reduzido */
  border: 1px solid #444;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background-color: var(--autocad-panel-header);
  color: var(--autocad-text);
  font-weight: 500;
}

.data-table tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.1); /* Mais sutil */
}

.data-table tr:hover {
  background-color: rgba(0, 120, 215, 0.1);
}

/* Caixa de informações */
.info-box {
  padding: 0.8rem; /* Reduzido */
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  margin-top: 1rem;
}

.info-title {
  font-weight: 500;
  margin-bottom: 0.4rem; /* Reduzido */
  color: var(--autocad-light-blue);
  display: flex;
  align-items: center;
  gap: 6px; /* Reduzido */
  font-size: 0.9rem; /* Reduzido */
}
.info-title i { font-size: 1em; }

.info-content {
  font-size: 0.85rem; /* Reduzido */
  color: var(--autocad-text-muted);
}

/* Seção de informações */
.info-section {
  max-width: 800px;
  margin: 0 auto;
  font-size: 0.9rem; /* Base para esta seção */
}

.info-section h3 {
  color: var(--autocad-light-blue);
  margin-bottom: 0.6rem; /* Reduzido */
  margin-top: 1.2rem; /* Reduzido */
  font-weight: 500;
  font-size: 1.1em;
}

.info-section p, .info-section ul, .info-section ol {
  margin-bottom: 0.8rem; /* Reduzido */
  color: var(--autocad-text-muted);
  line-height: 1.4;
}

.info-section ul, .info-section ol {
  margin-left: 1.2rem; /* Reduzido */
}

.info-section li {
  margin-bottom: 0.4rem; /* Reduzido */
}

/* Rodapé */
.footer {
  height: var(--footer-height);
  background-color: var(--autocad-panel);
  border-top: 1px solid var(--autocad-grid);
  display: flex;
  align-items: center;
  justify-content: space-between; /* Distribui melhor */
  padding: 0 0.8rem; /* Reduzido */
  font-size: 0.75rem; /* Reduzido */
  color: var(--autocad-text-dim);
  flex-shrink: 0; /* Não encolher */
}

.footer-left, .footer-center, .footer-right {
  white-space: nowrap;
}
.footer-center {
    text-align: center;
}

/* Modal dialog */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem; /* Adiciona padding para não colar nas bordas */
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--autocad-panel);
  border-radius: 4px;
  width: 90%; /* Usa percentual */
  max-width: 350px; /* Limita largura máxima */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* Sombra ajustada */
  animation: modalIn 0.2s ease-out;
}

/* Modal para tutorial - mais largo */
.tutorial-modal {
  max-width: 500px;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 0.8rem 1rem; /* Padding ajustado */
  border-bottom: 1px solid #444;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  color: var(--autocad-light-blue);
  font-weight: 500;
  font-size: 1.1rem; /* Ajustado */
}

.close-btn {
  background: none;
  border: none;
  color: var(--autocad-text-muted);
  font-size: 1.8rem; /* Aumentado para toque */
  cursor: pointer;
  padding: 0 5px; /* Área de toque */
  line-height: 1;
}
.close-btn:hover, .close-btn:active {
    color: var(--autocad-text);
}

.modal-body {
  padding: 1rem 1.2rem; /* Padding ajustado */
  font-size: 0.9rem; /* Ajustado */
}

.modal-footer {
  padding: 0.8rem 1rem; /* Padding ajustado */
  border-top: 1px solid #444;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal-footer .btn { /* Garante que botão no modal tenha tamanho bom */
    flex: none; /* Não estica */
    padding: 0.6rem 1.2rem;
}

/* Tooltip (Escondido em mobile) */
.tooltip {
  position: fixed;
  background-color: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 5px 8px; /* Reduzido */
  border-radius: 3px;
  font-size: 0.75rem; /* Reduzido */
  pointer-events: none;
  z-index: 2000; /* Acima de tudo */
  display: none; /* Começa escondido */
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  max-width: 200px;
}

/* Animações gerais */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Classes utilitárias de animação */
.pulse { animation: pulse 0.5s ease; }
.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideIn 0.3s ease; }

/* NOVOS ESTILOS */

/* Dropdown para o menu de exportação */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 5px;
  background-color: var(--autocad-panel);
  min-width: 120px;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 50;
  border: 1px solid #444;
  overflow: hidden;
}

.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
  display: block;
  animation: fadeIn 0.2s ease;
}

.dropdown-content a {
  color: var(--autocad-text);
  padding: 10px 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.dropdown-content a:hover {
  background-color: var(--autocad-dark-blue);
}

/* Estilos para a visualização 2D */
.stair-2d-rect {
  fill: rgba(0, 120, 215, 0.15);
  stroke: var(--autocad-light-blue);
  stroke-width: 1.5;
  transition: all 0.2s ease;
}

.stair-2d-text {
  fill: var(--autocad-text);
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: middle;
}

/* Botão de tutorial flutuante */
.tutorial-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--autocad-blue);
  color: white;
  border: none;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: all 0.3s ease;
}

.tutorial-btn:hover {
  background-color: var(--autocad-light-blue);
  transform: scale(1.05);
}

/* Estilos para o tutorial */
.tutorial-step {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tutorial-step img {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid #444;
}

.tutorial-title {
  font-size: 1.1rem;
  color: var(--autocad-light-blue);
  margin-bottom: 5px;
}

.tutorial-description {
  color: var(--autocad-text);
  line-height: 1.5;
}

.tutorial-highlight {
  background-color: rgba(0, 120, 215, 0.3);
  border: 2px solid var(--autocad-light-blue);
  border-radius: 4px;
  pointer-events: none;
  z-index: 999;
  position: absolute;
  transition: all 0.3s ease;
}

.tutorial-progress {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 15px;
}

.tutorial-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--autocad-text-dim);
}

.tutorial-dot.active {
  background-color: var(--autocad-light-blue);
  transform: scale(1.2);
}

/* --- MEDIA QUERIES PARA RESPONSIVIDADE --- */

/* Tablets e Telas Menores (ex: <= 992px) */
@media (max-width: 992px) {
  .workspace {
    flex-direction: column; /* Empilha os painéis */
    overflow-y: auto; /* Permite scroll no workspace se o conteúdo total for grande */
     overflow-x: hidden;
  }

  .side-panel {
    width: 100%; /* Ocupa largura total */
    max-height: none; /* Altura automática */
    flex-direction: row; /* Painéis internos lado a lado */
    flex-wrap: wrap; /* Quebra linha se não couber */
    border-right: none;
    border-bottom: 1px solid var(--autocad-grid);
    padding: 6px; /* Padding menor */
    gap: 6px;
    overflow-y: visible; /* Remove scroll interno */
  }

  .side-panel .panel {
     flex: 1 1 300px; /* Permite crescer, base 300px, permite encolher */
     margin-bottom: 0; /* Remove margem entre painéis na mesma linha */
  }

  .main-panel {
     padding: 6px; /* Padding menor */
     flex: 1; /* Ocupa espaço restante */
     min-height: 350px; /* Garante altura mínima para visualização */
  }

   .visualization-container {
       min-height: 300px; /* Altura mínima do SVG container */
   }
   
   .tutorial-btn {
     bottom: 10px;
     right: 10px;
     width: 40px;
     height: 40px;
     font-size: 18px;
   }
}

/* Celulares (ex: <= 767px) */
@media (max-width: 767px) {
  html {
    font-size: 15px; /* Levemente menor para caber mais */
  }

  body {
     overflow: auto; /* Permite scroll no body se TUDO for maior que a tela */
  }
  .container {
     overflow-y: visible; /* Desativa scroll do container, deixa pro body */
  }
  .workspace {
     overflow-y: visible; /* Desativa scroll do workspace */
     height: auto; /* Altura baseada no conteúdo */
  }

  .app-title {
    font-size: 1rem; /* Menor ainda */
    margin-right: 8px;
  }

  .ribbon span {
    display: none; /* Esconde texto da ribbon */
  }
  .ribbon-item {
    padding: 0 12px; /* Espaçamento para ícones */
  }
  .ribbon-item i {
    font-size: 18px; /* Ícones um pouco maiores */
  }

  .side-panel {
    flex-direction: column; /* Força painéis internos a empilhar */
    padding: 4px;
    gap: 4px;
  }
  .side-panel .panel {
     flex-basis: auto; /* Reseta a base flex */
     width: 100%; /* Ocupa largura total */
  }

  .panel-content {
      padding: 0.8rem; /* Padding menor nos conteúdos */
  }

  /* Ajustes finos para inputs e botões */
  .field input, .field select {
      padding: 0.7rem 0.9rem;
      font-size: 1rem; /* Garante fonte legível */
      height: 42px; /* Altura um pouco maior para toque */
  }
  .btn {
      padding: 0.7rem 1rem;
      font-size: 0.95rem;
      height: 42px; /* Altura um pouco maior para toque */
  }
   .btn-small {
      height: 34px; /* Altura um pouco maior */
      padding: 0 12px;
      font-size: 0.85rem;
   }
   .preset-button {
       min-height: 55px; /* Aumenta um pouco */
   }
   .panel-button {
       width: 32px; /* Maior */
       height: 32px; /* Maior */
   }

  .result-value { font-size: 1.8rem; }
  .result-secondary { font-size: 0.9rem; }

  .main-panel {
     padding: 4px;
     min-height: 50vh; /* Pelo menos metade da tela para visualização */
  }

  .tooltip {
    display: none !important; /* Garante que tooltip não apareça */
  }

  .coords-text {
      display: none; /* Esconde coordenadas no mobile */
  }

  .status-bar {
      height: 20px;
      padding: 0 6px;
      font-size: 9px;
  }
  .status-item {
      margin-right: 10px;
  }
  /* Esconde itens menos essenciais da status bar se necessário */
  #units-display { display: none; } /* Exemplo */

  .footer {
      padding: 0 6px;
      font-size: 0.7rem;
  }
}