/* Project Cards Styling */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.project-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  aspect-ratio: 2 / 1;
  position: relative;
}

.project-card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.project-image {
  width: 100%;
  height: 60%;
  object-fit: cover;
  display: block;
  transition: all 0.3s ease;
}

/* Add overlay effect on hover */
.project-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  pointer-events: none;
  border-radius: 10px;
}

.project-card:hover::after {
  background: rgba(0, 0, 0, 0.1);
}

.project-card:hover .project-image {
  filter: brightness(0.95);
}

.project-title {
  font-size: 1.2rem;
  margin: 10px 15px 5px;
  text-align: center;
}

.project-description {
  font-size: 0.9rem;
  margin: 0 15px 10px;
  text-align: center;
  color: #666;
}

.view-code-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 15px;
  background-color: #24292e;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  margin: 10px 15px;
  z-index: 5;
}

/* Fixed position button for project cards on hover */
.project-card .view-code-btn {
  position: absolute;
  bottom: 15px;
  right: 15px;
  opacity: 0;
  transform: translateY(10px);
  margin: 0;
}

.project-card:hover .view-code-btn {
  opacity: 1;
  transform: translateY(0);
}

.view-code-btn:hover {
  background-color: #1a1a1a;
  transform: scale(1.05);
}

/* For modal, keep the button at the bottom */
.modal-actions .modal-btn {
  position: static;
  opacity: 1;
  transform: none;
  margin: 0;
  border-radius: 25px;
  padding: 12px 25px;
  font-size: 1rem;
  min-width: 140px;
}

/* Hide the original view-code-btn in the modal */
.project-modal .view-code-btn:not(.modal-btn) {
  display: none;
}

/* Modal Styling */
.project-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  width: 90%;
  max-width: 800px;
  position: relative;
  padding: 25px;
  max-height: 85vh;
  overflow-y: auto;
  margin: 20px auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  cursor: pointer;
  color: #aaa;
  transition: color 0.3s ease;
  z-index: 10;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
}

.close-btn:hover {
  color: #333;
}

.modal-image {
  width: 100%;
  height: auto;
  margin-bottom: 20px;
  border-radius: 8px;
}

.tech-tags {
  display: flex;
  gap: 10px;
  margin: 15px 0;
  flex-wrap: wrap;
}

.tag {
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 0.9rem;
  color: #fff;
  background-color: #007bff;
}

/* Modal buttons and actions */
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin: 25px 0 15px 0;
  width: 100%;
  position: relative;
  bottom: 0;
  left: 0;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 25px;
  background-color: #24292e;
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  font-size: 1rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
  width: auto;
  min-width: 140px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: static;
  opacity: 1;
  transform: none;
}

.modal-btn:hover {
  background-color: #1a1a1a;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments for modals */
@media (max-width: 768px) {
  .project-modal {
    padding: 15px;
  }
  
  .modal-content {
    width: 95%;
    padding: 20px;
    margin: 40px auto 20px auto;
    max-height: 80vh;
  }
  
  .modal-actions {
    margin: 20px 0 10px 0;
    padding-bottom: 10px;
  }
  
  .modal-btn {
    width: 100%;
    min-width: unset;
    padding: 12px 20px;
    margin: 0;
  }
}

@media (max-width: 480px) {
  .project-modal {
    padding: 10px;
  }
  
  .modal-content {
    width: 100%;
    padding: 15px;
    margin: 30px auto 15px auto;
  }
  
  .modal-actions {
    margin: 15px 0 10px 0;
  }
  
  .modal-btn {
    font-size: 0.95rem;
    padding: 10px 20px;
  }
}

@media (max-width: 768px) {
  .project-grid {
    grid-template-columns: 1fr;
  }
  
  /* Make view code button always visible on mobile */
  .project-card .view-code-btn {
    opacity: 1;
    transform: translateY(0);
    bottom: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  /* Adjust card height for better mobile display */
  .project-card {
    aspect-ratio: 16/10;
  }
}
