/* ==========================================================================
   CSS principal - Álbum de Fotos Premium (FOTOS-IA)
   ========================================================================== */

/* 1. Variables globales y de diseño (Tokens de Diseño) */
:root {
  --bg-primary: #080b11;
  --bg-secondary: rgba(17, 24, 39, 0.7);
  --bg-card: rgba(31, 41, 55, 0.45);
  
  --accent-gradient: linear-gradient(135deg, #7c3aed, #ec4899);
  --accent-gradient-hover: linear-gradient(135deg, #8b5cf6, #f43f5e);
  --accent-solid: #7c3aed;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #8b5cf6;
  
  --card-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --backdrop-blur: blur(12px);
  
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 2. Reset y Estilos Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-main);
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-body);
  min-block-size: 100dvb;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  inline-size: 8px;
  block-size: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 9999px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-solid);
}

/* 3. Encabezado de la Aplicación (Glassmorphism) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 11, 17, 0.8);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-block-end: 1px solid var(--border-color);
  padding-block: 1rem;
}

.header-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  max-inline-size: 1400px;
  margin-inline: auto;
  padding-inline: 1.5rem;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-emoji {
  font-size: 2.25rem;
  filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.4));
  animation: pulse 3s infinite ease-in-out;
}

.logo-text h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Selector de Layouts (Segmented Control) */
.view-controls {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.control-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.control-btn.active {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

/* Botón Admin */
.admin-trigger-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 8px 18px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 9999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.admin-trigger-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-focus);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.admin-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
  display: inline-block;
  transition: background-color var(--transition-fast);
}

.admin-status-dot.logged-in {
  background-color: #10b981;
  box-shadow: 0 0 10px #10b981;
}

/* 4. Contenedor de Galería Principal */
.gallery-wrapper {
  flex: 1;
  max-inline-size: 1400px;
  inline-size: 100%;
  margin-inline: auto;
  padding: 1.5rem;
}

.gallery-container {
  min-block-size: 300px;
  transition: all var(--transition-normal);
}

/* Estados de carga y vacío */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-block-size: 350px;
  text-align: center;
  gap: 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-solid);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.empty-state-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--backdrop-blur);
  padding: 3rem 2rem;
  border-radius: 20px;
  max-inline-size: 450px;
  box-shadow: var(--card-shadow);
}

.empty-state-emoji {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state-card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.empty-state-card p {
  color: var(--text-muted);
  font-size: 0.925rem;
  line-height: 1.5;
}

/* Elementos de la Galería (Fotos individuales) */
.gallery-item {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--transition-slow);
}

/* Hover de Galería */
.gallery-item:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow);
  border-color: rgba(255, 255, 255, 0.2);
}

.gallery-item:hover img {
  transform: scale(1.06);
}

/* Overlay de información hover */
.item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 11, 17, 0.9) 0%, rgba(8, 11, 17, 0.2) 60%, rgba(8, 11, 17, 0) 100%);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  transition: opacity var(--transition-normal);
  z-index: 2;
}

.gallery-item:hover .item-overlay {
  opacity: 1;
}

.item-info-title {
  display: none;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-info-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

.item-zoom-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(8, 11, 17, 0.6);
  backdrop-filter: var(--backdrop-blur);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: 1rem;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-normal);
}

.gallery-item:hover .item-zoom-icon {
  opacity: 1;
  transform: scale(1);
}

.item-zoom-icon:hover {
  background: var(--accent-solid);
}

/* 5. DIFERENTES LAYOUTS DE GALERÍA */

/* 5.1 Vista Mosaico (Grid) */
.gallery-container.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
}

.gallery-container.layout-grid .gallery-item {
  aspect-ratio: 1 / 1;
}

/* 5.2 Vista Masonry */
.gallery-container.layout-masonry {
  columns: 4 250px;
  column-gap: 1.25rem;
}

.gallery-container.layout-masonry .gallery-item {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  display: block;
}

.gallery-container.layout-masonry .gallery-item img {
  width: 100%;
  height: auto;
}

