/* ==========================================================================
   Phoca Gallery 6 — tema «jardina.me» (v2)
   Verde bosque, marfil y piedra; tarjetas rectas como las del blog.
   Sustituye a theme_simple.css (despublicar «Simple» en Phoca → Estilos).
   ========================================================================== */

#phocagallery,
.com_phocagallery,
.com-phocagallery {
  --pg-green: #375543;
  --pg-green-dark: #2a4234;
  --pg-green-pale: #e8e5dc;
  --pg-green-soft: #efede7;
  --pg-accent: #9c4f60;
  --pg-ink: #2b3a31;
  --pg-muted: #6b5d4f;
  --pg-line: #e0ddd5;
  --pg-card: #efede7;
  --pg-radius: 8px;
  --pg-shadow: 0 0 0 1px #e0ddd5;
  --pg-shadow-hover: 0 0 0 1px #c9c4b8, 0 12px 28px rgba(43, 58, 49, .10);
}

#phocagallery { margin-bottom: 2rem; }
#phocagallery svg { vertical-align: middle; }

/* ---------- Cabecera de la vista --------------------------------------- */
#phocagallery .page-header h1 {
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: .25rem;
}
.pg-category-desc,
.pg-categories-desc {
  color: var(--pg-muted);
  max-width: 60ch;
  margin-bottom: 1.25rem;
}
.pg-top-icons {
  float: none;
  display: flex;
  justify-content: flex-end;
  margin: 0 0 .5rem;
}
.pg-top-icons + .ph-cb { display: none; }
.pg-top-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--pg-green-pale);
  transition: background .2s;
}
.pg-top-icons a:hover { background: var(--pg-green-soft); }

/* ---------- Iconos SVG -------------------------------------------------- */
.ph-si {
  width: 1.25em;
  height: 1.25em;
  margin: 0 .2em;
  fill: currentColor;
  vertical-align: middle;
}
.ph-si-feed { color: var(--pg-green); width: 1.1em; height: 1.1em; margin: 0; }
.ph-si-image,
.ph-si-category,
.ph-si-category-top-category { color: var(--pg-green); }
.ph-si-tab.ph-si-image { color: var(--pg-green); }
.ph-si-star { color: #f4b400; }
.ph-si-comment,
.ph-si-upload,
.ph-si-upload-multiple,
.ph-si-earth,
.ph-si-stats,
.ph-si-enabled { color: var(--pg-green); }
.ph-si-ytb,
.ph-si-trash,
.ph-si-disabled { color: var(--pg-accent); }
.ph-si-category-top-back,
.ph-si-detail-top-back { color: var(--pg-green); }
.ph-si-next-btn,
.ph-si-prev-btn { color: #fff; margin-bottom: .15em; }
.ph-si-tab { width: 1.1em; height: 1.1em; }

/* ---------- Rejilla ------------------------------------------------------ */
.pg-categories-items-box,
.pg-category-items-box {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 1.25rem;
  align-items: start;
  margin: .5rem 0 1.5rem;
}
@media (max-width: 575.98px) {
  .pg-categories-items-box,
  .pg-category-items-box {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }
}

/* ---------- Tarjeta (categoría o foto) --------------------------------- */
.pg-category-box,
.pg-item-box {
  position: relative;
  margin: 0;
  border: 0;
  border-radius: var(--pg-radius);
  background: var(--pg-card);
  box-shadow: var(--pg-shadow);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.pg-category-box:hover,
.pg-item-box:hover {
  transform: translateY(-3px);
  box-shadow: var(--pg-shadow-hover);
}
.pg-category-box figure,
.pg-item-box figure { margin: 0; }
.pg-item-box figcaption { display: none; }

/* Imagen: siempre 4:3, recortada, que llene la tarjeta */
.pg-category-box-image,
.pg-item-box-image {
  position: relative;
  aspect-ratio: 4 / 3;
  max-width: none !important;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--pg-green-pale);
  line-height: 0;
}
.pg-category-box-image img,
.pg-item-box-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
  transition: transform .5s ease;
}
.pg-category-box:hover .pg-category-box-image img,
.pg-item-box:hover .pg-item-box-image img { transform: scale(1.05); }

/* Sin foto (carpeta, volver, candado): icono verde sobre verde pálido */
.pg-svg-box {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  max-width: none !important;
  background: linear-gradient(135deg, var(--pg-green-pale), var(--pg-green-soft));
}
.pg-svg-box > a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.pg-svg-box svg,
.pg-svg-box .ph-si {
  width: 30% !important;      /* Phoca pone width/height en línea */
  height: auto !important;
  aspect-ratio: 1;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: var(--pg-green);
  opacity: .85;
}
.ph-si-category-medium,
.ph-si-back-medium,
.ph-si-lock-medium { background: transparent; color: var(--pg-green); }

/* Título bajo la imagen */
.pg-category-box-info,
.pg-item-box-info {
  position: static;
  margin: 0;
  padding: 0;
}
.pg-category-box-title,
.pg-item-box-title {
  position: static;
  display: flex;
  align-items: baseline;
  gap: .35rem;
  width: auto;
  padding: .7rem .9rem .8rem;
  background: transparent;
  border-radius: 0;
  color: var(--pg-green);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.2;
}
.pg-category-box-title > svg,
.pg-item-box-title > svg { display: none; }
#phocagallery .pg-category-box-title a,
#phocagallery .pg-item-box-title a,
.pg-category-box-title a,
.pg-item-box-title a {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--pg-green);
  text-decoration: none;
}
/* Las fotos empiezan en mayúscula; los nombres de usuario se respetan tal cual */
.pg-item-box-title a::first-letter { text-transform: uppercase; }
.pg-category-box-title a,
.pg-category-box-title a::first-letter { text-transform: none; }
#phocagallery .pg-category-box:hover .pg-category-box-title a,
#phocagallery .pg-item-box:hover .pg-item-box-title a { color: var(--pg-green-dark); }
/* Toda la tarjeta de categoría es clicable */
.pg-category-box-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}
.pg-item-box-title.pg-display-name-2 { background: transparent; }

