/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Make navigation/event-list icons larger and visually prominent. Placed at
   the end so it overrides earlier icon sizing rules. */
.event-list .event-item .event-icon {
  width: calc(var(--tile-icon-size) * 1.8);
  height: calc(var(--tile-icon-size) * 1.8);
  font-size: var(--tile-icon-size);
  flex: 0 0 calc(var(--tile-icon-size) * 1.8);
}

@media (max-width: 520px) {
  .event-list .event-item .event-icon {
    width: calc(var(--tile-icon-size-sm) * 1.8);
    height: calc(var(--tile-icon-size-sm) * 1.8);
    font-size: var(--tile-icon-size-sm);
    flex: 0 0 calc(var(--tile-icon-size-sm) * 1.8);
  }
}

:root {
  --pak-red: #b91224;
  --pak-red-dark: #98121b;
  --pak-black: #101010;
  --card-bg: #f6f7f8;
  /* Card / tile variables */
  --card-padding: 12px;
  --card-padding-sm: 10px;
  --card-radius: 8px;
  --card-border: 1px solid #e9e9e9;
  --card-border-muted: 1px solid #e0e0e0;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --card-gap: 12px;
  --card-height: 80px;
  --card-min-height: 64px;
  --file-card-width: 300px;
  --folder-card-width: 320px;
  /* unified tile title sizes */
  --tile-title-size: 1.25rem;
  --tile-title-size-sm: 1.05rem;
  /* icon sizes to match tile titles (container scales with font-size) */
  --tile-icon-size: var(--tile-title-size);
  --tile-icon-size-sm: var(--tile-title-size-sm);
}

/* Layout */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 50%, #ced4da 100%);
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(250px, 1fr) 3fr;
  grid-template-areas:
    "header header"
    "sponsors sponsors"
    "nav main"
    "footer footer";
  gap: 20px;
  padding: 20px;
}

/* Header */
header {
  grid-area: header;
  position: relative;
  background: center/cover no-repeat url("images/banner.jpg");
  padding: 36px 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}
header h1 {
  color: #fff;
  margin-bottom: 5px;
  font-size: 2.5rem;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.7);
}
header p {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}
header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(0, 0, 0, 0.64), rgba(0, 0, 0, 0.38));
  border-radius: 10px;
  pointer-events: none;
}
header h1,
header p {
  position: relative;
  z-index: 1;
}

/* Sponsors Section */
.sponsors-section {
  grid-area: sponsors;
  background: var(--card-bg);
  padding: 20px 0;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.sponsors-track {
  display: flex;
  gap: 40px;
  width: fit-content;
  will-change: transform;
}

.sponsors-slide {
  display: flex;
  gap: 40px;
  align-items: center;
  flex-shrink: 0;
}

.sponsor-logo {
  height: 60px;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  transition: none;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
}

.sponsor-logo img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
  /* Use drop-shadow so the shadow follows the transparent edges of the logo image */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
  transition: filter 0.25s ease, transform 0.25s ease;
}

.sponsor-logo:hover img {
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.28));
  transform: translateY(-1px);
}

/* Responsive sizing for sponsor logos */
@media (max-width: 700px) {
  .sponsors-section {
    padding: 12px 0;
  }
  .sponsors-track,
  .sponsors-slide {
    gap: 24px;
  }
  .sponsor-logo {
    height: 44px;
    min-width: 92px;
    padding: 0 12px;
  }
}
@media (max-width: 480px) {
  .sponsors-track,
  .sponsors-slide {
    gap: 16px;
  }
  .sponsor-logo {
    height: 36px;
    min-width: 80px;
    padding: 0 10px;
  }
}

