.start-page {
  width: 100%;
  max-width: calc(100% - 2em);
}

.start-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-color);
  box-shadow: none;
  box-sizing: border-box;
  padding: 1em;

  svg {
    margin: 0;
  }

  h1 {
    margin: 0;
    color: var(--fg-color);
    font-size: 1.25rem;
  }
}

.start-page-actions {
  display: flex;
  gap: 0.5em;
}

.button-link {
  padding: 0.5em 1em;
  background: var(--bg-color);
  fill: var(--mid-color);
  color: var(--mid-color);
  text-decoration: none;
  border-radius: 0.25em;
  font-size: 0.875em;
  height: auto;
  transition: none;

  &:hover {
    background: var(--bg-highlight-color);
    color: var(--fg-color);
    fill: var(--fg-color);
    box-shadow: none;
  }
}

.start-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2em 0;

  section > h2 {
    margin: 0 1rem 0.5em;
    font-size: 1em;
    font-weight: bold;
    color: var(--fg-color);
    border-bottom: 0.125rem solid var(--highlight-color);
  }

  ul {
    display: flex;
    flex-direction: column;
    gap: 0em;
    margin: 0;
    padding: 0;
    list-style: none;

    &.drop-zone-active {
      background-color: var(--bg-highlight-color);
      border: 0.125rem dashed var(--highlight-color);
      border-radius: 0.5em;
      padding: 0.5em;
      margin: 0.25em 0;
      transition: all 0.2s ease;
    }
  }

  li a {
    font-size: 1.125em;
    color: var(--fg-color);
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;

    &:hover {
      text-decoration: none;
      background-color: var(--bg-highlight-color);
    }
  }

  /* Responsive - Tablets */
  @media screen and (min-width: 45em) {
    &[data-columns="2"] {
      grid-template-columns: repeat(2, 1fr);
    }

    &[data-columns="3"] {
      grid-template-columns: repeat(3, 1fr);
    }
  }

  /* Responsive - Desktop */
  @media screen and (min-width: 60em) {
    &[data-columns="2"] {
      grid-template-columns: repeat(2, 1fr);
    }

    &[data-columns="3"] {
      grid-template-columns: repeat(3, 1fr);
    }

    &[data-columns="4"] {
      grid-template-columns: repeat(4, 1fr);
    }

    &[data-columns="5"] {
      grid-template-columns: repeat(5, 1fr);
    }

    &[data-columns="6"] {
      grid-template-columns: repeat(6, 1fr);
    }
  }
}

.start-page-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;

  h3 {
    font-size: 0.75em;
    text-align: center;
    text-transform: uppercase;
    margin: 0;
  }

  &.drop-zone-active {
    background-color: var(--bg-highlight-color);
    border: 0.125rem dashed var(--highlight-color);
    border-radius: 0.5em;

    h3 {
      color: var(--highlight-color);
      font-weight: bold;
    }
  }
}

.command-bar {
  position: relative;
  margin-bottom: 2em;

  input {
    width: 100%;
    padding: 0.75em 1em;
    border: 0.125rem solid var(--border-color);
    border-radius: 0.5em;
    font-size: 1.125em;
    background: var(--bg-color);
    color: var(--fg-color);
    box-sizing: border-box;
    transition: none;

    &:focus {
      outline: none;
      border-color: var(--highlight-color);
      box-shadow: 0 0 0 0.125em rgba(var(--highlight-color), 0.2);
    }
  }
}

.command-bar-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-color);
  border: 0.125rem solid var(--border-color);
  border-radius: 0.5em;
  margin-top: 0.25em;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.command-bar-suggestion {
  padding: 0.75em 1em;
  cursor: pointer;
  border-bottom: 0.125rem solid var(--border-color);

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

  &:hover,
  &.selected {
    background: var(--bg-highlight-color);
  }
}

.suggestion-title {
  font-weight: 600;
  color: var(--fg-color);
}

.suggestion-url {
  font-size: 0.875em;
  color: var(--mid-color);
}

