/* File Gallery Styles - responsive across desktop, tablet, and mobile */

:root {
  --fg-overlay-bg: rgba(0,0,0,0.6);
  --fg-surface: #fff;
  --fg-header-bg: #f8fafc;
  --fg-border: #e5e7eb;
  --fg-text: #111827;
  --fg-muted: #6b7280;
  --fg-control-bg: rgba(0,0,0,0.45);
}

/* Overlay and modal */
.fg-overlay {
  position: fixed;
  inset: 0;
  background: var(--fg-overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 10px;
}

.fg-modal {
  background: var(--fg-surface);
  width: min(96vw, 1200px);
  max-height: 92vh;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  position: relative; /* ensures swipe zones are contained within modal */
}

/* Header */
.fg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--fg-header-bg);
  border-bottom: 1px solid var(--fg-border);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  position: relative;
}
.fg-title { font-weight: 600; color: var(--fg-text); }
.fg-count { font-size: 12px; color: var(--fg-muted); }

/* Close button - compact X */
.fg-close {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ef4444;
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  z-index: 2;
}
.fg-close:hover { filter: brightness(0.95); }

/* Content area */
.fg-content {
  position: relative;
  background: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fg-content iframe,
.fg-content img {
  width: 100%;
  height: 60vh;
  border: 0;
  object-fit: contain;
  background: #111;
}

/* Loading and fallback */
.fg-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
}
.fg-fallback {
  color: #e5e7eb;
  text-align: center;
  padding: 20px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
}

/* Controls */
.fg-controls {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  transform: translateY(-50%);
  z-index: 1;
}
.fg-nav {
  pointer-events: all;
  background: var(--fg-control-bg);
  color: #fff;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 8px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
/* swipe zones removed */
.fg-nav:hover { filter: brightness(1.1); }
.fg-nav-icon { display: block; }

/* Open-in-new-tab button shown on PDF fallback */
.fg-open {
  position: absolute;
  top: 10px;
  left: 14px;
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.15);
  z-index: 1;
}
.fg-open:hover { filter: brightness(1.1); }

/* View files button (outside modal, in details sections) */
.view-files-button {
  appearance: none;
  border: 1px solid #d1d5db !important;
  background: #f9fafb !important;
  color: #374151 !important;
  border-radius: 8px !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
}
.view-files-button .vf-icon { filter: grayscale(20%); }
.view-files-button:hover { background: #f3f4f6 !important; }

/* Responsive tweaks */
@media (max-width: 1024px) {
  .fg-content iframe,
  .fg-content img { height: 56vh; }
}

@media (max-width: 768px) {
  .fg-modal { width: 100%; max-height: 92vh; border-radius: 10px; }
  .fg-content iframe,
  .fg-content img { height: 50vh; }
  .fg-nav { width: 38px; height: 38px; }
  .fg-close { top: 8px; right: 8px; width: 28px; height: 28px; font-size: 15px; }
  /* Hide action buttons on mobile */
  .view-files-button,
  .download-all-button { display: none !important; }
}

@media (max-width: 480px) {
  .fg-modal { width: 100%; max-height: 90vh; border-radius: 8px; }
  .fg-content iframe,
  .fg-content img { height: 46vh; }
  .fg-nav { width: 34px; height: 34px; }
  .fg-close { width: 26px; height: 26px; font-size: 14px; }
}