/* Navigation */
nav {
  grid-area: nav;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--pak-red);
  padding-bottom: 5px;
}
.nav-header h2 {
  color: #2c3e50;
  font-size: 1.5rem;
  margin: 0;
}
.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.event-item {
  /* match the other tile-style items: horizontal layout with centered alignment */
  display: flex;
  align-items: center; /* center vertically like file/folder tiles */
  gap: 12px;
  padding: 12px; /* slightly tighter padding to match file tiles */
  margin-bottom: 10px;
  background: var(--card-bg);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
}
.event-item:hover {
  background: #f4f5f6;
  border-color: var(--pak-red);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(185, 18, 36, 0.15);
}
.event-item.active {
  background: #fdf2f3;
  border-color: var(--pak-red);
  box-shadow: 0 2px 8px rgba(185, 18, 36, 0.2);
}
.event-icon {
  /* use the same visual footprint as file icons so text sits closer */
  font-size: var(--tile-icon-size);
  width: calc(var(--tile-icon-size) * 1.8);
  height: calc(var(--tile-icon-size) * 1.8);
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.event-item:hover .event-icon {
  opacity: 1;
}
.event-content {
  /* mirror .file-content so text truncation and spacing behave the same */
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0; /* allow ellipsis inside flex children */
  justify-content: center;
}
.event-content .event-date {
  font-size: 0.85em;
  color: #666;
  margin: 0;
}
.event-content h3 {
  margin: 0;
  font-size: var(--tile-title-size); /* match folder/file title size */
  color: #333;
  line-height: 1.25;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-content p {
  margin: 0;
  font-size: 0.9em;
  color: #777;
  line-height: 1.2;
}
.event-subtitle {
  font-size: 0.9em;
  color: #666;
  margin: 0;
  font-weight: normal;
}

/* Main content */
main {
  grid-area: main;
  background: var(--card-bg);
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e9ecef;
}
.main-header h2,
.main-header h3 {
  margin: 0;
  color: #2c3e50;
  font-weight: 600;
}
.main-header h2 {
  font-size: 1.8rem;
}
.main-header h3 {
  font-size: 1.6rem;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  justify-content: space-between;
}
.left-group {
  display: flex;
  align-items: center;
  gap: 15px;
}
.main-header .back-button,
.registration-button {
  display: inline-flex;
  align-items: center;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  color: white;
  white-space: nowrap;
}
.registration-button {
  padding: 10px 20px;
  font-size: 1rem;
}
.main-header .back-button {
  background: #6c757d;
}
.main-header .back-button:hover {
  background: #5a6268;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  flex-direction: row;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}
#breadcrumb {
  background: var(--card-bg);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin-bottom: 12px;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.breadcrumb-item {
  color: var(--pak-red);
  cursor: pointer;
  transition: color 0.2s ease;
  flex-shrink: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.breadcrumb-item:hover {
  color: var(--pak-red-dark);
  text-decoration: underline;
}
.breadcrumb-item.current {
  color: #6c757d;
  cursor: default;
  font-weight: 500;
}
.breadcrumb-item.current:hover {
  color: #6c757d;
  text-decoration: none;
}
.breadcrumb-separator {
  display: inline-flex;
  align-items: center;
  margin: 0 6px;
  flex: 0 0 auto;
}
@media (max-width: 700px) {
  .breadcrumb {
    gap: 6px;
  }
  #breadcrumb {
    padding: 6px 8px;
  }
  .breadcrumb-item {
    max-width: 120px;
  }
}

/* Welcome & Features */
.welcome {
  text-align: center;
  padding: 40px 20px;
}
.welcome h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 2rem;
}
.welcome p {
  color: #7f8c8d;
  font-size: 1.2rem;
  margin-bottom: 30px;
}
.event-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  text-align: center;
  max-width: 1000px;
  margin: 0 auto;
}
.event-info h3 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 1.8rem;
}
.event-info > p {
  color: #555;
  margin-bottom: 25px;
  font-size: 1.1rem;
  max-width: 600px;
  line-height: 1.7;
}
.features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 20px;
  width: 100%;
}
.feature-item {
  flex: 1 1 280px;
  max-width: 320px;
  min-width: 280px;
  background: white;
  padding: 25px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}
