//buttons
.primary-button {
  background-color: $primary-green;
  border-radius: 4px;
  color: $white;
  margin: 5px;
  transition: all 0.3s ease 0s;

  &:hover {
    background-color: $secondary-green;
    box-shadow: 0 8px 15px $shadow-black;
    color: $white;
    transform: translateY(-7px);
  }
}

.primary-delete-button {
  background-color: $primary-red;
  border-radius: 4px;
  color: $white;
  margin: 5px;
  transition: all 0.3s ease 0s;

  &:hover {
    background-color: $secondary-red;
    box-shadow: 0 8px 15px $shadow-black;
    color: $white;
    transform: translateY(-7px);
  }
}

.secondary-button {
  background-color: $white;
  border: 1.5px solid $secondary-green;
  border-radius: 4px;
  color: $black;
  height: 30px;
  margin: 5px;
  padding: 0 5px 6px;
  text-decoration: none;

  img {
    height: 20px;
    padding-bottom: 2px;
    padding-right: 2px;
    width: 20px;
  }
}

.tertiary-button {
  border: 1.5px solid $secondary-green;
  border-radius: 4px;
  box-shadow: 0 2px 7px $shadow-black;
  margin: 10px 15px;
  transition: all 0.3s ease 0s;

  &:hover {
    background-color: $primary-green;
    box-shadow: 0 7px 7px $white;
    color: $white;
  }
}

.mini-button {
  border-radius: 4px;
  color: $white;
  height: fit-content;
  margin: 5px;
  padding: 3px 5px;
  text-decoration: none;
  width: 85px;
}

//cards
.social-card {
  background-color: $card-green;
  box-shadow: 0 2px 7px $shadow-black;
  display: inline-block;
  height: 89px;
  margin: 50px 7px 40px;
  opacity: 0.89;
  padding: 15px;
  transition: box-shadow 0.2s ease-in;
  width: 300px;

  &:hover {
    box-shadow: 0 7px 7px $shadow-black;
  }
}

.social-card-image {
  float: left;
}

.circuit-card {
  border: 1px solid $primary-green;
  border-radius: 0;
  display: inline-block;
  height: 250px;
  margin-bottom: 20px;
  margin-top: 20px;
  max-width: 320px;
  min-width: 260px;
}

.circuit-card-image {
  max-height: 180px;
  max-width: 100%;
}

.circuit-card-footer {
  background-color: $white;
  border-top: 1px solid $primary-green;
  padding-top: 10px;
}

.circuit-card-name {
  float: left;
  font-weight: 600;
  margin-top: 10px;
  position: relative;
  text-align: left;

  p {
    max-height: 30px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.tooltiptext {
  background-color: $navbar-dark-grey;
  border-radius: 0.3rem;
  bottom: 100%;
  color: $white;
  font-size: 0.8rem;
  left: 0%;
  max-width: 100%;
  opacity: 0;
  padding: 0.3rem;
  position: absolute;
  text-align: center;
  transition: opacity 0.5s;
  visibility: hidden;
  z-index: 1;

  &::after {
    border-color: $navbar-dark-grey transparent transparent;
    border-style: solid;
    border-width: 0.3rem;
    content: "";
    left: 50%;
    margin-left: -0.3rem;
    position: absolute;
    top: 100%;
  }
}

.circuit-card-name:hover .tooltiptext {
  opacity: 1;
  visibility: visible;
}

.circuit-card-primary-button {
  float: right;
  margin-bottom: 15px;
}

.project-cards-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 396px));
  justify-content: center;
  margin: 20px auto;
  width: 100%;
}

.project-card {
  background: $white;
  border: 1px solid $border-light-grey;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  width: 100%;
  margin: 0;
  max-width: 396px;
  min-width: 300px;
  overflow: hidden;
  transition: all 0.3s ease;
  text-decoration: none;

  &:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
  }
}

.submission-card { @extend .project-card; }

