/* ==========================================================================
   Klio.IM - Módulo de Galería Multimedia del Sitio Web (Google Drive)
   ========================================================================== */

.gallery-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  box-sizing: border-box;
}

#gallery-grid-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  padding: 2px 4px 20px 2px;
  box-sizing: border-box;
}

/* Banner de Privacidad Estricta */
.gallery-privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg, 12px);
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgba(22, 101, 52, 0.04);
}

.gallery-privacy-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md, 8px);
  background: #dcfce7;
  color: #15803d;
  flex-shrink: 0;
}

.gallery-privacy-content {
  flex: 1;
  min-width: 0;
}

.gallery-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #15803d;
  margin-bottom: 2px;
}

.gallery-privacy-content strong {
  display: block;
  font-size: 13px;
  color: #14532d;
  margin-bottom: 2px;
}

.gallery-privacy-content p {
  margin: 0;
  font-size: 12px;
  color: #166534;
  line-height: 1.45;
}

/* Header del Módulo Galería en Topbar */
.gallery-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.gallery-head-actions .button {
  height: 32px;
  min-height: 32px;
  padding: 0 11px;
  font-size: 12px;
  gap: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  flex-shrink: 0;
}

.gallery-head-actions .button svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.gallery-head-drive-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  background: var(--white, #ffffff);
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-pill, 999px);
  font-size: 11.5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

@media (max-width: 1360px) {
  .gallery-head-drive-folder {
    display: none;
  }
}

@media (max-width: 1020px) {
  .gallery-head-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

.gallery-head-drive-pill:hover {
  border-color: var(--line, #e2eae9);
}

.gallery-head-drive-pill svg {
  flex-shrink: 0;
}

.gallery-head-drive-name {
  font-weight: 600;
  color: var(--ink, #19383d);
}

.gallery-head-drive-folder {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted, #526b70);
}

.gallery-head-drive-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #16a34a;
}

.gallery-head-drive-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
}

/* Tarjeta de Estado de Google Drive (opcional en cuerpo) */
.gallery-drive-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.gallery-drive-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 260px;
}

.gallery-drive-icon-wrap {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg, #f3f7f6);
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-md, 8px);
  flex-shrink: 0;
}

.gallery-drive-meta h3 {
  margin: 0 0 2px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #19383d);
}

.gallery-drive-meta p {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #526b70);
}

.gallery-drive-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Barra de Estadísticas Rápidas */
.gallery-stats-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gallery-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-pill, 999px);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink, #19383d);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.gallery-stat-pill .stat-num {
  font-weight: 700;
  color: var(--primary, #087e85);
}

/* Barra de Herramientas y Filtros */
.gallery-toolbar-card {
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-lg, 12px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.gallery-toolbar-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 440px;
}

