/**
 * Colorbox custom style — Consell Design System
 * Overrides plain style to match the site design.
 */

/* Overlay fosc — z-index alt per sobre toolbar admin */
#cboxOverlay {
  background: #000 !important;
  opacity: 0.92 !important;
  z-index: 100000 !important;
}

/* Container principal */
#colorbox {
  z-index: 100001 !important;
  outline: 0;
}

#cboxWrapper {
  overflow: visible !important;
}

/* Content area — posició relativa per botons absoluts */
#cboxContent {
  background: transparent;
  overflow: visible !important;
  position: relative;
}

#cboxLoadedContent {
  margin: 0;
  padding: 0;
  background: #000;
}

/* Imatge — cantonades suaus */
.cboxPhoto {
  border-radius: 4px;
}

/* ===== Títol (caption) ===== */
#cboxTitle {
  position: absolute;
  bottom: 0;
  left: 0;
  box-sizing: border-box;
  width: 100%;
  padding: 24px 16px 10px;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  font-family: var(--font-family-base);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 0;
  z-index: 2;
}

/* ===== Comptador (1 de N) ===== */
#cboxCurrent {
  position: absolute;
  bottom: -30px;
  left: 0;
  width: 100%;
  padding: 4px 0;
  color: rgba(255, 255, 255, 0.5);
  font-family: var(--font-family-base);
  font-size: 13px;
  font-weight: 400;
  text-align: center;
}

/* ===== Botó tancar — dins el modal, dalt dreta ===== */
#cboxClose {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  left: auto !important;
  width: 40px !important;
  height: 40px !important;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5) !important;
  color: #fff;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 10;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-indent: -9999px;
  overflow: hidden;
}

#cboxClose::after {
  content: '\00D7';
  position: absolute;
  text-indent: 0;
  font-size: 28px;
  line-height: 1;
  color: #fff;
}

#cboxClose:hover,
#cboxClose:focus {
  background: rgba(0, 0, 0, 0.75) !important;
}

/* ===== Botons anterior/següent — dins el modal, als costats ===== */
#cboxPrevious,
#cboxNext {
  position: absolute !important;
  top: 50% !important;
  transform: translateY(-50%);
  width: 44px !important;
  height: 44px !important;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4) !important;
  color: #fff;
  font-size: 0;
  cursor: pointer;
  transition: background 0.2s ease;
  z-index: 10;
  display: flex !important;
  align-items: center;
  justify-content: center;
  text-indent: -9999px;
  overflow: hidden;
}

#cboxPrevious::after,
#cboxNext::after {
  position: absolute;
  text-indent: 0;
  font-size: 28px;
  line-height: 1;
  color: #fff;
}

#cboxPrevious::after {
  content: '\2039';
  margin-right: 2px;
}

#cboxNext::after {
  content: '\203A';
  margin-left: 2px;
}

#cboxPrevious {
  left: 8px !important;
  right: auto !important;
}

#cboxNext {
  right: 8px !important;
  left: auto !important;
}

#cboxPrevious:hover,
#cboxPrevious:focus,
#cboxNext:hover,
#cboxNext:focus {
  background: rgba(0, 0, 0, 0.7) !important;
}

/* ===== Loading ===== */
#cboxLoadingOverlay {
  background: #000;
}

#cboxLoadingGraphic {
  background: none !important;
}

#cboxLoadingGraphic::after {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  margin: calc(50% - 20px) auto 0;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cbox-spin 0.8s linear infinite;
}

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

/* ===== Error ===== */
#cboxError {
  padding: 40px;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #111;
  font-family: var(--font-family-base);
  text-align: center;
}

/* ===== Responsive mòbil ===== */
@media (max-width: 768px) {
  #cboxPrevious,
  #cboxNext {
    width: 36px !important;
    height: 36px !important;
  }

  #cboxPrevious::after,
  #cboxNext::after {
    font-size: 22px;
  }

  #cboxClose {
    width: 34px !important;
    height: 34px !important;
  }

  #cboxClose::after {
    font-size: 22px;
  }
}
