/* Portfolio Projects Section - Folder-Based Design */

.projects-section {
  min-height: 100vh;
  padding: 100px 40px 80px;
  position: relative;
  background: var(--bg-primary);
  transition: background-color 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 40px;
}

/* Theme transition effects */
.fade-out .projects-section {
  opacity: 0 !important;
  filter: blur(1px) !important;
}

.fade-in .projects-section {
  opacity: 1 !important;
  filter: blur(0px) !important;
}

.theme-transitioning .projects-section {
  opacity: 0.3;
}

body.theme-transitioning * {
  transition: background-color 0.8s cubic-bezier(0.4, 0.0, 0.2, 1), 
              color 0.8s cubic-bezier(0.4, 0.0, 0.2, 1), 
              border-color 0.8s cubic-bezier(0.4, 0.0, 0.2, 1), 
              box-shadow 0.8s cubic-bezier(0.4, 0.0, 0.2, 1) !important;
}

.projects-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

/* Category Filters */
.category-filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 50px;
  flex-wrap: nowrap; /* Keep all buttons on one row */
  white-space: nowrap;
}

.category-filter-btn {
  padding: 10px 20px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  flex-shrink: 0; /* Prevent buttons from shrinking */
}

.category-filter-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.category-filter-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  box-shadow: 0 4px 12px var(--glow-color);
}

/* Projects Grid - 4x2 Layout */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 30px;
  max-width: 1000px;
  margin: 0 auto;
  min-height: 500px;
}

.no-projects {
  grid-column: 1 / -1;
  text-align: center;
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--text-secondary);
  padding: 60px 20px;
}

/* Project Folder - Floating 3D Model Style */
.project-folder {
  background: transparent;
  border: none;
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
}

.project-folder:hover {
  transform: translateY(-12px);
}

.folder-icon {
  width: 160px;
  height: 160px;
  margin-bottom: 20px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: visible;
  transition: all 0.3s ease;
  background: transparent;
  position: relative;
  box-shadow: 0 4px 12px var(--shadow-color);
}

/* 3D Canvas - Full transparency */
.project-3d-canvas {
  width: 100%;
  height: 100%;
  background: transparent !important;
  display: block;
}

.placeholder-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  opacity: 0.4;
}

.project-folder:hover .folder-icon {
  transform: scale(1.02); /* Minimal growth to prevent screen overflow */
  border-color: var(--accent-primary);
  box-shadow: 0 8px 20px var(--glow-color);
}

/* Folder Label - Minecraft/Progress Bar Style */
.folder-label {
  position: relative;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 6px;
  border: 2px solid var(--border-color);
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px var(--shadow-color);
  transition: all 0.3s ease;
  min-width: 150px;
  opacity: 0;
  transform: translateY(-10px);
}

.project-folder:hover .folder-label {
  opacity: 1;
  transform: translateY(0);
}

.project-folder:hover .folder-label:hover {
  border-color: var(--accent-primary);
  box-shadow: 0 6px 16px var(--glow-color);
}

/* Arrow pointer above label */
.folder-label::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg-secondary);
  margin-bottom: -2px;
}

.folder-title {
  font-family: 'VT323', monospace;
  font-size: 1.3rem;
  margin: 0 0 6px 0;
  color: var(--text-primary);
  letter-spacing: 1px;
  line-height: 1.2;
  font-weight: normal;
}

.folder-category {
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.8;
  display: block;
}

/* Project Modal */
.project-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-modal-overlay.active {
  display: flex;
  opacity: 1;
}

.project-modal-content {
  background: var(--bg-primary);
  border: 3px solid var(--accent-primary);
  border-radius: 16px;
  max-width: 80%;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.project-modal-overlay.active .project-modal-content {
  transform: scale(1);
}

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 2px solid var(--border-color);
  background: var(--bg-secondary);
}

.modal-header h2 {
  font-family: 'VT323', monospace;
  font-size: 2rem;
  margin: 0;
  color: var(--text-primary);
  letter-spacing: 2px;
}

.project-modal-close {
  background: transparent;
  border: none;
  font-size: 2.5rem;
  color: var(--text-primary);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.project-modal-close:hover {
  background: var(--accent-primary);
  color: white;
  transform: rotate(90deg);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  gap: 5px;
  padding: 15px 30px;
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border-color);
  overflow-x: auto;
  flex-wrap: wrap;
}

.modal-tab {
  padding: 10px 20px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-color);
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  white-space: nowrap;
}

.modal-tab:hover {
  background: var(--accent-secondary);
  color: white;
}

.modal-tab.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
}

/* Modal Body */
.modal-body {
  padding: 30px;
  overflow-y: auto;
  flex: 1;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Text Content */
.text-content {
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.text-content p {
  margin: 0 0 15px 0;
}

/* Images Grid */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.image-item {
  border: 2px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-item:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
  box-shadow: 0 8px 16px var(--shadow-color);
}

.image-item img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.image-item:hover img {
  transform: scale(1.1);
}

/* Files List */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.file-item:hover {
  border-color: var(--accent-primary);
  transform: translateX(5px);
}

.file-icon {
  font-size: 2rem;
}

.file-name {
  flex: 1;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  color: var(--text-primary);
}

.file-download {
  padding: 8px 16px;
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  background: var(--accent-primary);
  color: white;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.3s ease;
}

.file-download:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
}

/* Image Viewer */
.image-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-viewer-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border: 3px solid white;
  border-radius: 8px;
}

.image-viewer-close {
  position: absolute;
  top: -50px;
  right: 0;
  background: white;
  border: none;
  font-size: 2.5rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.image-viewer-close:hover {
  background: var(--accent-primary);
  color: white;
  transform: scale(1.1) rotate(90deg);
}

/* Blueprint Theme Grid Background */
body.blueprint-mode .projects-section {
  background: var(--bg-primary);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .projects-section {
    padding: 80px 30px 60px;
  }
}

@media (max-width: 900px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .modal-tabs {
    flex-wrap: nowrap;
    overflow-x: scroll;
  }

  .images-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .projects-section {
    padding: 70px 20px 50px;
    gap: 25px;
  }
  
  .category-filters {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 30px;
  }
  
  .category-filter-btn {
    padding: 8px 14px;
    font-size: 0.95rem;
    flex: 1 1 auto;
    min-width: 70px;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .projects-section {
    padding: 60px 15px 40px;
    gap: 20px;
  }
  
  /* App-like 2-column grid for mobile */
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 15px;
    max-width: 100%;
    min-height: auto;
    padding: 0 5px;
  }

  .project-folder {
    padding: 10px;
  }

  .folder-icon {
    width: 100%;
    max-width: 120px;
    height: 120px;
    margin-bottom: 10px;
  }

  .folder-label {
    min-width: auto;
    width: 100%;
    padding: 8px 12px;
    opacity: 1;
    transform: none;
  }

  .folder-title {
    font-size: 1rem;
  }

  .folder-category {
    font-size: 0.8rem;
  }
  
  /* Category filters as pills */
  .category-filters {
    gap: 6px;
    margin-bottom: 20px;
    justify-content: center;
  }
  
  .category-filter-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 20px;
  }

  .modal-header h2 {
    font-size: 1.6rem;
  }

  .images-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 400px) {
  .projects-section {
    padding: 50px 10px 30px;
  }
  
  .projects-grid {
    gap: 10px;
  }
  
  .folder-icon {
    max-width: 100px;
    height: 100px;
  }
  
  .folder-title {
    font-size: 0.9rem;
  }
  
  .category-filter-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
}