/* 5.3 Vista Carrusel */
.gallery-container.layout-carousel {
  display: flex;
  overflow-x: auto;
  gap: 1.5rem;
  padding-block: 2rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.gallery-container.layout-carousel .gallery-item {
  flex: 0 0 80%;
  max-width: 700px;
  aspect-ratio: 16 / 10;
  scroll-snap-align: center;
  box-shadow: var(--card-shadow);
}

@media (min-width: 768px) {
  .gallery-container.layout-carousel {
    padding-inline: 10%;
  }
  .gallery-container.layout-carousel .gallery-item {
    flex: 0 0 65%;
  }
}

/* 5.4 Vista Justificada */
.gallery-container.layout-justified {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.gallery-container.layout-justified .gallery-item {
  flex-grow: 1;
  height: 220px;
  min-width: 150px;
  max-width: 480px;
}

.gallery-container.layout-justified .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* 6. MODALES Y DIÁLOGOS NATIVOS */

dialog {
  border: none;
  background: transparent;
  color: var(--text-main);
  max-width: 100%;
  max-height: 100%;
}

/* Backdrop para Diálogos Modales */
dialog::backdrop {
  background-color: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* Animación de entrada de backdrop */
dialog[open]::backdrop {
  opacity: 1;
}

/* 6.1 Panel de Administración Dialog */
.admin-dialog-modal {
  width: 90%;
  max-width: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

dialog[open].admin-dialog-modal {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.dialog-content {
  padding: 2.25rem;
  max-height: 85dvh;
  overflow-y: auto;
  position: relative;
}

.dialog-close-top {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--transition-fast);
}

.dialog-close-top:hover {
  color: var(--text-main);
}

.dialog-section h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.5px;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

/* Formulario de Login */
.admin-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-group input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--border-focus);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.25);
}

.submit-btn {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border: none;
  padding: 14px;
  border-radius: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.submit-btn:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.submit-btn:active {
  transform: translateY(0);
}

.error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

/* Panel de Administración Interno */
.admin-dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dashboard-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  border-radius: 16px;
}

.dashboard-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.dashboard-card p {
  color: var(--text-muted);
  font-size: 0.825rem;
  line-height: 1.4;
  margin-bottom: 1.25rem;
}

.action-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 12px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--border-focus);
}

.scan-btn {
  border-color: rgba(124, 58, 237, 0.3);
}

.scan-btn:hover {
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
}

.upload-trigger-btn {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.3);
  color: #c084fc;
}

.upload-trigger-btn:hover {
  background: rgba(124, 58, 237, 0.25);
}

.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-block: 1rem;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.775rem;
  color: var(--text-muted);
}

.file-preview-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.file-preview-item.uploading {
  border-color: rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.05);
}

.file-preview-item.success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.05);
}

.file-preview-item.error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05);
}

.file-preview-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
  color: var(--text-main);
}

.upload-submit-btn {
  width: 100%;
}

.upload-submit-btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.2);
  border: 1px solid var(--border-color);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.status-banner {
  padding: 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.status-banner.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #10b981;
}

.status-banner.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.status-banner.info {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
}

.admin-dialog-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1.25rem;
  display: flex;
  justify-content: flex-end;
}

.logout-btn {
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.1);
}


/* 6.2 Lightbox (Visualizador Ampliado Completo) */
.lightbox-dialog {
  width: 100dvw;
  height: 100dvh;
  max-width: 100dvw;
  max-height: 100dvh;
  margin: 0;
  background: rgba(4, 5, 8, 0.95);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.lightbox-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Barra de herramientas Lightbox */
.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: linear-gradient(to bottom, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 100%);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
}

.lightbox-counter {
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.lightbox-filename {
  display: none;
  font-family: var(--font-display);
  font-size: 0.875rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toolbar-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 9999px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.toolbar-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.download-btn {
  background: var(--accent-gradient);
  border: none;
}

.download-btn:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.3);
}

.close-btn {
  aspect-ratio: 1/1;
  padding: 6px 12px;
}

.close-btn .toolbar-icon {
  font-size: 1.25rem;
  font-weight: 300;
}

/* Escenario central de la imagen */
.lightbox-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4rem 1rem 1rem 1rem;
  position: relative;
}

.lightbox-img-container {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.lightbox-img-container img {
  max-width: 100%;
  max-height: calc(100dvh - 120px);
  object-fit: contain;
  user-select: none;
  pointer-events: auto;
  border-radius: 4px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.lightbox-img-container img.loaded {
  transform: scale(1);
  opacity: 1;
}

/* Flechas de Navegación */
.nav-arrow {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  z-index: 10;
  transition: all var(--transition-fast);
}

.nav-arrow:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  color: var(--text-inverse);
}

.nav-arrow:active {
  transform: scale(0.95);
}

/* Responsive arrows for touchscreens */
@media (max-width: 768px) {
  .nav-arrow {
    position: absolute;
    bottom: 2rem;
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    background: rgba(8, 11, 17, 0.7);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .nav-arrow.prev {
    left: 1.5rem;
  }
  .nav-arrow.next {
    right: 1.5rem;
  }
  .lightbox-stage {
    padding-bottom: 6rem;
  }
  .lightbox-img-container img {
    max-height: calc(100dvh - 180px);
  }
}

/* 7. Animaciones */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(124, 58, 237, 0.3)); }
  50% { transform: scale(1.03); filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.6)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(124, 58, 237, 0.3)); }
}

/* 8. Adaptabilidad Móvil y Ajustes de Layout */
@media (max-width: 600px) {
  .header-container {
    padding-inline: 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  
  .logo-area {
    justify-content: center;
    margin-bottom: 0.25rem;
  }
  
  .view-controls {
    justify-content: space-between;
    width: 100%;
    border-radius: 12px;
  }
  
  .control-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 6px;
    font-size: 0.75rem;
  }
  
  .control-btn .btn-text {
    display: none; /* Oculta el texto en pantallas muy pequeñas, solo deja el icono */
  }
  
  .control-btn .btn-icon {
    font-size: 1.15rem;
  }
  
  .admin-actions {
    display: flex;
    justify-content: center;
  }
  
  .admin-trigger-btn {
    width: 100%;
    justify-content: center;
  }

  .gallery-wrapper {
    padding: 1rem;
  }
  
  .dialog-content {
    padding: 1.5rem;
  }
  
  .admin-dashboard-actions {
    gap: 1rem;
  }
}