.feature-item h4 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.1rem;
}
.feature-item p {
  color: #7f8c8d;
  font-size: 0.9rem;
  margin: 0;
}

/* Event content */
.event-content h2 {
  color: #2c3e50;
  margin-bottom: 25px;
  font-size: 2rem;
  border-bottom: 3px solid var(--pak-red);
  padding-bottom: 10px;
}

/* Folder & file layout: consolidated and variable-driven */
.subfolder-list,
.file-list,
.files-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--card-gap);
  padding: 10px 0;
  justify-content: flex-start;
}

/* Base tile styles shared by folders and files */
.subfolder-list .event-item,
.file-list .file-button,
.files-list .file-button,
.file-button,
.event-item {
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: var(--card-gap);
  padding: var(--card-padding);
  height: var(--card-height);
  min-height: var(--card-min-height);
  background: var(--card-bg);
  border-radius: var(--card-radius);
  border: var(--card-border-muted);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  color: inherit;
  text-decoration: none;
}

/* Preferred widths */
.subfolder-list .event-item {
  /* Use the same dimensions and padding as file tiles so both lists match */
  flex: 0 0 var(--file-card-width);
  width: var(--file-card-width);
  max-width: var(--file-card-width);
  height: var(--card-height);
  min-height: var(--card-min-height);
  /* use the shared card padding variable so spacing is consistent */
  padding: var(--card-padding);
  gap: var(--card-gap);
  background: white;
  box-sizing: border-box;
  overflow: hidden; /* prevent content from making the box wider */
  margin-bottom: 0; /* container gap handles spacing between tiles; remove extra margin */
}

/* Make subfolder event tiles match file tiles more closely: tighten gap and ensure content flexes for ellipsis */
.subfolder-list .event-item {
  /* align visually with file tiles */
  align-items: center; /* vertically center like other tiles */
}

.subfolder-list .event-item .event-content,
.subfolder-list .event-item .file-content {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0; /* allow children to shrink so text-overflow works */
  overflow: hidden; /* ensure overflowing text is clipped inside */
}

/* Keep subfolder tiles uniform on larger screens, but on small screens
   make them full-width for readability */
@media (max-width: 520px) {
  .subfolder-list .event-item {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    padding: 10px !important;
  }
}
.file-list .file-button,
.files-list .file-button,
.file-button {
  flex: 0 0 var(--file-card-width);
  max-width: 360px;
  background: white;
  border: var(--card-border);
}

.subfolder-list .event-item h3,
.file-list .file-button .file-name,
.files-list .file-button .file-name {
  font-size: var(--tile-title-size-sm);
  margin: 0;
  /* slightly larger line-height to avoid clipped descenders (g, y, j) */
  line-height: 1.25;
}

/* Truncate long file and folder names with an ellipsis on a single line. */
.subfolder-list .event-item h3,
.file-list .file-button .file-name,
.files-list .file-button .file-name,
.file-content .file-name {
  display: block; /* ensure text-overflow works consistently */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Cap file-list titles so they truncate earlier and don't push the tile size */
.file-list .file-button .file-name,
.files-list .file-button .file-name {
  /* available = file width - 2*padding - icon width - gap (using 14px gap as default) */
  max-width: calc(
    var(--file-card-width) - (2 * var(--card-padding)) -
      (var(--tile-icon-size) * 1.6) - 14px
  );
  font-size: var(--tile-title-size);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .file-list .file-button .file-name,
  .files-list .file-button .file-name {
    max-width: 100% !important;
    font-size: 1rem !important;
  }
}

/* Make subfolder titles truncate earlier by capping the title width to the
   precise available space (folder width minus padding, icon and gap). This
   reduces the visible length before ellipsis. */
.subfolder-list .event-item h3 {
  /* available = file width - 2*padding - icon width - gap (shared math for both lists) */
  max-width: calc(
    var(--file-card-width) - (2 * var(--card-padding)) -
      (var(--tile-icon-size) * 1.8) - var(--card-gap)
  );
  font-size: var(--tile-title-size);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 520px) {
  .subfolder-list .event-item h3 {
    max-width: 100%;
    font-size: var(--tile-title-size-sm);
  }
}

.file-list .file-button .file-icon,
.files-list .file-button .file-icon,
.file-button .file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--tile-icon-size) * 1.8);
  height: calc(var(--tile-icon-size) * 1.8);
  line-height: 1;
  font-size: var(--tile-icon-size);
  flex: 0 0 calc(var(--tile-icon-size) * 1.8);
  text-align: center;
  margin: 0;
}

