/* Responsive layout refinements for mobile, tablet, and desktop. */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
}

.tree-node {
  justify-content: flex-start;
}

.node-content {
  flex: 0 1 auto;
}

.node-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.node-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
  background: #16a34a;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
}

.node-actions button:hover {
  background: #15803d;
}

.node-actions button.danger {
  background: #dc2626;
  color: #ffffff;
}

.node-actions button.danger:hover {
  background: #b91c1c;
}

@media (min-width: 1280px) {
  header {
    padding: 26px 40px;
  }

  .app-shell {
    max-width: 1440px;
    margin: 0 auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
  }

  .panel {
    padding: 22px;
  }
}

@media (min-width: 721px) and (max-width: 1279px) {
  header {
    padding: 22px 24px;
  }

  header h1 {
    font-size: 24px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .panel {
    padding: 18px;
  }

  .panel-header,
  .wizard-header {
    align-items: center;
  }

  .tree-container {
    max-height: none;
  }
}

@media (max-width: 720px) {
  header {
    padding: 16px;
  }

  .header-row {
    display: grid;
    gap: 12px;
  }

  header h1 {
    font-size: 22px;
    line-height: 1.2;
  }

  header p {
    font-size: 14px;
    line-height: 1.45;
  }

  .feedback-open-button {
    width: 100%;
    justify-self: stretch;
  }

  .app-shell {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .panel {
    border-radius: 16px;
    padding: 14px;
  }

  .panel-header,
  .wizard-header {
    display: grid;
    gap: 10px;
  }

  .tree-node {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  .panel-header button,
  .wizard-header button,
  .actions button,
  .modal-actions button,
  .feedback-actions button {
    width: 100%;
  }

  .node-actions {
    display: flex;
    justify-content: flex-start;
    width: auto;
  }

  .node-actions button {
    width: 22px;
    min-width: 22px;
    height: 22px;
    font-size: 15px;
  }

  .actions,
  .modal-actions,
  .feedback-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .tree-container,
  .output,
  .advice-output {
    max-height: none;
  }

  .output,
  .advice-output {
    min-height: 160px;
    font-size: 12px;
  }

  .main-category-node .node-name {
    font-size: 16px;
  }

  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  .modal {
    align-items: start;
    padding: 12px;
    overflow-y: auto;
  }

  .modal-card,
  .feedback-modal-card {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
  }
}

@media (max-width: 420px) {
  header h1 {
    font-size: 20px;
  }

  .app-shell {
    padding: 10px;
  }

  .panel {
    padding: 12px;
  }

  .guidance-card,
  .destination-wizard,
  .file-analysis-box,
  .auto-suggestion-box,
  .final-destination-box,
  .breadcrumb {
    padding: 10px;
  }
}