/* Número de fotos: píldora verde */
.pg-category-box-count {
  flex: none;
  margin-left: auto;
  padding: .1rem .5rem;
  border-radius: 0;
  background: var(--pg-green-pale);
  color: var(--pg-green-dark);
  font-size: .75rem;
  font-weight: 600;
}

/* Descripción en la tarjeta (si se activa) */
.pg-category-box-description,
.pg-item-box-descripton {
  position: static;
  padding: 0 .9rem .8rem;
  color: var(--pg-muted);
  font-size: .85rem;
  white-space: pre-line;
}

/* Botones sobre la foto (ver, descargar…): aparecen al pasar el ratón */
.pg-item-box-icons-box {
  position: absolute;
  top: .6rem;
  right: .6rem;
  bottom: auto;
  display: flex;
  gap: .35rem;
  padding: 0;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s, transform .2s;
  z-index: 2;
}
.pg-item-box:hover .pg-item-box-icons-box,
.pg-item-box:focus-within .pg-item-box-icons-box {
  opacity: 1;
  transform: none;
}
@media (hover: none) {
  .pg-item-box-icons-box { opacity: 1; transform: none; }
}
.pg-item-box-icons-box a { line-height: 0; }
.pg-item-box-icons-box svg.ph-si {
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: .45rem;
  border-radius: 50%;
  color: var(--pg-green-dark);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
  transition: background .2s, color .2s;
}
.pg-item-box-icons-box a:hover svg.ph-si {
  background: var(--pg-green);
  color: #fff;
}

/* Valoración y etiquetas Nuevo / Destacado */
.pg-categories-box-rating,
.pg-category-box-rating {
  position: absolute;
  top: .6rem;
  right: .6rem;
  z-index: 2;
}
.pg-category-box-label-box {
  position: absolute;
  top: .6rem;
  left: .6rem;
  display: flex;
  gap: .3rem;
  z-index: 2;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #fff;
}
.pg-category-box-label-new,
.pg-category-box-label-hot {
  float: none;
  margin: 0;
  padding: .2rem .55rem;
  border-radius: 0;
}
.pg-category-box-label-new { background: var(--pg-green); }
.pg-category-box-label-hot { background: var(--pg-accent); }

.pg-item-box-stats-value { float: right; margin-right: .2em; }

/* ---------- Vista de detalle (ficha de la foto) ------------------------ */
.pg-detail-item-box { max-width: 960px; margin: 0 auto; }
.pg-detail-item-image-box {
  text-align: center;
  padding: 1rem;
  border-radius: var(--pg-radius);
  background: var(--pg-green-pale);
}
.pg-detail-item-image-box img {
  max-width: 100%;
  height: auto;
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(20, 50, 30, .18);
}
.pg-detail-item-desc-box {
  margin: 1.25rem 0 0;
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--pg-green);
  border-radius: 0 var(--pg-radius) var(--pg-radius) 0;
  background: #fff;
  box-shadow: var(--pg-shadow);
  color: var(--pg-ink);
  line-height: 1.6;
  white-space: pre-line;
}
.pg-detail-nav-box {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.25rem 0 2rem;
}
.pg-detail-nav-box .ph-left,
.pg-detail-nav-box .ph-right { float: none; }
.pg-detail-nav-box .ph-right { margin-left: auto; }
.pg-detail-nav-box .btn,
.ph-image-navigation {
  border-radius: 0;
  padding: .45rem 1.1rem;
  background: var(--pg-green);
  border-color: var(--pg-green);
}
.pg-detail-nav-box .btn:hover,
.ph-image-navigation:hover {
  background: var(--pg-green-dark);
  border-color: var(--pg-green-dark);
}