/* Ensure file-list icons keep their expected visual size (desktop default)
   but avoid overriding special variants like .register-button */
.file-button:not(.register-button) .file-icon,
.file-list .file-button:not(.register-button) .file-icon,
.files-list .file-button:not(.register-button) .file-icon {
  font-size: var(--tile-icon-size);
  width: calc(var(--tile-icon-size) * 1.6);
  height: calc(var(--tile-icon-size) * 1.6);
  flex: 0 0 calc(var(--tile-icon-size) * 1.6);
}

/* Normalize icon footprint and vertical alignment so event and file icons
   are visually identical regardless of parent alignment. Use variables so
   changing the root sizes scales everything consistently. */
.event-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--tile-icon-size) * 1.8);
  height: calc(var(--tile-icon-size) * 1.8);
  line-height: 1;
  font-size: var(--tile-icon-size);
  flex: 0 0 calc(var(--tile-icon-size) * 1.8);
  margin: 0;
  align-self: center; /* ensures vertical centering even when parent aligns items to flex-start */
}

.file-list .file-button .file-content,
.files-list .file-button .file-content,
.file-content {
  display: flex;
  gap: 4px;
  flex: 1;
  /* allow children to shrink so text-overflow: ellipsis works inside flex */
  min-width: 0;
}

.subfolder-list .event-item:hover,
.file-list .file-button:hover,
.files-list .file-button:hover,
.file-button:hover,
.event-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
  border-color: var(--pak-red);
}

@media (max-width: 520px) {
  .subfolder-list,
  .file-list,
  .files-list {
    grid-template-columns: 1fr;
  }
  .subfolder-list .event-item,
  .file-list .file-button,
  .files-list .file-button {
    height: auto;
    padding: 10px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }
  .subfolder-list .event-item .event-icon,
  .file-list .file-button .file-icon,
  .files-list .file-button .file-icon {
    font-size: var(--tile-icon-size-sm);
    width: calc(var(--tile-icon-size-sm) * 1.8);
    height: calc(var(--tile-icon-size-sm) * 1.8);
    flex: 0 0 calc(var(--tile-icon-size-sm) * 1.8);
  }
  .file-list .file-button .file-content,
  .files-list .file-button .file-content {
    align-items: flex-start;
    text-align: left;
  }
}

/* File list and file button styling */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px 0;
}
.file-button {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  background: var(--card-bg);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 60px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0;
}
.file-button:hover {
  background: #f4f5f6;
  border-color: var(--pak-red);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(185, 18, 36, 0.15);
  text-decoration: none;
  color: inherit;
}
.file-button .file-icon {
  /* match .event-icon visual footprint for consistent spacing */
  font-size: var(--tile-icon-size);
  width: calc(var(--tile-icon-size) * 1.8);
  height: calc(var(--tile-icon-size) * 1.8);
  text-align: center;
  flex-shrink: 0;
  opacity: 0.8;
  margin: 0;
  color: var(--pak-red);
}
.file-button:hover .file-icon {
  opacity: 1;
}
.file-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 4px;
}
.file-content .file-name {
  margin: 0 0 4px 0;
  font-size: var(--tile-title-size);
  font-weight: 500;
  color: #333;
  line-height: 1.3;
  text-align: left;
}
.file-content .file-action {
  margin: 0;
  font-size: 0.9em;
  color: #777;
  line-height: 1.2;
  text-align: left;
  opacity: 1;
}

