/* =========================================
   Parregea Modal (clean, scoped, theme-safe)
   Brand:
   #fec90b (gold)  #cd4336 (red)  #2d2d2d (dark)  #c6c6c6 (gray)
   ========================================= */

.parregea-modal{
  --pg-gold:#fec90b;
  --pg-red:#cd4336;
  --pg-dark:#2d2d2d;
  --pg-gray:#c6c6c6;

  position: fixed;
  inset: 0;
  z-index: 999999; /* above most headers/footers */

  display: none;
  padding: 18px;

  /* center panel */
  place-items: center;
}

.parregea-modal.is-open{
  display: grid;
}

/* Backdrop */
.parregea-modal .parregea-modal-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.58);
}

/* Panel */
.parregea-modal .parregea-modal-panel{
  position: relative;
  z-index: 1;

  width: min(720px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);

  background: #fff;
  border-radius: 14px;
  overflow: hidden;

  box-shadow:
    0 2px 6px rgba(0,0,0,0.18),
    0 20px 60px rgba(0,0,0,0.32);

  display: flex;
  flex-direction: column;
}

/* Header */
.parregea-modal .parregea-modal-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 16px;
  background: #fff;
  border-bottom: 1px solid rgba(45,45,45,0.10);
}

.parregea-modal .parregea-modal-head-left{
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Cover */
.parregea-modal .parregea-modal-cover{
  width: 56px;
  height: 56px;
  flex: 0 0 56px;

  border-radius: 10px;
  overflow: hidden;

  background: #f2f2f2;
  border: 1px solid rgba(45,45,45,0.10);
}

.parregea-modal .parregea-modal-cover img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Title + sub */
.parregea-modal .parregea-modal-titlewrap{
  min-width: 0;
}

.parregea-modal .parregea-modal-title{
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--pg-dark);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.parregea-modal .parregea-modal-sub{
  margin-top: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(45,45,45,0.55);
}

/* Close button */
.parregea-modal .parregea-modal-close{
  appearance: none;
  -webkit-appearance: none;

  width: 40px;
  height: 40px;
  border-radius: 10px;

  border: 1px solid rgba(45,45,45,0.16);
  background: #fff;
  color: var(--pg-dark);

  cursor: pointer;
  font-size: 18px;
  line-height: 1;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  transition: background 140ms ease, border-color 140ms ease;
}

.parregea-modal .parregea-modal-close:hover{
  background: rgba(45,45,45,0.04);
  border-color: rgba(45,45,45,0.28);
}

.parregea-modal .parregea-modal-close:focus-visible{
  outline: 3px solid rgba(254,201,11,0.55);
  outline-offset: 2px;
}

/* Body */
.parregea-modal .parregea-modal-body{
  padding: 16px;
  overflow: auto; /* scroll inside panel if needed */
}

/* Actions */
.parregea-modal .parregea-modal-actions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.parregea-modal .parregea-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  height: 44px;
  padding: 0 14px;
  border-radius: 12px;

  font-weight: 900;
  font-size: 14px;
  text-decoration: none;

  border: 1px solid rgba(45,45,45,0.16);
  background: #fff;
  color: var(--pg-dark);

  white-space: nowrap;
  user-select: none;

  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease, filter 160ms ease;
}

.parregea-modal .parregea-btn:hover{
  transform: translateY(-1px);
  background: rgba(45,45,45,0.04);
  border-color: rgba(45,45,45,0.28);
}

/* Primary (PDF) */
.parregea-modal #parregeaModalRead{
  background: var(--pg-gold);
  color: var(--pg-dark);
  border-color: rgba(45,45,45,0.12);
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.parregea-modal #parregeaModalRead:hover{
  filter: brightness(1.02);
  box-shadow: 0 10px 22px rgba(0,0,0,0.16);
}

/* Secondary (archive) stays outlined */
.parregea-modal #parregeaModalArchive{
  background: #fff;
}

/* Responsive */
@media (max-width: 520px){
  .parregea-modal{
    padding: 12px;
  }

  .parregea-modal .parregea-modal-panel{
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .parregea-modal .parregea-btn{
    width: 100%;
  }

  .parregea-modal .parregea-modal-title{
    font-size: 16px;
  }

  .parregea-modal .parregea-modal-cover{
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }
}
