@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root { --nav-h: 70px; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
  font-family: "Poppins", sans-serif;
  background: #f6f3ee;
  padding-top: var(--nav-h);
  overflow: hidden;
}

/* ===== Navbar (exact index.html style) ===== */
.navbar {
  position: fixed; top: 0; left: 0; width: 100%;
  background-color: #FFFFFF;
  z-index: 1200;
  padding: 1rem 2rem;
  display: flex; justify-content: center; gap: 2rem;
  transition: top 0.3s ease;
  animation: slideDown 0.5s ease-out;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.navbar, .navbar * { font-family: Arial, sans-serif !important; }
.navbar a {
  font-size: 1.25rem; color: #000000; text-decoration: none; cursor: pointer;
  transition: color 0.3s ease; white-space: nowrap;
}
.navbar a:hover { color: #d1e7a6; }
.navbar .logo {
  position: absolute; left: 2rem; top: 50%; transform: translateY(-50%);
  height: 60px;
}
.navbar.hidden { top: -70px; }

/* Dropdown */
.dropdown { position: relative; display: inline-block; padding-bottom: 0.5rem; }
.dropdown-content {
  display: none; position: absolute; background-color: #FFFFFF;
  min-width: 200px; box-shadow: 0 8px 16px rgba(0,0,0,0.2);
  border-radius: 4px; top: 100%; left: 0; z-index: 1300;
  padding: 4px 0;
}
.dropdown:hover > .dropdown-content { display: block; }
.dropdown.open > .dropdown-content { display: block; }
.dropdown-content a {
  font-size: 1rem; color: #000; padding: 12px 16px; text-decoration: none; display: block;
  transition: background-color 0.3s ease, color 0.3s ease; white-space: nowrap;
}
.dropdown-content a:hover { background-color: #f7f5ec; color: #8DB731; }

/* Stack first-level nested parents under Textile Auxiliaries */
.dropdown-content > .dropdown { display: block; }

/* Indent those parents slightly */
.dropdown-content > .dropdown > a {
  display: block;
  padding-left: 14px;
}

/* === EXACT index.html submenu spacing === */
.dropdown-content > .dropdown > .dropdown-content {
  top: 0;
  left: 100%;
  margin-left: -1px; /* tiny overlap, same as index.html */
  min-width: 200px;
  z-index: 1301;
}

/* Hover bridge to cross small gap */
.dropdown-content > .dropdown > .dropdown-content::before {
  content: "";
  position: absolute;
  left: -10px; /* extend into parent by 10px */
  top: 0;
  bottom: 0;
  width: 10px;
  background: transparent;
}

/* Optional bridge below panel */
.dropdown-content::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: -8px;
  height: 8px;
  background: transparent;
}

/* General nested fly-out support (deeper levels) */
.dropdown .dropdown { position: relative; }
.dropdown .dropdown > .dropdown-content {
  top: 0; left: 100%; margin-left: 4px; min-width: 200px;
}
.dropdown .dropdown .dropdown > .dropdown-content {
  top: 0; left: 100%; margin-left: 4px; min-width: 200px;
}

@keyframes slideDown { from { top: -70px; } to { top: 0; } }

/* ===== Flipbook stage ===== */
.stage { height: calc(100vh - var(--nav-h)); display: grid; place-items: center; }
.flipbook-wrap { display: grid; place-items: center; padding: 24px 12px 8px; }
.flipbook-container {
  width: 900px; height: 540px;
  transform-origin: center center; transition: transform 0.3s ease; cursor: auto;
  will-change: transform;
}
.flipbook { width: 900px; height: 540px; }
.flipbook .hard {
  background: #e8d8cb !important; color: #fff; font-weight: 700; border: none;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
}
.flipbook .hard small { font-style: italic; font-weight: 300; opacity: .8; font-size: 14px; }
.flipbook .page {
  background: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px;
  border: 1px solid rgba(0,0,0,.11); overflow: hidden;
}
.page .image-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; }
.page img { max-width: 100%; max-height: 100%; object-fit: contain; }
.flipbook .page small { font-size: 14px; margin-bottom: 10px; }

/* ==== Preview UI ==== */
.preview-tray {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: min(92vw,1100px); height: 140px; max-height: 32vh;
  overflow: auto; padding: 12px 42px; border-radius: 16px; 
  background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.06); box-shadow: 0 12px 34px rgba(0,0,0,.22);
  display: grid; grid-auto-flow: column; grid-auto-columns: 120px; gap: 12px; z-index: 1100;
}
.preview-tray[hidden] { display: none !important; }
.preview-thumb {
  position: relative; width: 100%; aspect-ratio: 3/4; overflow: hidden; border-radius: 12px;
  border: 1px solid rgba(0,0,0,.08); background: #f6f7f6; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.preview-thumb:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.16); }
.preview-thumb.active { border-color: #89bf45; box-shadow: 0 0 0 2px rgba(137,191,69,.25) inset; }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-thumb .num {
  position: absolute; top: 6px; left: 6px; font-size: 12px; line-height: 1;
  padding: 4px 7px; border-radius: 7px; color: #fff; background: rgba(0,0,0,.55); pointer-events: none;
}

/* Toggle button */
.preview-toggle {
  padding: 10px 14px; border: 0; border-radius: 999px; background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(0,0,0,.18);
  border: 1px solid rgba(0,0,0,.06); font-size: 14px; cursor: pointer; transition: transform .12s ease;
}
.preview-toggle:hover { transform: translateY(-1px); }
.preview-toggle::after { content: "▾"; display: inline-block; margin-left: 8px; transition: transform .18s ease; }
.preview-toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
.fixed-toggle {
  position: fixed; left: 16px; bottom: 16px; z-index: 1110;
}

/* Filmstrip arrows */
.preview-nav {
  position: fixed; bottom: 24px; width: 34px; height: 140px; z-index: 1110;
  display: none; place-items: center; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(6px);
  box-shadow: 0 8px 28px rgba(0,0,0,.18); cursor: pointer; font-size: 22px;
}
body.tray-open .preview-nav { display: grid; }
.preview-nav.prev { left: calc(50% - min(46vw,555px)); transform: translateX(-16px); }
.preview-nav.next { right: calc(50% - min(46vw,555px)); transform: translateX(16px); }

/* Loader */
.loader-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: #ffffff; transition: opacity 1s ease, visibility 1s ease;
}
.loader-overlay.hide { opacity: 0; visibility: hidden; }
.loader-logo { max-width: 180px; max-height: 180px; margin-bottom: 30px; display: block; }
.loader-spinner {
  width: 70px; height: 70px; border-radius: 50%;
  border: 6px solid rgba(137, 191, 69, 0.15); border-top-color: #89bf45;
  animation: spin 1s linear infinite;
}
.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1100px) {
  .flipbook-container, .flipbook { width: 92vw; height: calc(92vw * 0.6); }
}
@media (max-width:640px){
  .navbar { padding: 1rem; gap: 1rem; }
  .navbar a { font-size: 1rem; }
  .navbar .logo { height: 30px; }
  .dropdown-content { min-width: 140px; }
  .dropdown-content a { font-size: 0.9rem; padding: 8px 12px; }
  .dropdown .dropdown > .dropdown-content,
  .dropdown .dropdown .dropdown > .dropdown-content {
    position: static; box-shadow: none; margin-left: 0; min-width: 0;
  }
}