/* ==========================================================================
   Fase 2: Estilos de Favoritos y Reordenación (Admin y Frontend)
   ========================================================================== */

/* 1. Destaque de fotos favoritas en frontend */
.gallery-item.is-favorite {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

.gallery-item.is-favorite:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.45);
}

.favorite-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  background: rgba(8, 11, 17, 0.75);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  color: #f59e0b; /* Dorado */
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  border: 1px solid rgba(245, 158, 11, 0.35);
  animation: pulse-star 3s infinite ease-in-out;
}

@keyframes pulse-star {
  0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.2)); }
  50% { transform: scale(1.08); filter: drop-shadow(0 0 8px rgba(245, 158, 11, 0.5)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.2)); }
}

/* 2. Rejilla administrativa para gestionar fotos */
.admin-manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 14px;
  border: 1px solid var(--border-color);
  margin-top: 0.75rem;
}

.manage-item {
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: grab;
  user-select: none;
  touch-action: none; /* Previene scroll nativo al reordenar */
  transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.manage-item:active {
  cursor: grabbing;
}

.manage-item.dragging {
  opacity: 0.3;
  border: 2px dashed var(--border-focus);
  transform: scale(0.95);
}

.manage-thumb-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.manage-thumb-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none; /* Permite arrastrar el div contenedor en vez de la imagen */
}

/* Controles flotantes en la miniatura de gestión */
.manage-controls {
  position: absolute;
  inset: 0;
  background: rgba(8, 11, 17, 0.4);
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 6px;
  transition: opacity var(--transition-fast);
  pointer-events: none;
  z-index: 3;
}

.manage-item:hover .manage-controls,
.manage-item:focus-within .manage-controls {
  opacity: 1;
  pointer-events: auto;
}

/* Para pantallas táctiles mostramos siempre los botones con un degradado sutil */
@media (max-width: 768px) {
  .manage-controls {
    opacity: 1;
    pointer-events: auto;
    background: linear-gradient(to top, rgba(8, 11, 17, 0.8) 0%, rgba(8, 11, 17, 0.1) 80%);
  }
}

.manage-row-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  pointer-events: auto;
}

.manage-row-bottom {
  display: flex;
  justify-content: center;
  width: 100%;
  pointer-events: auto;
}

.manage-btn {
  background: rgba(8, 11, 17, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 6px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.manage-btn:hover {
  transform: scale(1.15);
}

.manage-btn.delete-btn {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.manage-btn.delete-btn:hover {
  background: #ef4444;
  color: var(--text-inverse);
  border-color: #ef4444;
}

.manage-btn.star-btn {
  color: var(--text-muted);
}

.manage-btn.star-btn.is-active {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

/* Botones de flechas para reordenar en móviles */
.manage-order-arrows {
  display: flex;
  gap: 4px;
}

.manage-btn.arrow-btn {
  font-size: 0.65rem;
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   Fase 3: Estilos de Reconocimiento y Filtrado por Etiquetas
   ========================================================================== */

/* Barra de etiquetas (pills) en frontend */
.tags-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0.25rem 0 1.25rem 0;
  margin-bottom: 0.5rem;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.tag-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.tag-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  transform: translateY(-1px);
}

.tag-pill.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: var(--text-inverse);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Etiquetas dentro de la miniatura de gestión admin */
.manage-tags-input {
  width: 100%;
  border: none;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-main);
  font-size: 0.65rem;
  padding: 6px 8px;
  box-sizing: border-box;
  text-align: center;
  font-family: inherit;
  border-top: 1px solid var(--border-color);
  transition: all var(--transition-fast);
}

.manage-tags-input:focus {
  background: rgba(0, 0, 0, 0.6);
  outline: none;
  color: var(--accent-color);
}

/* Badges de etiquetas en las fotos del frontend público */
.item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.item-tag-badge {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  text-transform: capitalize;
}

/* Etiquetas en el Lightbox */
.lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lightbox-tag-badge {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  text-transform: capitalize;
}

.delete-all-btn {
  transition: all var(--transition-fast);
}

.delete-all-btn:hover {
  background: #ef4444 !important;
  color: var(--text-inverse) !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

/* Contenedor flotante de etiquetas visibles en la tarjeta */
.item-tags-floating {
  position: absolute;
  bottom: 12px;
  left: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 24px);
  pointer-events: auto;
}

/* Badge clickeable sobre la foto */
.item-tags-floating .item-tag-badge {
  background: rgba(8, 11, 17, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  font-size: 0.65rem;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: all var(--transition-fast);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  text-transform: capitalize;
}

.item-tags-floating .item-tag-badge:hover {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border-color: transparent;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

