@use '../../../../shared/styles/panel-shared' as panel;

.dashboard-settings {
  display: flex;
  flex-direction: column;

  @media (max-width: 640px) {
    width: 100%;
    max-width: 100%;
  }
}

.panel-header {
  @include panel.panel-header;
}

.settings-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 2rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-top: none;

  .settings-info {
    .info-content {
      display: flex;
      gap: 0.75rem;
      padding: 0.75rem;
      background: var(--overlay-background);
      border-radius: 6px;
      border: 1px solid var(--p-primary-300);

      .info-icon {
        color: var(--primary-color);
        font-size: 1.125rem;
        flex-shrink: 0;
        margin-top: 0.125rem;
      }

      .info-text {
        flex: 1;

        p {
          margin: 0;
          line-height: 1.5;
          font-size: 0.875rem;
          color: var(--text-color-secondary);
        }
      }
    }
  }

  @media (max-width: 480px) {
    padding: 1rem;
    gap: 0.5rem;

    .settings-info {
      .info-content {
        flex-direction: column;
        gap: 0.5rem;
      }
    }
  }
}

.scrollers-container {
  padding: 1.5rem 2rem;
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-top: none;
  min-height: 200px;
  max-height: 450px;
  overflow-y: auto;

  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: var(--overlay-background);
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;

    &:hover {
      background: var(--primary-color);
    }
  }

  @media (max-width: 480px) {
    padding: 1rem;
    max-height: 400px;
  }
}

.scroller-item {
  border: var(--card-border);
  transition: all 0.2s;
  border-color: var(--p-content-border-color);
  background: var(--p-content-background);
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 0.375rem;

  @media (max-width: 768px) {
    padding: 0.75rem !important;
  }
}

.scroller-content {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;

  @media (max-width: 768px) {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
}

.scroller-controls-left {
  display: flex;
  align-items: center;
  padding-bottom: 0.65rem;

  @media (max-width: 768px) {
    padding-bottom: 0;
    align-self: flex-start;
  }
}

.scroller-controls-right {
  display: flex;
  gap: 0.5rem;
  padding-bottom: 0.25rem;

  @media (max-width: 768px) {
    padding-bottom: 0;
    align-self: flex-end;
  }
}

.scroller-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  flex: 1;

  @media (max-width: 768px) {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  @media (max-width: 640px) {
    gap: 0.5rem;
  }
}

.scroller-field {
  label {
    display: block;
    margin-bottom: 0.5rem;
  }

  &.expanded {
    flex: 1;

    @media (max-width: 768px) {
      flex: unset;
    }
  }
}

.max-items-field {
  max-width: 9rem;
  flex-shrink: 0;

  @media (max-width: 768px) {
    max-width: none;
  }
}

label {
  color: var(--text-color-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.dialog-footer {
  @include panel.dialog-footer;
  border-top: none;

  .footer-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  @media (max-width: 640px) {
    .footer-left {
      flex-direction: column;
      gap: 0.5rem;

      ::ng-deep .p-button {
        width: 100%;
      }
    }

    .footer-actions {
      ::ng-deep .p-button {
        flex: 1;
      }
    }
  }
}

.add-scroller-wrapper {
  margin-bottom: 0;
}
