/* Remove default margins/padding */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

/* Make iframe fill the entire viewport */
iframe {
  position: fixed;   /* stick to viewport */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;      /* remove white border */
}



/* ==================== THUMBNAIL STYLES - CENTERED ==================== */

.thumbnail-container {
  width: 150px;
  height: 200px;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;  /* Prevent shrinking */
}

.thumbnail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #999;
  font-size: 0.85rem;
}

.thumbnail-fallback {
  font-size: 4rem;
  color: #666;
}

/* Spinner animation */
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Update item card for better thumbnail display */
.item-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;  /* Centers all children horizontally */
  text-align: center;   /* Centers text */
}

.item-card .icon {
  font-size: 4rem;
  margin: 0 auto 0.5rem;  /* Centers the icon */
  display: block;
}

.item-card .name {
  width: 100%;
  text-align: center;
  word-wrap: break-word;
}

.item-card .size {
  width: 100%;
  text-align: center;
}

/* ==================== END THUMBNAIL STYLES ==================== */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

.item-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;  /* Centers horizontally */
  justify-content: flex-start;
  text-align: center;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  width: 100%;  /* Take full width of grid cell */
}

.thumbnail-container {
  width: 150px;
  height: 200px;
  margin: 0 auto 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;  /* Prevent shrinking */
}


/* ==================== SECTION HEADERS (Folders/Files) ==================== */

.section-header {
  grid-column: 1 / -1; /* Span full width of grid */
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.5rem 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 0.5rem;
}

.list-section-header {
  font-size: 0.9rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.5rem 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 0.5rem;
}

/* Update files-grid to handle section headers properly */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

/* Ensure proper text wrapping in item cards */
.item-card .name {
  width: 100%;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  max-width: 180px; /* Prevent names from making cards too wide */
}