/**
 * @file
 * GDI PDF Flipbook – component styles.
 *
 * These styles can be overridden by a custom theme. Copy only the rules you
 * need to change into "{theme}/css/gdi-pdf-flipbook-overrides.css" and
 * include that file in your theme's libraries definition.
 *
 * BEM-like class naming:  .gdi-pdf-flipbook__<element>--<modifier>
 */

/* ============================================================
   Trigger link
   ============================================================ */

.gdi-pdf-flipbook__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  cursor: pointer;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gdi-pdf-flipbook__trigger:hover,
.gdi-pdf-flipbook__trigger:focus-visible {
  text-decoration: none;
}

.gdi-pdf-flipbook__icon svg {
  display: block;
  fill: currentColor;
}

/* ============================================================
   Modal overlay
   ============================================================ */

.gdi-pdf-flipbook__modal {
  /* Full-viewport fixed overlay */
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gdi-pdf-flipbook__modal[hidden] {
  display: none;
}

/* Semi-transparent backdrop */
.gdi-pdf-flipbook__modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

/* Inner container on top of backdrop */
.gdi-pdf-flipbook__modal-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: 96vw;
  height: 96vh;
  max-width: 1400px;
  overflow: hidden;
  background: #1a1a1a;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Toolbar
   ============================================================ */

.gdi-pdf-flipbook__toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: #111;
  color: #e8e8e8;
  flex-shrink: 0;
  border-bottom: 1px solid #333;
}

.gdi-pdf-flipbook__page-info {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #ccc;
}

.gdi-pdf-flipbook__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border: none;
  background: transparent;
  color: #e8e8e8;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.gdi-pdf-flipbook__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.gdi-pdf-flipbook__btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.gdi-pdf-flipbook__btn svg {
  fill: currentColor;
}

/* ============================================================
   Flipbook stage (Vue mount point)
   ============================================================ */

.gdi-pdf-flipbook__stage {
  flex: 1;
  /* min-height:0 is required so that height:100% on children resolves
     correctly when the parent is a flex item (flex:1 does not give the
     item an explicit height in all browsers). */
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
}

/*
 * flipbook-vue requires you to set a size on the component element or its
 * .viewport child.  We size the Vue root element here so the width/height
 * context is correct for the library's internal layout logic.
 */
.gdi-pdf-flipbook__stage .gdi-flipbook-app,
.gdi-pdf-flipbook__stage > div {
  width: 100%;
  height: 100%;
}

/* The flipbook-vue .viewport sub-element */
.gdi-pdf-flipbook__stage .viewport {
  width: 100%;
  height: 100%;
}

/* Add page shadow for depth */
.gdi-pdf-flipbook__stage .bounding-box {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   Loading / error states
   ============================================================ */

.gdi-pdf-flipbook__loading,
.gdi-pdf-flipbook__error {
  color: #ccc;
  font-size: 1rem;
  padding: 2rem;
  text-align: center;
}

.gdi-pdf-flipbook__error {
  color: #f88;
}

/* ============================================================
   Responsive tweaks
   ============================================================ */

@media (max-width: 600px) {
  .gdi-pdf-flipbook__modal-inner {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}

/* ============================================================
   PDF Flipbook Card  (embedded via the CKEditor 5 plugin)
   ============================================================ */

.gdi-pdf-flipbook-card {
  display: inline-block;
  max-width: 220px;
  vertical-align: top;
  cursor: pointer;
  margin: 0.5rem;
}

.gdi-pdf-flipbook-card__inner {
  display: flex;
  flex-direction: column;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  transition: box-shadow 0.2s, transform 0.2s;
  outline: none;
}

.gdi-pdf-flipbook-card__inner:hover,
.gdi-pdf-flipbook-card__inner:focus {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.gdi-pdf-flipbook-card__cover-wrap {
  width: 100%;
  background: #f4f4f4;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  overflow: hidden;
}

.gdi-pdf-flipbook-card__cover {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.gdi-pdf-flipbook-card__info {
  padding: 0.5rem 0.75rem 0.6rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.gdi-pdf-flipbook-card__badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #c0392b;
}

.gdi-pdf-flipbook-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #222;
  line-height: 1.3;
  word-break: break-word;
}

/* ── Editor (CKEditor5 widget) styles ── */

.ck-editor .gdi-pdf-flipbook-card {
  cursor: default;
  max-width: 220px;
  width: 220px;
}

.ck-editor .gdi-pdf-flipbook-card__info {
  background: #f9f9f9;
  border-top: 1px solid #e8e8e8;
}