/* Registration link styling (shown above file list when present) */
.register-section {
  margin-bottom: 12px;
}
.register-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(
    180deg,
    var(--pak-red) 0%,
    var(--pak-red-dark) 100%
  );
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(185, 18, 36, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.06);
  max-width: 480px;
}
.register-button .file-icon {
  font-size: calc(var(--tile-icon-size) * 1.2);
  color: #fff;
}
.register-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(185, 18, 36, 0.22);
}

/* File-list variant of the registration button */
.file-button.register-button {
  background: linear-gradient(
    180deg,
    var(--pak-red) 0%,
    var(--pak-red-dark) 100%
  );
  color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.file-button.register-button .file-icon {
  color: #fff;
}
.file-button.register-button .file-name,
.file-button.register-button .file-action {
  color: #fff;
}
.file-button.register-button .file-action {
  opacity: 0.95;
}
.file-button.register-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(185, 18, 36, 0.24);
}

/* Document list (legacy) */
.document-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.document-item {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.document-item:hover {
  border-color: var(--pak-red);
  box-shadow: 0 2px 8px rgba(185, 18, 36, 0.1);
}
.document-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s ease;
}
.document-link:hover {
  background-color: #f8f9fa;
  color: var(--pak-red);
}
.document-name {
  font-weight: 500;
}
.document-type {
  background: var(--pak-red);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  font-weight: 500;
}

/* Footer */
footer {
  grid-area: footer;
  position: relative;
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  overflow: hidden;
  color: #7f8c8d;
}

/* Misc */
a {
  color: inherit;
  text-decoration: none;
}
.no-events {
  text-align: center;
  padding: 30px;
  color: #6c757d;
  background: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
}

