@media (max-width: 992px) {
    .planner-grid,
    .assessment-grid {
      grid-template-columns: 1fr;
    }
    .scroll-btn {
        display: none !important;
    }
    .workout-grid {
        grid-template-columns: 1fr;
    }
    .divisions-panel, .exercises-panel {
        height: auto;
        max-height: 60vh;
    }
    .planner-header {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
  .modal-body {
    padding: 1rem;
  }


  #calculator-results-modal .modal-content {
      height: 90vh;
      max-height: 90vh;
  }

  /* Empilha o grid de TMB e GET em telas pequenas */
  .results-grid {
      grid-template-columns: 1fr;
  }
  /* FIM DA MODIFICAÇÃO */

  .modal-footer {
    display: flex;
    justify-content: flex-end;
  }

  .food-search {
    flex-direction: column;
  }
  .food-search .btn {
    width: 100%;
  }
  .calculator-grid,
  .form-row,
  #assessment-fields-container {
    grid-template-columns: 1fr;
  }
  .food-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .food-info h5 {
    margin-bottom: 0.1rem;
  }
  .food-quantity {
    width: 100%;
  }
  .food-quantity .quantity-input {
    flex-grow: 1;
    max-width: 120px;
    margin: 0;
  }
  .planner-header {
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
  }
  .meal-header {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }
  .meal-actions {
    align-self: center;
  }
  .logo h1 {
    font-size: 1.2rem;
  }
  .navigation {
    display: none;
  }
  .mobile-menu-toggle {
    display: block;
  }
  .mobile-nav {
    display: block;
  }
  .nav-tabs {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  .nav-tab {
    flex-shrink: 0;
  }
  .btn {
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
  }
  .btn-small {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    gap: 0.4rem;
  }
  .btn-add-exercise-mobile {
    display: flex;
  }
  .exercise-list-item {
    cursor: default;
  }
  .meal-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .meal-info h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
  }
  .meal-info h4 span {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
  }
  .meal-nutrition {
    display: flex;
    gap: 0.5rem;
  }
  #inicio {
    padding: 3rem 0;
  }
  .hero-title {
    font-size: 2.5rem;
  }
  .hero-subtitle {
    font-size: 1.1rem;
  }
  .planner-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
    padding: 1rem;
  }
  .diet-selector {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
  }
  .diet-selector .custom-select-wrapper {
    min-width: unset;
    width: 100%;
  }
  .diet-selector .btn {
    width: 100%;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    box-sizing: border-box;
  }
  .diet-selector .select-selected {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .diet-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
  }
  .diet-actions .btn {
    width: 100%;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .exercises-panel .panel-header,
  .divisions-panel .panel-header {
    display: block;
    text-align: center;
  }
  .panel-header h3 {
    margin-bottom: 1rem;
  }
  .panel-header #add-exercise-btn {
    width: 40%;
    height: 2rem;
  }
  .calculator-results,
  .assessment-results {
    display: none;
  }
  .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
  }


  .header-content .user-profile {
  display: none;
}

.mobile-nav .user-profile {
  display: block;
  width: 90%;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  position: relative; /* Posição base para o dropdown */
}

/* 3. Estiliza o botão para se parecer com um item de menu */
.mobile-nav .user-profile-icon {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem; /* Mesmo tamanho dos outros links */
  font-weight: 500;
  padding: 0;
  width: 100%;
  justify-content: center; /* Centraliza o ícone e texto */
  position: relative; /* Posição base para a seta */
}

/* 4. NOVA: Seta (indicador de dropdown) */
.mobile-nav .user-profile-icon::after {
    content: '▼';
    font-size: 0.8rem;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    transition: transform 0.3s ease;
    color: var(--text-secondary);
}

/* 5. NOVA: Rotação da seta quando aberto */
.mobile-nav .user-profile-icon.dropdown-open::after {
    transform: translateY(-50%) rotate(180deg);
}

/* 6. MODIFICADO: Faz o dropdown ser colapsável */
.mobile-nav .user-dropdown {
  /* Escondido por padrão usando max-height para animação */
  display: block; 
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out, margin 0.4s ease-out;

  /* Estilo do container do dropdown */
  position: static; /* Fica dentro do fluxo normal */
  width: 100%;
  border: none;
  box-shadow: none;
  background: none;
  margin-top: 0; /* Começa com 0 */
  
  /* Estilo dos itens aninhados */
  background-color: var(--bg-primary); 
  border-radius: var(--border-radius-sm);
}

/* 7. NOVA: Classe 'active' para mostrar o dropdown */
.mobile-nav .user-dropdown.active {
    max-height: 500px; /* Altura máxima para mostrar */
    margin-top: 0.5rem; /* Adiciona espaço quando aberto */
    padding: 0.5rem 0; /* Padding interno quando aberto */
    border: 1px solid var(--border-color);
}

/* 8. Estiliza os itens do dropdown no mobile */
.mobile-nav .dropdown-item {
  text-align: center;
  font-size: 1rem;
  color: var(--text-secondary);
  padding: 0.75rem 1rem; /* Adiciona padding interno */
}

.mobile-nav .dropdown-item:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* 9. NOVA: Esconde o dropdown e a seta se o usuário NÃO estiver logado */
body:not(.logged-in) .mobile-nav .user-dropdown,
body:not(.logged-in) .mobile-nav .user-profile-icon::after {
    display: none;
}

}

@media (max-width: 600px) {
  .comparison-strips {
    grid-template-columns: 1fr;
  }
  .strip-nutrients {
    grid-template-columns: repeat(4, 1fr);
  }
  .nutrient-row {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
    align-items: center;
  }
  .nutrient-row .label {
    color: var(--text-secondary);
    font-weight: 500;
  }
  .nutrient-row .value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.6rem;
  }
  .substitution-content .food-nutrition {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .btn {
    width: 100%;
  }
  .btn-small {
    width: auto;
    flex-shrink: 0;
  }
  .modal-footer {
    flex-direction: column;
    gap: 0.5rem;
  }
  .food-search input {
    padding-right: 8rem;
    font-size: 1rem;
  }
  .btn-add-icon {
    right: 40px;
  }
  .btn-search-icon {
    right: 10px;
  }
  .current-food-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .current-food-actions {
    justify-content: space-between;
  }
}

@media (max-width: 360px) {
  .comparison-strips {
    grid-template-columns: 1fr;
  }
  .strip-nutrients {
    grid-template-columns: repeat(4, 1fr);
  }
  .meal-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .meal-nutrition {
    font-size: 0.8rem;
    display: flex;
    gap: 0.1rem;
  }
  .food-nutrition {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
  }
}

