:root {
  --orange: #f5a25d;
  --brown: #5a3e2b;
  --burgundy: #7b2e2f;
  --bg: #fef6ef;
  --gold: #d4af37; 
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", sans-serif;
  background-color: var(--bg);
  color: var(--brown);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  line-height: 1.6;
}

header {
  text-align: center;
  padding: 2rem 1rem;
  width: 100%;
}

h1 {
  color: var(--burgundy);
  font-size: 2.7rem;
  margin-bottom: 0.5rem;
}

header p {
  opacity: 0.8;
  font-size: 1.5rem;
  margin: 0;
}

#menu {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0 2rem 0;
  padding: 0 1rem;
  max-width: 1200px;
  width: 100%;
}

.folder-btn {
  background-color: var(--orange);
  color: white;
  border: none;
  padding: 0.5rem 1.0rem;
  border-radius: 8px;
  cursor: pointer;
  font-family: "Poppins", sans-serif;
  font-size: 2rem;
  transition: all 0.3s ease;
  font-weight: 500;
}

.folder-btn:hover {
  background-color: var(--burgundy);
  transform: translateY(-2px);
}

.folder-btn.active {
  background-color: var(--burgundy);
  transform: translateY(-1px);
}

.gallery-container {
  width: 90%;
  max-width: 1200px;
  margin: 1rem auto 3rem auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
}

.placeholder, .loading {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1.2rem;
  color: var(--brown);
  opacity: 0.7;
  padding: 3rem;
}

.error-message {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--burgundy);
  padding: 2rem;
  font-size: 1.1rem;
  background: #f8d7da;
  border-radius: 8px;
  margin: 1rem;
}

.gallery-item {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.gallery-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.preview {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.3s ease;
  max-height: 300px;
  object-fit: contain;
}

.preview:hover {
  transform: scale(1.02);
}

video.preview {
  height: auto;
  max-height: 300px;
}

.txtframe, .pdfframe {
  width: 100%;
  height: 400px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: white;
}
  
/* ADD THE NEW IFRAME STYLES RIGHT HERE */
.html-preview {
  width: 100%;
  height: 600px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: white;
}

/* For smaller screens */
@media (max-width: 768px) {
  .html-preview {
    height: 400px;
  }
}
/* END OF NEW STYLES */
 /* Make HTML previews take full width - OPTION 4 */
.gallery-item:has(.html-preview) {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
}

/* Update the height for full-width HTML previews */
.html-preview {
  height: 700px; /* Increased from 600px for full width */
}

/* Make PDFs larger too */
.gallery-item:has(.pdfframe) {
  grid-column: span 2;
}

.pdfframe {
  height: 600px;
}

/* Update mobile styles */
@media (max-width: 768px) {
  .gallery-item:has(.html-preview),
  .gallery-item:has(.pdfframe) {
    grid-column: 1 / -1;
  }
  
  .html-preview {
    height: 500px;
  }
  
  .pdfframe {
    height: 400px;
  }
}

/* ADD CODE PREVIEW STYLES RIGHT HERE */
/* Code preview iframe */
.code-preview {
  width: 100%;
  height: 500px;
  border: 1px solid var(--orange);
  border-radius: 8px;
  background: white;
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

/* Make code previews take full width */
.gallery-item:has(.code-preview) {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
}

/* Mobile adjustments for code preview */
@media (max-width: 768px) {
  .gallery-item:has(.code-preview) {
    grid-column: 1 / -1;
  }
  
  .code-preview {
    height: 400px;
  }
}

/* END CODE PREVIEW STYLES */

/* SIMPLE CODE DISPLAY (NO PRISM.JS) - ADD THIS */
.code-container {
  width: 100%;
  background: #1e1e1e;
  border-radius: 8px;
  overflow: hidden;
  font-family: 'Courier New', monospace;
}

.code-header {
  background: #2d2d2d;
  color: #fff;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.code-filename {
  color: var(--orange);
  font-weight: bold;
  font-size: 1rem;
}

.code-container pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
  max-height: 600px;
  background: #1e1e1e !important;
  color: #d4d4d4;
  font-size: 14px;
  line-height: 1.5;
  tab-size: 4;
}

.code-container code {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  white-space: pre;
}

/* Basic syntax colors */
.code-container .comment { color: #6a9955; }
.code-container .keyword { color: #569cd6; }
.code-container .string { color: #ce9178; }
.code-container .number { color: #b5cea8; }
.code-container .function { color: #dcdcaa; }
.code-container .operator { color: #d4d4d4; }

/* Make code containers full width */
.gallery-item:has(.code-container) {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  padding: 0; /* Remove padding for code containers */
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .code-container pre {
    font-size: 12px;
    padding: 1rem;
  }
  
  .gallery-item:has(.code-container) {
    grid-column: 1 / -1;
  }
}
/* END SIMPLE CODE DISPLAY */

.file-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--orange), var(--burgundy));
  color: white;
  text-decoration: none;
  border-radius: 8px;
  text-align: center;
  font-weight: 500;
  transition: all 0.3s ease;
  min-height: 80px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
}

.file-link:hover {
  background: linear-gradient(135deg, var(--burgundy), var(--brown));
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  color: white;
  text-decoration: none;
}

.file-name {
  font-size: 0.9rem;
  margin-top: 0.5rem;
  text-align: center;
  word-break: break-word;
  color: var(--brown);
  opacity: 0.8;
}

footer {
  margin-top: auto;
  padding: 2rem;
  font-size: 0.9rem;
  opacity: 0.6;
  text-align: center;
  width: 100%;
}

@media (max-width: 768px) {
  .gallery-container {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  #menu {
    gap: 0.5rem;
  }
  
  .folder-btn {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }
}