.gallery-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted, #526b70);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.gallery-search-input {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-md, 8px);
  font-size: 12.5px;
  color: var(--ink, #19383d);
  background: var(--bg, #f3f7f6);
  outline: none;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.gallery-search-input:focus {
  border-color: var(--primary, #087e85);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--primary-glow, rgba(8, 126, 133, 0.16));
}

.gallery-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pestañas de Carpetas / Secciones */
.gallery-tabs-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
  border-top: 1px solid var(--line, var(--tint, #e7f5f3));
}

.gallery-folder-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gallery-folder-btn {
  padding: 4px 10px;
  border: 1px solid var(--line, #e2eae9);
  background: #ffffff;
  border-radius: var(--radius-sm, 6px);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted, var(--ink-secondary, #3d585c));
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.gallery-folder-btn:hover {
  background: var(--bg, #f3f7f6);
  border-color: var(--line, #e2eae9);
  color: var(--ink, #19383d);
}

.gallery-folder-btn.active {
  background: var(--primary, #087e85);
  border-color: var(--primary, #087e85);
  color: #ffffff;
  font-weight: 600;
}

.gallery-folder-btn .badge-count {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: var(--radius-lg, 12px);
  background: rgba(0, 0, 0, 0.08);
}

.gallery-folder-btn.active .badge-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Filtro de Formato (Imágenes / Videos) */
.gallery-type-pills {
  display: flex;
  align-items: center;
  background: var(--tint, #e7f5f3);
  padding: 2px;
  border-radius: var(--radius-sm, 6px);
  gap: 2px;
}

.gallery-type-btn {
  padding: 3px 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm, 6px);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted, #526b70);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-type-btn:hover {
  color: var(--ink, #19383d);
}

.gallery-type-btn.active {
  background: #ffffff;
  color: var(--primary, #087e85);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.gallery-svg-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}
.gallery-stat-pill .gallery-svg-icon {
  color: var(--primary, #087e85);
  stroke: var(--primary, #087e85);
}
.gallery-type-btn .gallery-svg-icon {
  color: var(--muted, #526b70);
  stroke: var(--muted, #526b70);
  transition: color 0.15s ease, stroke 0.15s ease;
}
.gallery-type-btn:hover .gallery-svg-icon {
  color: var(--ink, #19383d);
  stroke: var(--ink, #19383d);
}
.gallery-type-btn.active .gallery-svg-icon {
  color: var(--primary, #087e85);
  stroke: var(--primary, #087e85);
}
.gallery-folder-btn .gallery-svg-icon {
  color: var(--muted, #526b70);
  stroke: var(--muted, #526b70);
  transition: color 0.15s ease, stroke 0.15s ease;
}
.gallery-folder-btn:hover .gallery-svg-icon {
  color: var(--ink, #19383d);
  stroke: var(--ink, #19383d);
}
.gallery-folder-btn.active .gallery-svg-icon {
  color: #ffffff !important;
  stroke: #ffffff !important;
}

/* Rejilla de Medios Compacta (Idéntica a .profile-service-media-grid de Klio.IM) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  gap: 12px;
}

/* Tarjeta Multimedia de la Galería (Consistencia estricta con .profile-media-card) */
.gallery-media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.gallery-media-card:hover {
  border-color: color-mix(in srgb, var(--primary, #087e85) 45%, var(--line, #e2eae9));
  box-shadow: 0 4px 14px var(--primary-glow, rgba(8, 126, 133, 0.16)), 0 2px 6px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

.gallery-media-card.is-selected,
.gallery-media-card.is-active,
.gallery-media-card[aria-selected="true"] {
  border-color: var(--primary, #087e85) !important;
  box-shadow: 0 0 0 2px var(--primary, #087e85), 0 4px 16px var(--primary-glow, rgba(8, 126, 133, 0.16)) !important;
}

.gallery-media-card.is-selected .profile-media-info-bar,
.gallery-media-card.is-active .profile-media-info-bar {
  background: linear-gradient(180deg, #ffffff 0%, var(--tint-subtle, var(--tint, #f1f8f7)) 100%);
}

.gallery-media-card .profile-media-zoom-hint {
  background: color-mix(in srgb, var(--primary-dark, #075f66) 82%, rgba(15, 23, 42, 0.78)) !important;
  color: #ffffff !important;
}

/* Contenedor de Miniatura Compacta Estándar (115px) */
.gallery-media-card .profile-media-thumb-container {
  position: relative;
  width: 100%;
  height: 115px;
  background: var(--bg, #f3f7f6);
  overflow: hidden;
}

.gallery-media-card .profile-media-thumb-frame {
  width: 100%;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: transparent;
  border: none;
  padding: 0;
}

.gallery-media-card .profile-media-thumb-frame img,
.gallery-media-card .profile-media-thumb-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Barra de información de la tarjeta */
.gallery-media-card .profile-media-info-bar {
  padding: 7px 7px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #ffffff;
  border-top: 1px solid var(--line, #e2eae9);
}

/* Acciones flotantes compactas en miniatura (evita que se corten los iconos en los bordes) */
.gallery-media-card .profile-media-quick-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 5;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  max-width: calc(100% - 10px);
  justify-content: flex-end;
}

.gallery-media-card .profile-media-thumb-container:hover .profile-media-quick-actions {
  opacity: 1;
  transform: translateY(0);
}

.gallery-media-card .media-btn-circle {
  width: 23px;
  height: 23px;
  min-width: 23px;
  min-height: 23px;
  padding: 0;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink, #19383d);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: all 0.12s ease;
}

.gallery-media-card .media-btn-circle .icon,
.gallery-media-card .media-btn-circle svg {
  width: 11.5px;
  height: 11.5px;
  stroke-width: 2;
}

.gallery-media-card .media-btn-circle:hover:not(.danger) {
  background: #ffffff;
  color: var(--primary, #087e85);
  border-color: var(--primary, #087e85);
  box-shadow: 0 2px 6px var(--primary-glow, rgba(8, 126, 133, 0.2));
  transform: scale(1.08);
}

.gallery-media-card .media-btn-circle.danger:hover {
  background: var(--danger, #ef4444);
  color: #ffffff;
  border-color: var(--danger, #ef4444);
}

/* Fila de etiquetas (Consultorios / Drive / Video) alineadas ordenadamente abajo de la miniatura */
.gallery-card-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.gallery-card-chips .media-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 9px;
  font-weight: 700;
  padding: 1.5px 5.5px;
  border-radius: var(--radius-xs, 4px);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--tint, #e7f5f3);
  color: var(--primary-dark, var(--primary, #087e85));
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 24%, transparent);
  line-height: 1.35;
  transition: all 0.15s ease;
}

.gallery-card-chips .media-chip.chip-drive {
  background: #0284c7;
  color: #ffffff;
  border: none;
}

.gallery-card-chips .media-chip.chip-video {
  background: #ea580c;
  color: #ffffff;
  border: none;
}

/* Título y sublínea de la tarjeta */
.gallery-media-card .profile-media-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #19383d);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.35;
}

.gallery-card-subline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted, #526b70);
  margin-top: 1px;
}

/* Barra de botones de acción inferior compacta y armónica */
.gallery-card-actions-row {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--line, var(--tint, #e7f5f3));
}

.gallery-action-btn {
  flex: 1 1 0;
  min-width: 0;
  font-size: 10px !important;
  font-weight: 600 !important;
  padding: 2px 3px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 2.5px !important;
  height: 25px !important;
  min-height: 25px !important;
  white-space: nowrap !important;
  border-radius: var(--radius-sm, 6px) !important;
  letter-spacing: -0.2px !important;
  box-sizing: border-box !important;
  transition: all 0.15s ease;
}

.gallery-action-btn span {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1;
}

.gallery-action-btn:hover {
  color: var(--primary, #087e85);
  background: var(--tint, #e7f5f3);
  border-color: color-mix(in srgb, var(--primary, #087e85) 35%, var(--line, #e2eae9));
}

.gallery-action-btn:hover .icon,
.gallery-action-btn:hover svg {
  color: var(--primary, #087e85);
  stroke: var(--primary, #087e85);
}

.gallery-action-btn .icon,
.gallery-action-btn svg {
  width: 11px !important;
  height: 11px !important;
  stroke-width: 2.2 !important;
  flex-shrink: 0 !important;
}

.gallery-action-btn-dup,
.gallery-action-btn-del {
  width: 23px !important;
  min-width: 23px !important;
  max-width: 23px !important;
  height: 25px !important;
  min-height: 25px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  border-radius: var(--radius-sm, 6px) !important;
  color: var(--muted, #526b70);
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  cursor: pointer;
  transition: all 0.15s ease;
}

.gallery-action-btn-dup:hover {
  color: var(--primary, #087e85);
  background: var(--tint, #e7f5f3);
  border-color: var(--primary, #087e85);
}

.gallery-action-btn-dup:disabled,
.gallery-action-btn-dup.loading {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.gallery-action-btn-dup .icon,
.gallery-action-btn-dup svg {
  width: 11px !important;
  height: 11px !important;
  stroke-width: 2 !important;
}

.gallery-action-btn-del:hover {
  color: var(--danger, #dc2626) !important;
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
}

.gallery-action-btn-del .icon,
.gallery-action-btn-del svg {
  width: 11px !important;
  height: 11px !important;
  stroke-width: 2 !important;
}

/* Estados Vacíos */
.gallery-empty-card {
  text-align: center;
  padding: 44px 20px;
  background: #ffffff;
  border: 1px dashed var(--line, #e2eae9);
  border-radius: var(--radius-lg, 12px);
  color: var(--muted, #526b70);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.gallery-empty-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--tint, #e7f5f3);
  display: grid;
  place-items: center;
  color: var(--muted, #526b70);
  margin-bottom: 2px;
}

.gallery-empty-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #19383d);
  margin: 0;
}

.gallery-empty-card p {
  font-size: 12.5px;
  max-width: 400px;
  margin: 0;
  line-height: 1.5;
}

/* Modal de Vista Previa (Lightbox) */
#modal.gallery-preview-dialog {
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 32%, var(--line, #e2eae9));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--primary-glow, rgba(8, 126, 133, 0.16));
}

#modal.gallery-preview-dialog .modal-header {
  border-bottom: 1px solid color-mix(in srgb, var(--primary, #087e85) 20%, var(--line, #e2eae9));
  background: linear-gradient(180deg, #ffffff 0%, var(--tint-subtle, var(--bg, #f3f7f6)) 100%);
}

#modal.gallery-preview-dialog .modal-header h2 {
  color: var(--primary-dark, var(--primary, #087e85));
}

.gallery-preview-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
}

.gallery-preview-media-box {
  width: 100%;
  background: #090d16;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 65vh;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.gallery-preview-media-box img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  display: block;
}

.gallery-preview-media-box video {
  width: 100%;
  max-height: 65vh;
  outline: none;
}

.gallery-preview-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--tint-subtle, var(--bg, #f3f7f6));
  border-radius: var(--radius-md, 8px);
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 20%, var(--line, #e2eae9));
  font-size: 12px;
}

.gallery-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gallery-preview-actions .button.primary {
  background: var(--primary, #087e85);
  border-color: var(--primary, #087e85);
  color: #ffffff;
}

.gallery-preview-actions .button.primary:hover {
  background: var(--primary-dark, #075f66);
  border-color: var(--primary-dark, #075f66);
}

.gallery-preview-actions .button:not(.primary):hover {
  color: var(--primary, #087e85);
  background: var(--tint, #e7f5f3);
  border-color: color-mix(in srgb, var(--primary, #087e85) 40%, var(--line, #e2eae9));
}

/* Modal de Carga de Medios */
.gallery-upload-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gallery-upload-dropzone {
  border: 2px dashed var(--line, #e2eae9);
  border-radius: var(--radius-md, 8px);
  padding: 24px 14px;
  text-align: center;
  background: var(--bg, #f3f7f6);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}

.gallery-upload-dropzone:hover,
.gallery-upload-dropzone.dragover {
  border-color: var(--primary, #087e85);
  background: var(--tint, #e6f7f5);
}

.gallery-upload-preview {
  margin-top: 10px;
  max-height: 140px;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  display: none;
  background: #000;
}

.gallery-upload-preview img,
.gallery-upload-preview video {
  width: 100%;
  max-height: 140px;
  object-fit: contain;
  display: block;
}

/* ==========================================================================
   Editor Profesional de Imágenes y Video (Klio.IM Image & Video Studio Ultra)
   ========================================================================== */

#modal.gallery-editor-dialog {
  width: min(1280px, calc(100vw - 28px));
  max-width: 1280px;
  height: min(94vh, 900px);
  display: flex;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 30%, var(--line, #e2eae9));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--primary-glow, rgba(8, 126, 133, 0.16));
}

#modal.gallery-editor-dialog .modal-header {
  border-bottom: 1px solid color-mix(in srgb, var(--primary, #087e85) 20%, var(--line, #e2eae9));
  background: linear-gradient(180deg, #ffffff 0%, var(--tint-subtle, var(--bg, #f3f7f6)) 100%);
}

#modal.gallery-editor-dialog .modal-header h2 {
  color: var(--primary-dark, var(--primary, #087e85));
}

#modal.gallery-editor-dialog .modal-scroll-body {
  flex: 1;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#modal.gallery-editor-dialog .form-actions {
  display: none; /* Las acciones de guardado están integradas dentro del workspace */
}

.gallery-editor-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 360px;
  background: var(--bg, #f3f7f6);
  overflow: hidden;
}

@media (max-width: 900px) {
  .gallery-editor-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    overflow-y: auto;
  }
}

/* Viewport Central del Editor (Canvas / Video) */
.gallery-editor-viewport {
  background: #090d16;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--ink, #19383d);
}

.gallery-editor-viewport-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

.gallery-editor-viewport-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-tool-btn {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 5px 12px;
  border-radius: var(--radius-sm, 6px);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.editor-tool-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.45);
  color: #ffffff;
}

/* Botón Rejilla: mucho más notorio y visible con estado activo vibrante */
.editor-tool-btn.btn-grid {
  background: rgba(8, 126, 133, 0.2);
  border-color: rgba(8, 126, 133, 0.6);
  color: var(--tint, #e7f5f3);
}

.editor-tool-btn.btn-grid:hover {
  background: rgba(8, 126, 133, 0.35);
  border-color: #0dc5ce;
  color: #ffffff;
}

.editor-tool-btn.btn-grid.active {
  background: var(--primary, #087e85) !important;
  border-color: color-mix(in srgb, var(--primary, #087e85) 70%, #ffffff) !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 0 12px var(--primary-glow, rgba(8, 126, 133, 0.65)), 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Botón Comparar: feedback interactivo al pulsar o alternar */
.editor-tool-btn.btn-compare {
  background: rgba(225, 29, 72, 0.18);
  border-color: rgba(225, 29, 72, 0.5);
  color: #ffe4e6;
}

.editor-tool-btn.btn-compare:hover {
  background: rgba(225, 29, 72, 0.3);
  border-color: #fb7185;
  color: #ffffff;
}

.editor-tool-btn.btn-compare.active {
  background: #e11d48 !important;
  border-color: #f43f5e !important;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.7), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.editor-dim-indicator {
  font-size: 11.5px;
  color: var(--muted-light, #7b9296);
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.gallery-canvas-container {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.gallery-editor-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-xs, 4px);
  background: #000000;
  display: block;
}

/* Overlay interactivo de recorte con cursor y manijas */
.gallery-crop-overlay {
  position: absolute;
  pointer-events: none;
  user-select: none;
  touch-action: none;
  z-index: 15;
}

.crop-backdrop {
  position: absolute;
  background: rgba(10, 15, 26, 0.62);
  pointer-events: auto;
  cursor: crosshair;
}

.crop-box {
  position: absolute;
  outline: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.crop-box:hover {
  outline-color: #38bdf8;
}

.crop-box.grabbing,
.crop-box.dragging {
  cursor: grabbing !important;
  outline-color: #0dc5ce !important;
}

/* Rejilla de tercios de composición de alto contraste */
.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: none;
}

.crop-box.show-grid .crop-grid-lines {
  display: block;
}

.crop-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 1.5px rgba(0, 0, 0, 0.95);
}

.crop-grid-h1 { top: 33.333%; left: 0; right: 0; height: 1px; }
.crop-grid-h2 { top: 66.666%; left: 0; right: 0; height: 1px; }
.crop-grid-v1 { left: 33.333%; top: 0; bottom: 0; width: 1px; }
.crop-grid-v2 { left: 66.666%; top: 0; bottom: 0; width: 1px; }

/* Etiqueta flotante con dimensiones del recorte (posicionada arriba adentro del recuadro para no cortarse jamás) */
.crop-dimension-tag {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
  padding: 3px 11px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  pointer-events: none;
  display: block;
  z-index: 25;
  backdrop-filter: blur(4px);
}

/* Manijas de ajuste de esquinas y bordes con cursor manual */
.crop-handle {
  position: absolute;
  background: #ffffff;
  border: 1.5px solid var(--primary, #087e85);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  z-index: 20;
  border-radius: 2px;
  transition: transform 0.1s ease, background 0.1s ease;
}

.crop-handle:hover {
  transform: scale(1.3);
  background: var(--tint, #e7f5f3);
  border-color: #0dc5ce;
}

.crop-handle-nw { top: -5px; left: -5px; width: 10px; height: 10px; cursor: nwse-resize; }
.crop-handle-ne { top: -5px; right: -5px; width: 10px; height: 10px; cursor: nesw-resize; }
.crop-handle-se { bottom: -5px; right: -5px; width: 10px; height: 10px; cursor: nwse-resize; }
.crop-handle-sw { bottom: -5px; left: -5px; width: 10px; height: 10px; cursor: nesw-resize; }

.crop-handle-n { top: -4px; left: calc(50% - 12px); width: 24px; height: 6px; cursor: ns-resize; }
.crop-handle-s { bottom: -4px; left: calc(50% - 12px); width: 24px; height: 6px; cursor: ns-resize; }
.crop-handle-w { left: -4px; top: calc(50% - 12px); width: 6px; height: 24px; cursor: ew-resize; }
.crop-handle-e { right: -4px; top: calc(50% - 12px); width: 6px; height: 24px; cursor: ew-resize; }

/* En proporciones fijas se ocultan las manijas laterales y se mantienen las de esquinas */
.crop-box.fixed-ratio .crop-handle-n,
.crop-box.fixed-ratio .crop-handle-s,
.crop-box.fixed-ratio .crop-handle-w,
.crop-box.fixed-ratio .crop-handle-e {
  display: none;
}

/* Badge flotante de visualización del original */
.compare-floating-badge {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: #e11d48;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 14px;
  border-radius: var(--radius-pill, 999px);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.4);
  z-index: 25;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulseCompare 1.5s infinite;
}

@keyframes pulseCompare {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.88; transform: translateX(-50%) scale(0.97); }
}

.gallery-editor-viewport-footer {
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  color: var(--muted-light, #7b9296);
  text-align: center;
}

/* Barra Lateral de Herramientas (Sidebar) */
.gallery-editor-sidebar {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.gallery-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--line, #e2eae9);
  background: var(--bg, #f3f7f6);
  padding: 0 4px;
}

.sidebar-tab-btn {
  flex: 1;
  padding: 10px 4px;
  border: none;
  background: transparent;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted, #526b70);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.sidebar-tab-btn:hover {
  color: var(--ink, #19383d);
}

.sidebar-tab-btn.active {
  color: var(--primary, #087e85);
  border-bottom-color: var(--primary, #087e85);
  background: #ffffff;
}

.gallery-sidebar-panels {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
}

.sidebar-panel {
  display: none;
}

.sidebar-panel.active {
  display: block;
}

.sidebar-section-title {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #19383d);
  margin-bottom: 8px;
}

/* Controles Deslizantes (Sliders) */
.slider-control {
  margin-bottom: 12px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #19383d);
  margin-bottom: 4px;
}

.slider-val {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary, #087e85);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.slider-control input[type="range"] {
  width: 100%;
  height: 5px;
  border-radius: var(--radius-xs, 4px);
  background: transparent;
  outline: none;
  cursor: pointer;
  padding: 0 !important;
  margin: 0 !important;
  border: none !important;
  box-shadow: none !important;
  accent-color: var(--primary, #087e85);
}

.checkbox-control {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #19383d);
  cursor: pointer;
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--bg, #f3f7f6);
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--line, #e2eae9);
  transition: all 0.15s ease;
}

.checkbox-control:hover {
  border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
  background: #ffffff;
}

.checkbox-control input[type="checkbox"] {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 32px !important;
  height: 18px !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--muted-light, #d1d5db) 60%, var(--line)) 0%, color-mix(in srgb, var(--muted-light, #d1d5db) 45%, var(--line)) 100%) !important;
  border: 1px solid color-mix(in srgb, var(--line) 80%, #000) !important;
  border-radius: var(--radius-pill, 999px) !important;
  position: relative !important;
  outline: none !important;
  cursor: pointer !important;
  transition: background 0.22s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.22s ease, box-shadow 0.22s ease !important;
  box-shadow: inset 0 1px 2px rgba(18, 56, 53, 0.16), 0 1px 0 rgba(255, 255, 255, 0.85) !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  display: inline-block !important;
  vertical-align: middle !important;
}

.checkbox-control input[type="checkbox"]::before {
  content: "" !important;
  position: absolute !important;
  top: 1px !important;
  left: 1px !important;
  width: 14px !important;
  height: 14px !important;
  border-radius: 50% !important;
  background: linear-gradient(180deg, #ffffff 0%, #f4f6f6 100%) !important;
  box-shadow: 0 1.2px 2.5px rgba(0, 0, 0, 0.25) !important;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}

.checkbox-control input[type="checkbox"]:checked {
  background: linear-gradient(180deg, var(--primary-dark, #075f66) 0%, var(--primary, #087e85) 100%) !important;
  border-color: color-mix(in srgb, var(--primary-dark) 85%, #000) !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.75) !important;
}

.checkbox-control input[type="checkbox"]:checked::before {
  transform: translateX(14px) !important;
}

.checkbox-control input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--primary, #087e85) !important;
  outline-offset: 2px !important;
}

/* Rejilla de Filtros Clínicos de 1 Clic */
.filter-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 10px;
  background: var(--bg, #f3f7f6);
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-md, 8px);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-btn:hover {
  background: #ffffff;
  border-color: var(--line, #e2eae9);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.preset-btn.active {
  background: var(--tint, #e7f5f3);
  border-color: var(--primary, #087e85);
  box-shadow: 0 0 0 1px var(--primary, #087e85);
}

.preset-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink, #19383d);
}

.preset-btn small {
  font-size: 10.5px;
  color: var(--muted, #526b70);
  margin-top: 2px;
}

/* Herramientas de Geometría y Recorte */
.geo-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.geo-btn-row .button {
  font-size: 11.5px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.aspect-ratio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ratio-btn {
  padding: 8px 10px;
  background: var(--bg, #f3f7f6);
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-sm, 6px);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-secondary, #3d585c);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.ratio-btn:hover {
  background: #ffffff;
  border-color: var(--line, #e2eae9);
}

.ratio-btn.active {
  background: var(--primary, #087e85);
  border-color: var(--primary, #087e85);
  color: #ffffff;
}

/* Caja de Guardado y Exportación */
.gallery-editor-export-box {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid var(--line, #e2eae9);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.02);
}

.export-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.export-actions-grid .button {
  width: 100%;
  font-size: 12px;
  padding: 6px 10px;
}

/* ==========================================================================
   Estudio de Video (Klio.IM Video Studio)
   ========================================================================== */
.gallery-video-viewport {
  justify-content: space-between;
}

.gallery-video-screen-container {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #000000;
}

.gallery-video-player-bar {
  background: rgba(15, 23, 42, 0.95);
  padding: 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-video-timeline-wrap {
  margin-bottom: 8px;
}

.video-scrubber-slider {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xs, 4px);
  accent-color: var(--primary, #087e85);
  cursor: pointer;
}

.video-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #526b70);
  font-family: ui-monospace, SFMono-Regular, monospace;
  margin-top: 3px;
}

.gallery-video-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.speed-selector {
  display: flex;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px;
  border-radius: var(--radius-sm, 6px);
  gap: 2px;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--muted, #526b70);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-xs, 4px);
  cursor: pointer;
}

.speed-btn:hover {
  color: #ffffff;
}

.speed-btn.active {
  background: var(--primary, #087e85);
  color: #ffffff;
}

.gallery-video-sidebar-card {
  padding: 14px;
  background: #ffffff;
  border-radius: var(--radius-md, 8px);
  border: 1px solid var(--line, #e2eae9);
}

/* ==========================================================================
   Modal de Información y Metadatos (Inspector)
   ========================================================================== */
#modal.gallery-info-dialog {
  width: min(680px, calc(100vw - 28px));
  max-width: 680px;
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 30%, var(--line, #e2eae9));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.22), 0 0 0 1px var(--primary-glow, rgba(8, 126, 133, 0.16));
}

#modal.gallery-info-dialog .modal-header {
  background: linear-gradient(180deg, #ffffff 0%, var(--tint-subtle, var(--bg, #f3f7f6)) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--primary, #087e85) 20%, var(--line, #e2eae9));
}

#modal.gallery-info-dialog .modal-header h2 {
  color: var(--primary-dark, var(--primary, #087e85));
}

.gallery-info-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gallery-info-header-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px;
  background: var(--tint-subtle, var(--bg, #f3f7f6));
  border-radius: var(--radius-md, 8px);
  border: 1px solid color-mix(in srgb, var(--primary, #087e85) 20%, var(--line, #e2eae9));
}

.gallery-info-thumb-wrap {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  background: #000;
  position: relative;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, var(--primary, #087e85) 40%, transparent);
}

.gallery-info-video-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 9px;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: var(--radius-xs, 4px);
  font-weight: 600;
}

.gallery-info-header-meta h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink, #19383d);
  word-break: break-all;
}

.gallery-info-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gallery-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 580px) {
  .gallery-info-grid {
    grid-template-columns: 1fr;
  }
}

.gallery-info-item {
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-sm, 6px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.15s ease;
}

.gallery-info-item:hover {
  border-color: color-mix(in srgb, var(--primary, #087e85) 40%, var(--line, #e2eae9));
  background: var(--tint, #e7f5f3);
}

.gallery-info-item.span-2 {
  grid-column: 1 / -1;
}

.info-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted, #526b70);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.info-val {
  font-size: 12.5px;
  color: var(--ink, #19383d);
}

.gallery-info-actions-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line, #e2eae9);
}

.button.danger-btn {
  color: var(--danger, #dc2626);
  border-color: #fecaca;
  background: #fff;
}

.button.danger-btn:hover {
  background: var(--danger-tint, #fef2f2);
  border-color: #f87171;
}

/* ==========================================================================
   Modal de Eliminación
   ========================================================================== */
.gallery-delete-modal-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 8px 0;
}

.gallery-delete-warning-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--danger-tint, #fef2f2);
  color: var(--danger, #dc2626);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gallery-delete-details {
  flex: 1;
}

.gallery-delete-file-preview {
  padding: 8px 12px;
  background: var(--bg, #f3f7f6);
  border: 1px solid var(--line, #e2eae9);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: 8px;
}

.gallery-delete-notice {
  font-size: 12px;
  color: var(--muted, #526b70);
  line-height: 1.5;
  margin: 0;
}

/* ==========================================================================
   LAYOUT ELÁSTICO VERTICAL ANCLADO AL VIEWPORT (MÓDULO GALERÍA)
   Filtros y estadísticas estáticas/fijas arriba, scroll exclusivo en imágenes
   ========================================================================== */
@media (min-width: 761px) {
  /* Contenedor principal de contenido: anclado al viewport sin scroll de ventana */
  .content.gallery-content,
  .content:has(.gallery-container) {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 12px 28px 14px 28px !important;
    box-sizing: border-box !important;
    gap: 0 !important;
  }

  .gallery-container {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Filtros, carpetas, estadísticas y buscador: 100% FIJOS / ESTÁTICOS arriba */
  .gallery-toolbar-card {
    flex-shrink: 0 !important;
    background: #ffffff !important;
    border: 1px solid var(--line, #e2eae9) !important;
    border-radius: var(--radius-lg, 12px) !important;
    padding: 12px 16px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03) !important;
    z-index: 5 !important;
  }

  /* El scroll ocurre EXCLUSIVAMENTE en el contenedor de las imágenes y videos */
  #gallery-grid-wrap {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable !important;
    padding: 2px 6px 20px 2px !important;
    box-sizing: border-box !important;
  }

  .gallery-grid {
    padding-bottom: 24px;
  }

  .gallery-empty-card {
    min-height: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
}

@media (max-width: 760px) {
  .content.gallery-content,
  .content:has(.gallery-container) {
    display: block !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 14px 14px 24px !important;
  }
  .gallery-container {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: block !important;
  }
  #gallery-grid-wrap {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}



/* ==========================================================================
   ADAPTACIÓN RESPONSIVE MÓVIL Y TABLET PARA GALERÍA Y EDITOR MULTIMEDIA
   ========================================================================== */
@media (max-width: 900px) {
  .gallery-editor-viewport-toolbar {
    flex-wrap: wrap !important;
    max-width: 100% !important;
    justify-content: center !important;
    gap: 6px !important;
  }
  .gallery-editor-sidebar {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 760px) {
  .content.gallery-content,
  .content:has(.gallery-container) {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    padding: 14px !important;
  }
  .gallery-container {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
}
