/* --- Settings Modal Component (Nested) --- */
#settings-modal {
  .modal-content {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
    font-size: 19px;

    @media (max-width: 768px) {
      max-height: 100dvh;
      height: 100dvh;
    }
  }

  .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom));

    @media (max-width: 768px) {
      padding: 1.2rem;
      padding-bottom: calc(100px + env(safe-area-inset-bottom)) !important;
    }
  }

  /* --- New List-Group Layout --- */
  .settings-group {
    margin-bottom: 2rem;
  }

  .settings-group-title {
    color: var(--accent);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.1px;
    margin-bottom: 0.75rem;
    margin-left: 0.5rem;
    text-transform: none;
    opacity: 0.9;
  }

  .settings-list {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;

    .settings-group-hint {
      padding: 0 1rem 0.5rem;
      font-size: 0.8rem;
      opacity: 0.6;
      line-height: 1.3;
    }
  }

  .settings-item {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    transition: background 0.2s ease;
    text-decoration: none;
    color: inherit;
    width: 100%;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    font-family: inherit;
    font-size: 1rem;
    text-align: left;

    &:last-child {
      border-bottom: none;
    }

    &:active {
      background: rgba(255, 255, 255, 0.08);
    }

    .settings-item-label {
      font-weight: 600;
      color: #fff;
      font-size: 19px;
    }

    .settings-item-value {
      align-items: center;
      color: var(--text-secondary);
      display: flex;
      gap: 0.5rem;
      font-size: 0.95rem;

      svg {
        opacity: 0.4;
      }
    }
  }

  /* --- Toggle Switch --- */
  .settings-toggle {
    --width: 48px;
    --height: 28px;
    --radius: 14px;
    position: relative;
    width: var(--width);
    height: var(--height);
    cursor: pointer;

    input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: rgba(255, 255, 255, 0.1);
      transition: .4s;
      border-radius: var(--radius);

      &:before {
        position: absolute;
        content: "";
        height: 22px;
        width: 22px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
      }
    }

    input:checked+.slider {
      background-color: var(--accent);
    }

    input:checked+.slider:before {
      transform: translateX(20px);
    }
  }

  /* Sub-sections (for Edit Profile etc) */
  .settings-back-btn {
    align-items: center;
    background: transparent;
    border: none;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    font-weight: 600;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0;
    font-size: 19px;
  }

  .settings-section {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}