/* Loading animation */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--pak-red);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.error-message {
  background: #e74c3c;
  color: white;
  padding: 15px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: center;
}
.loading-message {
  background: #f8f9fa;
  border: 2px dashed var(--pak-red);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #2c3e50;
  animation: pulse 2s infinite;
}
.loading-message p {
  margin: 5px 0;
}
.loading-message small {
  color: #7f8c8d;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "sponsors" "nav" "main" "footer";
    padding: 10px;
    gap: 15px;
  }
  header {
    padding: 15px;
  }
  header h1 {
    font-size: 2rem;
  }
  header p {
    font-size: 1rem;
  }
  nav {
    padding: 15px;
    max-height: none;
  }
  .nav-header h2 {
    font-size: 1.3rem;
  }
  .event-item {
    padding: 12px;
    gap: 10px;
  }
  .event-icon {
    font-size: var(--tile-icon-size-sm);
    width: calc(var(--tile-icon-size-sm) * 1.8);
    height: calc(var(--tile-icon-size-sm) * 1.8);
    flex: 0 0 calc(var(--tile-icon-size-sm) * 1.8);
  }
  .event-content h3 {
    font-size: var(--tile-title-size-sm);
  }
  .event-content p {
    font-size: 0.85rem;
  }
  main {
    padding: 15px;
  }
  .main-header {
    padding: 15px;
    margin-bottom: 15px;
  }
  .main-header h2,
  .main-header h3 {
    font-size: 1.4rem;
  }
  .header-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .left-group {
    justify-content: flex-start;
    width: 100%;
  }
  .registration-button {
    order: 2;
    align-self: center;
    margin-top: 10px;
  }
  .breadcrumb {
    font-size: 0.8rem;
    margin-top: 8px;
    padding-top: 8px;
  }
  .back-button {
    padding: 8px 12px;
    font-size: 0.9rem;
  }
  .subfolder-item {
    padding: 15px;
  }
  .subfolder-item h4 {
    font-size: 1.1rem;
  }
  .files-list {
    gap: 8px !important;
  }
  .file-button {
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    padding: 12px 15px;
    height: auto !important;
    width: 100% !important;
    min-height: 60px;
    gap: 14px !important; /* slightly wider gap on mobile */
    margin: 0 !important;
  }
  .file-icon {
    font-size: var(--tile-icon-size-sm);
    flex-shrink: 0;
    margin-bottom: 0 !important;
  }
  .file-content {
    text-align: left !important;
    flex: 1;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }
  .file-content .file-name {
    font-size: var(--tile-title-size-sm) !important;
    margin-bottom: 2px !important;
    text-align: left !important;
  }
  .file-content .file-action {
    font-size: 0.8rem !important;
    text-align: left !important;
  }
  .registration-button {
    padding: 10px 15px;
    font-size: 0.9rem;
  }
  .content-wrapper {
    padding: 15px;
  }
  .main-content {
    padding: 20px;
  }
}
@media (max-width: 480px) {
  body {
    padding: 5px;
    gap: 10px;
  }
  header {
    padding: 10px;
  }
  header h1 {
    font-size: 1.6rem;
  }
  header p {
    font-size: 0.9rem;
  }
  nav {
    padding: 10px;
  }
  .nav-header h2 {
    font-size: 1.2rem;
  }
  .event-item {
    padding: 10px;
    gap: 8px;
  }
  .event-icon {
    font-size: var(--tile-icon-size-sm);
  }
  .event-content h3 {
    font-size: var(--tile-title-size-sm);
  }
  .event-content p {
    font-size: 0.8rem;
  }
  main {
    padding: 10px;
  }
  .main-header {
    padding: 10px;
    margin-bottom: 10px;
  }
  .main-header h2,
  .main-header h3 {
    font-size: 1.2rem;
  }
  .header-actions {
    flex-direction: column;
    gap: 8px;
  }
  .registration-button {
    margin-top: 8px;
  }
  .back-button {
    padding: 6px 10px;
    font-size: 0.85rem;
  }
  .subfolder-item {
    padding: 12px;
  }
  .subfolder-item h4 {
    font-size: 1rem;
  }
  .subfolder-item p {
    font-size: 0.8rem;
  }
  .files-list {
    gap: 8px !important;
  }
  .file-button {
    padding: 10px 12px;
    gap: 16px !important; /* larger touch spacing on very small screens */
    min-height: 55px;
    flex-direction: row !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin: 0 !important;
  }
  .file-icon {
    font-size: calc(var(--tile-icon-size-sm) * 1.2) !important;
    margin-bottom: 0 !important;
  }
  .file-content .file-name {
    font-size: var(--tile-title-size-sm) !important;
    margin-bottom: 1px !important;
  }
  .file-content .file-action {
    font-size: 0.75rem !important;
  }
  .feature-item {
    padding: 15px 10px;
  }
  .feature-item h4 {
    font-size: 0.95rem;
  }
  .feature-item p {
    font-size: 0.8rem;
  }
  .registration-button {
    padding: 8px 12px;
    font-size: 0.85rem;
  }
}

.file-inschrijven {
  background: linear-gradient(
    180deg,
    var(--pak-red) 0%,
    var(--pak-red-dark) 100%
  ) !important;
}
.file-inschrijven-name,
.file-inschrijven-action {
  color: #fff !important;
}

/* DEBUG: Temporary rules to verify mobile CSS is loading. Remove after verifying.
   On mobile widths this will add a visible outline and a large gap so you can tell
   if the stylesheet changes are active. */
@media (max-width: 768px) {
  .file-button {
    gap: 8px !important;
  }
}
@media (max-width: 480px) {
  .file-button {
    gap: 8px !important;
  }
}

