/* modal overlay */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 10;
}

/* modal box */
.modal-content {
  position: relative;
  background-color: var(--secondary-bg-color);
  max-width: 1200px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: fadeInUp 0.3s ease;
}

.modal-header {
  position: sticky;
  top: 0;
  background-color: var(--secondary-bg-color);
  z-index: 2;
  padding: 1rem 1.5rem 0.5rem;
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid var(--accent-color);
  display: flex;
  justify-content: center;
}

.modal-body {
  text-align: center;
  padding: 2rem 4.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-body-header-container {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-around;
}

#modal-project-info {
  font-size: 20px;
  width: 40%;
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 1rem;
}

#modal-project-info div {
  display: flex;
  flex-direction: row;
  gap: 10px;
}

#modal-project-info div span {
  color: var(--secondary-text-color)
}

#modal-project-status {
  background-color: var(--accent-color);
  color: var(--theme-color);
  padding: 4px 16px;
  border-radius: 50px;
}

#modal-tech-stack {
  width: 50%;
}

#modal-title {
  font-weight: bold;
}

#modal-description {
  font-size: 25px;
  text-align: justify;
}

#modal-description ul {
  padding-left: 1.5rem;
  margin-top: 0.5rem;
}
#modal-description li {
  margin-bottom: 0.2rem;
}

/* modal footer */
.modal-footer {
  position: sticky;
  bottom: 0;
  padding: 0.8rem;
  background-color: var(--secondary-bg-color);
  border-top: 2px solid var(--accent-color);
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding-right: 2.5rem;
  z-index: 2;
}

.modal-footer a {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.modal-link-project {
  gap: 1rem;
  background-color: white;
  border: 2px solid #181717;
  color: #181717;
}

.modal-link-project svg {
  width: 20px;
  height: 20px;
  fill: #181717;
}

.modal-link-project:active {
  background-color:  var(--github-modal-link-active);
}

.modal-link-product {
  gap: 1rem;
  color: white;
  background-color: #181717;
  border: 2px solid white;
  text-decoration: none; 
}

.modal-link-product:active {
  background-color: rgba(0, 0, 0, 0.70);
}

body.modal-open {
  overflow: hidden;
}

/* overflow */
.modal-scroll {
  max-height: 90vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-top: 0;

  scrollbar-width: none; /* Firefox */
}

.modal-scroll::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.modal-scroll-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background-color: rgba(0,0,0,0.05);
  overflow: hidden;
  z-index: 5;
}

.modal-scroll-progress {
  width: 0%;
  height: 100%;
  background-color: var(--theme-color);
  transition: width 0.5s ease-out;
}


/* slider */
.modal-slider-title {
  color: var(--main-text-color);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.modal-slider-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.modal-slider {
  position: relative;
  width: 90%;
  overflow: hidden;
  margin-bottom: 1rem;
}

.slider-track {
  display: flex;
  transition: transform 0.4s ease-in-out;
}

.slider-track img {
  width: 100%;
  min-width: 100%;
  /* height: 534px; */
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  flex-shrink: 0;
}

.slider-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  background-color: var(--theme-color);
  width: 0%;
  transition: width 5s linear;
}

.slider-btn {
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 1.2rem;
  z-index: 2;
}

.slider-btn:hover {
  background-color: rgba(0, 0, 0, 0.6);
}

.slider-indicators {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.indicator-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #aaa;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.3s;
}

.indicator-dot.active {
  background-color: var(--theme-color);
  transform: scale(1.2);
}

.modal-slider img {
  cursor: zoom-in;
  transition: transform 0.2s ease;
}

.modal-slider img:hover {
  transform: scale(1.03);
}

/* tech stack */
.modal-tech-group {
  margin: 0.6rem 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.modal-tech-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  gap: 0.2rem;
  border-radius: 8px;
  margin: 0.25rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1.5px solid var(--hover-color);
  box-shadow: 0 0 5px var(--hover-color);
  font-weight: bold;
  color: var(--main-text-color);
  text-decoration: none;
}

.modal-tech-item:hover {
  box-shadow: 0 0 15px var(--hover-color);
  text-decoration: none;
}

/* Close button */
#modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.6rem;
  color: var(--secondary-text-color);
  cursor: pointer;
  transition: color 0.2s;
}

#modal-close:hover {
  color: #e63946;
}

/* image viewer */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.image-viewer img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 10px;
  transition: transform 0.3s ease;
  cursor: zoom-out;
}

.image-viewer img:hover {
  transform: scale(1.05);
}

#viewer-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s;
}

#viewer-close:hover {
  opacity: 0.7;
}

/* Simple animation */
@keyframes fadeInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  #modal-title {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 1rem 1.5rem;
  }

  .modal-body-header-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  #modal-project-info {
    width: 100%;
    align-items: flex-start;
    font-size: 16px;
    gap: 0.8rem;
  }

  #modal-tech-stack {
    width: 100%;
    align-items: flex-start;
    text-align: left;
    font-size: 16px;
  }

  #modal-tech-stack h3 {
    margin-bottom: 0.5rem;
  }

  .modal-tech-group {
    justify-content: flex-start;
    font-size: 14px;
  }

  #modal-description {
    font-size: 16px;
  }

  .modal-slider-title {
    font-size: 1.2rem;
    margin-top: 1rem;
  }

  .modal-slider-container {
    gap: 0.5rem;
    width: 110%;
  }

  .slider-btn {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }

  .modal-footer {
    justify-content: center;
    padding-right: 1rem;
    font-size: 14px;
  }

  .modal-link-project {
    gap: 0.7rem;
  }
}