[hidden] {
    display: none !important;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* BODY */
.main {
  padding: 30px;
  flex: 1;
}

/* Page transition */
/* =============== */
#page-transition-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.95);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

#page-transition-overlay.is-visible {
  display: flex;
}

.page-transition-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ccc;
  border-top-color: #333;
  border-radius: 50%;
  animation: page-transition-spin 0.8s linear infinite;
}

.page-transition-actions {
  gap: 12px;
}
.page-transition-abandon {
  padding: 0.5rem 1.25rem;
  border: 1px solid #999;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

@keyframes page-transition-spin {
  to { transform: rotate(360deg); }
}

.page-transition-text {
  font-size: 1rem;
  color: #333;
  text-align: center;
  padding: 0 1rem;
}

.page-transition-retry {
  padding: 0.5rem 1.25rem;
  border: 1px solid #999;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Shared scrolling-text animation: used by the cookie banner (header-footer.css)
   and the MyFiles message banner (myfiles.css) */
@keyframes cookieScroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(-100%);
    }
}

/* LIST OF FILES — generic list/panel components shared by Documents, Tools, MyFiles, FamilyTree */
.list-band {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.list-toggle-btn {
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 1px solid #0f70d0;
  background: white;
  color: #0f70d0;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}
.list-toggle-btn:hover {
  background: #e8f0fb;
}
.list-band-text {
  font-size: 0.85rem;
  color: #555;
  cursor: pointer;
}

/* Generic collapse behavior. Any "<x>-layout" element toggled with "list-collapsed"
   (by initCollapsibleListPanel in script.js) collapses its grid to one column, and
   any of its children carrying "list-panel" is hidden. Module-specific column widths
   (grid-template-columns on the base "<x>-layout" class) stay in each module's own
   file — this rule only governs the collapsed state. */
.list-collapsed.list-collapsed {
  grid-template-columns: 1fr;
}
.list-collapsed .list-panel {
  display: none;
}

.list-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.8rem;
}
.list-item:hover {
  background: #e8f0fb;
}
.list-item.active {
  background: #d0e4f7;
  color: #0f70d0;
  font-weight: bold;
}
.list-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.list-item-filename {
  font-size: 0.8rem;
}
.list-item-ext {
  font-size: 0.75rem;
  color: #888;
  font-family: monospace;
}

/* Generic "order asc/desc" toggle button, reused by Documents, Tools, MyFiles, Vocabulary */
.list-order-toggle {
  padding: 4px 10px;
  border: 1px solid #0f70d0;
  background: white;
  color: #0f70d0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Generic filter controls (select + text input), used across Documents/Excel/Vocabulary/lists */
.filter-select {
  border: 1px solid #0f70d0;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.85rem;
}
.filter-text {
  flex: 1;
  min-width: 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.85rem;
}

/* Generic collapse groups in list of files */
.group-header { 
  display: flex; 
  align-items: center; 
  gap: 0.4em; 
  cursor: pointer; 
  font-weight: bold;
}

.group[data-level="1"] > .group-header {
  background: #0f70d0;
  color: white;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.group:not([data-level="1"]) > .group-header {
  background: #f5f5f5;
  color: #888;
  padding: 4px 12px;
  font-size: 0.8rem;
}

.group-toggle {
  flex: none;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1em;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.group-badge { 
  margin-left: auto; 
  font-size: 0.85em; 
  opacity: 0.7; 
}

.group-collapsed > .group-body { display: none; }

.group-label { 
  flex: 1; 
}

/* Generic row-count indicator, used by the Excel editor and Vocabulary */
.docs-row-count,
.vocab-row-count {
  font-size: 0.8em;
  display: inline-flex;
  align-items: center;
  color: var(--text-muted, #666);
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Generic number-input appearance reset (used by PDF zoom/page inputs, family tree zoom input) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Generic gallry for pictures and videos */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.gallery-item {
  position: relative;
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 4/3;
  background: #eee;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s;
}
.gallery-item:hover img {
  transform: scale(1.05);
}
.video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: white;
  text-shadow: 0 0 6px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* Responsive smartphone */
/* ===================== */
@media (max-width: 768px) {
  .docs-row-count,
  .vocab-row-count {
    flex: 0 0 auto;
  }

  .filter-text {
    flex: 1 1 0;
    min-width: 0;
  }

  /* NOTE: this selector is not scoped — it applies to every .filter-select on the
     page at this breakpoint, not only Vocabulary's, even though it originated in
     that section of the old single-file stylesheet. Kept as-is to preserve behavior. */
  .filter-select {
    flex: 0 1 auto;
    max-width: 33%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
} /* End of bloc @media (max-width: 768px) */