.project-card-image-container {
  border-bottom: 2px solid $primary-green;
  height: 200px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.project-card-image {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.project-card-content {
  padding: 16px;
}

.project-card-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.project-card-title {
  flex: 1;
  min-width: 0;

  h3 {
    color: $black;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.project-card-stats {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  gap: 12px;
}

.project-card-stat {
  align-items: center;
  color: #666;
  display: flex;
  font-size: 14px;
  gap: 4px;

  i {
    color: $primary-green;
  }

  .fa-star {
    color: $primary-green;
  }
}

.project-card-author {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #666;
  font-size: 14px;
  margin-bottom: 12px;
}

.project-card-description {
  color: #555;
  display: -webkit-box;
  line-clamp: 3;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
}

.show-more-container {
  margin-top: 8px;
}

.show-more-btn {
  color: $primary-green;
  font-size: 14px;
  text-decoration: none;

  &:hover {
    color: $secondary-green;
    text-decoration: underline;
  }
}

.project-card-link {
  display: block;
  text-decoration: none;
  color: inherit;

  &:hover {
    text-decoration: none;
  }
}

@media (max-width: 768px) {
  .project-cards-grid {
    justify-content: center;
  }

  .project-card {
    max-width: 100%;
    min-width: 280px;
  }
}

@media (max-width: 400px) {
  .circuit-card-name {
    max-width: 140px;
  }
}

//modals
.primary-modal-dialog {
  border-radius: 4px;
  box-shadow: none;
  padding-right: 0;
}

.primary-modal-header {
  background-color: $primary-green;
  border: 1px solid $primary-green;
  box-shadow: none;

  .modal-title {
    color: $white;
  }

  .close {
    color: $white;
    opacity: 1;
  }
}

.secondary-modal-header {
  background-color: $primary-red;
  border: 1px solid $primary-red;
  box-shadow: none;

  .modal-title {
    color: $white;
  }

  .close {
    color: $white;
    opacity: 1;
  }
}

@media (max-width: 400px) {
  .primary-modal-dialog {
    max-width: 100%;
  }
}

//forms
.form-container {
  margin-left: auto;
  margin-right: auto;
  max-width: 93%;
  text-align: left;
}

.status-container {
  align-items: center;
  display: flex;
  flex-direction: row-reverse;
  justify-content: space-between;
}

.form-control {
  &:focus {
    background-color: $white;
    border-color: $form-input-green;
    box-shadow: 0 0 0 0.2rem $form-input-focus-green;
    color: $black;
    outline: 0;
  }
}

.form-input {
  background-color: $white;
  border: 1px solid $secondary-green;
  border-radius: 0;
  max-width: 100%;
}

@media (max-width: 400px) {
  .form-container {
    max-width: 90%;
  }

  .status-container {
    align-items: flex-start;
    flex-direction: column-reverse;
    grid-row-gap: 15px;
  }
}

//errors
.error-message {
  background: $error-red;
  border-radius: 4px;
  color: $primary-red;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 10px;
  padding: 15px;

  ul {
    margin-bottom: 1rem;
    margin-top: 1rem;
  }

  li {
    text-align: left;
  }
}

.alert-success {
  margin-top: 10px;
  padding-top: 1rem; // aligns the alert text
}

//checkpoints
.primary-checkpoint {
  background-color: $shadow-grey;
  display: inline-block;
  height: 25px;
  margin-top: 15px;
  position: absolute;
  width: 25px;
  top: 6px;

  &::after {
    content: "";
    display: none;
    position: absolute;
  }
}

.primary-checkpoint-container {
  cursor: pointer;
  display: inline-block;
  font-size: 22px;
  position: relative;

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

  h6 {
    display: inline-block;
    margin-bottom: 0;
    margin-right: 10px;
  }

  input:checked ~ .primary-checkpoint {
    background-color: $primary-green;

    &::after {
      border: solid $white;
      border-width: 0 3px 3px 0;
      display: block;
      height: 14px;
      left: 7px;
      top: 2px;
      transform: rotate(45deg);
      width: 9px;
    }
  }
}

//tags
.search-tag {
  background-color: $secondary-green;
  border-radius: 4px;
  color: $white;
  font-weight: 500;
  padding: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;

  &:hover {
    color: $white;
  }
}

.explore-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
  flex-wrap: wrap;
}
.explore-tab {
  border: 1px solid $secondary-green;
  border-radius: 999px;
  padding: 6px 14px;
  background: $white;
  cursor: pointer;

  &:hover {
    border-color: $primary-green;
    color: $primary-green;
  }

  &:focus-visible {
    outline: 3px solid $primary-green;
    outline-offset: 2px;
  }

  &:disabled,
  &[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.6;
  }
}
.explore-tab.active {
  background: $primary-green;
  color: $white;
  border-color: $primary-green;
}
.explore-tab[aria-selected="true"] {
  background: $primary-green;
  color: $white;
  border-color: $primary-green;
}

.explore-section[data-key="picks"] .project-cards-grid,
.explore-section[data-key="recent"] .project-cards-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.explore-section[data-key="picks"] .project-card,
.explore-section[data-key="recent"] .project-card {
  max-width: none;
  min-width: 0;
}