.start-page-empty {
  text-align: center;
  padding: 3em 1em;
  color: var(--mid-color);

  h2 {
    margin: 0 0 1em 0;
    color: var(--fg-color);
  }

  p {
    margin: 0.5em 0;
  }
}

.empty-group,
.empty-column {
  color: var(--mid-color);
  font-style: italic;
  text-align: center;
  padding: 1em;
}

.add-group-section {
  margin-bottom: 2em;
  padding: 1em;
  background: var(--bg-highlight-color);
  border-radius: 0.5em;

  h2 {
    margin-top: 0;
  }
}

.add-group-form {
  display: flex;
  gap: 0.5em;
  align-items: end;

  .form-field {
    display: flex;
    flex-direction: column;

    &.name-field {
      flex: 1;
    }
  }

  label {
    display: block;
    margin-bottom: 0.25em;
    font-size: 0.875em;
  }

  input[type="text"],
  select {
    width: 100%;
    padding: 0.5em;
    border: 1px solid var(--border-color);
    border-radius: 0.25em;
  }

  input[type="submit"] {
    margin: 0;
  }
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0.5em 0.25em;
  border-bottom: 0.125rem solid var(--highlight-color);
  gap: 0.25em;
}

.group-name-form {
  flex: 1;

  input[type=submit] {
    font-size: 0.75em;
    background: var(--highlight-color);
    color: var(--highlight-contrast-color);
    border: none;
    border-radius: 0.25em;
    cursor: pointer;
    transition: 0.2s ease-out all;
    width: 5em;
    padding: 1em;
    margin: 0;
  }
}

.group-name-input {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.group-name-field {
  flex: 1;
  padding: 0.25em 0.5em;
  border: 1px solid var(--border-color);
  border-radius: 0.25em;
  font-size: 1em;
  font-weight: 600;
  background: var(--bg-color);
  transition: 0.2s ease-out all;

  &:focus {
    outline: none;
    border-color: var(--highlight-color);
    box-shadow: 0 0 0 0.125em rgba(var(--highlight-color), 0.2);
  }
}

.save-group-name:hover {
  background: var(--link-hover-color);
}

.start-page-group {
  transition: opacity 0.2s ease, transform 0.2s ease;

  &.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
  }
}

.start-page-item {
  transition: opacity 0.2s ease, transform 0.2s ease;

  &.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
  }

  &.editable {
    display: flex;
    align-items: center;
    padding: 0.5em;
    border: 1px solid transparent;
    border-radius: 0.25em;
    transition: 0.2s ease-out all;
    gap: 0.5em;

    > span {
      flex: 1;
      overflow-wrap: break-word;
    }
  }
}

.drag-handle,
.item-actions button,
.group-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75em;
  height: 1.75em;
  border-radius: 0.25em;
  border: none;
  cursor: pointer;
  padding: 0;

  svg {
    display: block;
    width: 1.75em;
    height: 1.75em;
    fill: var(--border-color);
    margin: 0;
  }

  &:hover svg {
    fill: var(--fg-color);
    fill-opacity: 0.5;
  }
}

.drag-handle {
  cursor: grab;
  user-select: none;

  &:active {
    cursor: grabbing;
  }
}

.item-actions button,
.group-actions button {
  background: var(--bg-color);
  color: var(--fg-color);
  font-size: 1rem;
  box-sizing: content-box;
}

.item-actions,
.group-actions {
  display: flex;
  gap: 0.25em;

  .remove-button:hover svg {
    fill: var(--danger-color);
  }
}

.potential-drop-target {
  background-color: rgba(var(--highlight-color-rgb, 0, 120, 255), 0.1);
  border: 0.125rem solid rgba(var(--highlight-color-rgb, 0, 120, 255), 0.3);
  border-radius: 0.5em;
  transition: all 0.2s ease;

  ul {
    padding: 0.5em;
    margin: 0.25em 0;
  }

  .start-page-column {
    background-color: rgba(var(--highlight-color-rgb, 0, 120, 255), 0.05);
  }
}

.hidden {
  display: none !important;
}