/* Comentarios */
.pg-cv-comment-img-box-comment,
#phocagallery-comments blockquote p { white-space: pre-line; }
#phocagallery-comments blockquote,
.pg-comment-box blockquote {
  margin: 0 0 1rem;
  padding: .9rem 1.1rem;
  border-radius: var(--pg-radius);
  background: var(--pg-green-pale);
}
.pg-comment-btn {
  border-color: var(--pg-line);
  border-radius: 6px;
  color: var(--pg-ink);
}
.pg-comment-btn:hover { background: var(--pg-green-pale); }

/* ---------- Ventana modal y paginación --------------------------------- */
#pgCategoryModal .modal-dialog { height: 90%; max-width: 70%; }
#pgCategoryModal .modal-content { height: 100%; border-radius: var(--pg-radius); overflow: hidden; }
#pgCategoryModalLabel { text-transform: capitalize; }

.com-phocagallery .form-select,
.com_phocagallery .form-select {
  width: auto;
  margin: 0 .5em;
  border-radius: 0;
}
.com-phocagallery .pagination,
.com_phocagallery .pagination {
  align-items: center;
  justify-content: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.com_phocagallery .pagination .page-link,
.com-phocagallery .pagination .page-link {
  border-radius: 0 !important;
  min-width: 2.25rem;
  text-align: center;
  color: var(--pg-green-dark);
}
.com_phocagallery .pagination .active > .page-link,
.com-phocagallery .pagination .active > .page-link,
.com_phocagallery .pagination .page-item.active .page-link {
  background: var(--pg-green);
  border-color: var(--pg-green);
  color: #fff;
}
@media (max-width: 768px) {
  .com-phocagallery form > .pagination,
  .com_phocagallery form > .pagination { flex-direction: column; }
}

/* ---------- Panel de usuario (tablas de administración) ---------------- */
.ph-adminlist { clear: both; margin: 1em auto; border-collapse: collapse; }
.ph-adminlist tr th,
.ph-adminlist tr td {
  border: 1px solid var(--pg-line);
  text-align: center;
  padding: .4em .6em;
}
.ph-adminlist tr th { background: var(--pg-green-pale); color: var(--pg-green-dark); }
.ph-adminlist-select-row { display: flex; justify-content: flex-end; }
.ph-adminlist-select-row .form-select { display: flex; }

/* ---------- Carga (puntos) --------------------------------------------- */
.ph-lds-ellipsis { display: inline-block; position: relative; width: 80px; height: 0; }
.ph-loading-text { text-align: center; }
.ph-loading-text .ph-lds-ellipsis { height: 50px; }
.ph-loading-hidden { display: none; }
.ph-lds-ellipsis div {
  position: absolute;
  top: 33px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--pg-green, #239945);
  animation-timing-function: cubic-bezier(0, 1, 1, 0);
}
.ph-lds-ellipsis div:nth-child(1) { left: 8px; animation: ph-lds-ellipsis1 .6s infinite; }
.ph-lds-ellipsis div:nth-child(2) { left: 8px; animation: ph-lds-ellipsis2 .6s infinite; }
.ph-lds-ellipsis div:nth-child(3) { left: 32px; animation: ph-lds-ellipsis2 .6s infinite; }
.ph-lds-ellipsis div:nth-child(4) { left: 56px; animation: ph-lds-ellipsis3 .6s infinite; }
@keyframes ph-lds-ellipsis1 { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes ph-lds-ellipsis3 { 0% { transform: scale(1); } 100% { transform: scale(0); } }
@keyframes ph-lds-ellipsis2 { 0% { transform: translate(0, 0); } 100% { transform: translate(24px, 0); } }

@media (prefers-reduced-motion: reduce) {
  .pg-category-box, .pg-item-box,
  .pg-category-box-image img, .pg-item-box-image img,
  .pg-item-box-icons-box { transition: none; }
  .pg-category-box:hover, .pg-item-box:hover { transform: none; }
  .pg-category-box:hover .pg-category-box-image img,
  .pg-item-box:hover .pg-item-box-image img { transform: none; }
}