/* Make folder buttons more compact: bring text closer to the icon */
.file-button.folder-button {
  gap: 8px; /* was 12px; reduces space between icon and text */
}
.file-button.folder-button .file-icon {
  width: 28px; /* slightly smaller icon container so text sits closer */
  text-align: center;
}

@media (max-width: 480px) {
  .file-button.folder-button {
    gap: 6px;
  }
  .file-button.folder-button .file-icon {
    width: 26px !important;
  }
}

/* Apply the same compact styling to regular file buttons */
.file-button:not(.folder-button) {
  gap: 8px;
}
.file-button:not(.folder-button) .file-icon {
  width: 28px;
  text-align: center;
}

@media (max-width: 480px) {
  .file-button:not(.folder-button) {
    gap: 6px;
  }
  .file-button:not(.folder-button) .file-icon {
    width: 26px !important;
  }
}

/* Compact registration button icon/text spacing */
.register-button,
.file-button.register-button {
  gap: 8px; /* bring label closer to icon */
}
.register-button .file-icon,
.file-button.register-button .file-icon {
  width: 28px;
  text-align: center;
}

@media (max-width: 480px) {
  .register-button,
  .file-button.register-button {
    gap: 6px;
  }
  .register-button .file-icon,
  .file-button.register-button .file-icon {
    width: 26px !important;
  }
}

/* Prevent file/folder tiles from overflowing their container on small screens
   (they previously used a fixed flex-basis via --file-card-width which can
   force them wider than the viewport). */
@media (max-width: 768px) {
  .subfolder-list .event-item,
  .file-list .file-button,
  .files-list .file-button,
  .file-button {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 520px) {
  .subfolder-list .event-item,
  .file-list .file-button,
  .files-list .file-button,
  .file-button {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* Fix: ensure symmetric horizontal padding on small screens so content doesn't hug the
   right edge. Apply to body and major containers for consistent spacing. */
@media (max-width: 768px) {
  body,
  header,
  nav,
  main,
  .content-wrapper,
  .main-content,
  #breadcrumb {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  #breadcrumb {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
}

@media (max-width: 480px) {
  body,
  header,
  nav,
  main,
  .content-wrapper,
  .main-content,
  #breadcrumb {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  #breadcrumb {
    padding-left: 6px !important;
    padding-right: 6px !important;
  }
}

/* Large screens: make file/folder tiles smaller for a denser layout */
@media (min-width: 1200px) {
  :root {
    /* make card tiles narrower and slightly shorter on wide screens */
    --file-card-width: 280px;
    /* keep slightly smaller cards but leave enough vertical room for descenders */
    --card-height: 72px;
    --card-min-height: 64px;
    --card-gap: 10px;
    /* slightly reduce title and icon sizing so text fits the smaller tiles */
    --tile-title-size: 1.02rem;
    --tile-title-size-sm: 0.92rem;
    --tile-icon-size: var(--tile-title-size);
    --tile-icon-size-sm: var(--tile-title-size-sm);
  }

  /* ensure existing tile selectors pick up the updated variables */
  .subfolder-list .event-item,
  .file-list .file-button,
  .files-list .file-button,
  .file-button {
    flex: 0 0 var(--file-card-width);
    width: var(--file-card-width);
    max-width: var(--file-card-width);
    height: var(--card-height);
    min-height: var(--card-min-height);
    gap: var(--card-gap);
    /* vertically center content to avoid clipping of descenders */
    align-items: center;
  }

  /* slightly tighten icon footprint on large screens */
  .file-list .file-button .file-icon,
  .files-list .file-button .file-icon,
  .file-button .file-icon,
  .event-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
    flex: 0 0 34px;
  }

  /* ensure titles have enough line-height so descenders are visible */
  .file-content .file-name,
  .subfolder-list .event-item h3,
  .file-list .file-button .file-name,
  .files-list .file-button .file-name {
    line-height: 1.35;
  }
}
