/* ============================================================
   Little Angels Montessori — Photo Gallery
   Modern, premium design for the AI era
   ============================================================ */

:root {
  --pink: #E91E63;
  --pink-light: #FCE4EC;
  --green: #4CAF50;
  --green-light: #E8F5E9;
  --orange: #FF9800;
  --orange-light: #FFF3E0;
  --teal: #00BCD4;
  --teal-light: #E0F7FA;
  --purple: #9C27B0;
  --purple-light: #F3E5F5;
  --dark: #1a1a2e;
  --gray: #6B7280;
  --light-gray: #F8F9FA;
  --white: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-lg: 0 16px 48px rgba(0,0,0,0.15);
  --radius: 16px;
  --radius-lg: 24px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { overflow-x: hidden; scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background: #f0f2f5;
  min-height: 100vh;
  overflow-x: hidden;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

/* --- Focus Indicators --- */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Navigation Header --- */
.nav-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.nav-header__brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-header__brand img {
  height: 44px;
  width: auto;
}

.nav-header__links {
  display: flex;
  list-style: none;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.nav-header__link {
  padding: 0.5rem 1rem;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-header__link:hover {
  background: var(--pink-light);
  color: var(--pink);
}

.nav-header__link.active {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: var(--white);
  box-shadow: 0 3px 12px rgba(233, 30, 99, 0.25);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
  font-size: 0.9rem;
  color: var(--gray);
}
.breadcrumb__link { color: var(--pink); font-weight: 500; }
.breadcrumb__link:hover { text-decoration: underline; }
.breadcrumb__separator { color: #ccc; }
.breadcrumb__current { color: var(--dark); font-weight: 600; }

/* --- Page Container --- */
.page-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- Page Title --- */
.page-title {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 0.25rem;
}

/* --- Gallery Hero --- */
.gallery-hero {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
}

.gallery-hero h1 {
  font-size: 2.8rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--pink), var(--orange), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

/* --- Photo Count --- */
.photo-count {
  font-size: 1.1rem;
  color: var(--gray);
  padding: 0.5rem 0;
}
.photo-count__number {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--pink);
  -webkit-text-fill-color: var(--pink);
}

/* --- Section Titles --- */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 1rem;
  margin-top: 2rem;
}

/* --- Category Cards Grid --- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  padding: 1rem 0;
}

.category-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--pink);
}

.category-card__image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.category-card__body { padding: 1.25rem; }
.category-card__title { font-size: 1.2rem; font-weight: 700; color: var(--dark); margin-bottom: 0.2rem; }
.category-card__count { font-size: 0.85rem; color: var(--gray); }

.category-card:nth-child(1) .category-card__title { color: var(--pink); }
.category-card:nth-child(2) .category-card__title { color: var(--orange); }
.category-card:nth-child(3) .category-card__title { color: var(--green); }
.category-card:nth-child(4) .category-card__title { color: var(--teal); }

/* --- Toolbar (Select All, Download All, Share All) --- */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-btn {
  padding: 0.5rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 24px;
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.toolbar-btn:hover {
  border-color: var(--pink);
  color: var(--pink);
  background: var(--pink-light);
}

.toolbar-btn.active {
  background: var(--pink);
  color: var(--white);
  border-color: var(--pink);
}

.toolbar-count {
  font-size: 0.85rem;
  color: var(--gray);
  margin-left: auto;
}

/* --- Thumbnail Grid (LARGE modern cards) --- */
.thumbnail-grid {
  display: grid;
  gap: 1rem;
  padding: 0.5rem 0;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) {
  .thumbnail-grid, .thumbnail-grid__inner { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .thumbnail-grid, .thumbnail-grid__inner { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1200px) {
  .thumbnail-grid, .thumbnail-grid__inner { grid-template-columns: repeat(3, 1fr); }
}

.thumbnail-grid__item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumbnail-grid__item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.thumbnail-grid__item.selected {
  border: 3px solid var(--pink);
  box-shadow: 0 0 0 3px rgba(233,30,99,0.2);
}

.gallery-thumbnail {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

/* --- Thumbnail Actions (always visible on bottom) --- */
.thumb-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.5));
}

.thumb-action-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  border: none;
  border-radius: 50%;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.thumb-action-btn:hover {
  transform: scale(1.15);
  background: var(--white);
}

/* Select checkbox on thumbnails */
.thumb-select {
  position: absolute;
  top: 0.3rem;
  left: 0.3rem;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  color: transparent;
  transition: all 0.15s;
}

.thumb-select:hover, .thumbnail-grid__item.selected .thumb-select {
  background: var(--pink);
  border-color: var(--pink);
  color: white;
}

.thumbnail-grid__item:hover .thumb-select {
  opacity: 1;
}

.thumbnail-grid__item.selected .thumb-select::after {
  content: '✓';
  color: white;
  font-weight: bold;
  font-size: 0.6rem;
}

/* --- Event Sections --- */
.event-section { margin-bottom: 2rem; }

.event-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #eee;
}

.event-title::before { content: '📸 '; }

.thumbnail-grid__inner {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 600px) { .thumbnail-grid__inner { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .thumbnail-grid__inner { grid-template-columns: repeat(3, 1fr); } }

/* --- Recently Added --- */
.recently-added { margin-bottom: 2rem; }

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.recent-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.25s;
}

.recent-item:hover { transform: scale(1.02); box-shadow: var(--shadow-md); }

.recent-item__media { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }

.recent-item__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 0.6rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 500;
}

.recently-added-category {
  background: var(--orange-light);
  padding: 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.recent-title { border-bottom: none; color: var(--orange); }
.recent-title::before { content: ''; }

/* --- Empty & Error States --- */
.empty-state, .error-state {
  text-align: center;
  padding: 3rem 1rem;
  font-size: 1.1rem;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}
.empty-state { color: var(--gray); }
.error-state { color: #dc2626; background: #FEF2F2; }

/* --- Loading Spinner --- */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  gap: 1rem;
  color: var(--gray);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--pink-light);
  border-top-color: var(--pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- Lightbox --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(8px);
}

.lightbox-img-container {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100vw - 120px);
  max-height: calc(100vh - 120px);
  position: relative;
}

.lightbox-image {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 1.8rem;
  cursor: pointer;
  padding: 0.3rem 0.7rem;
  border-radius: 50%;
  z-index: 2001;
  transition: all 0.2s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.5rem 0.8rem;
  border-radius: 50%;
  z-index: 2001;
  transition: all 0.2s;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-prev:hover:not(:disabled), .lightbox-next:hover:not(:disabled) {
  background: var(--pink);
  border-color: var(--pink);
}
.lightbox-prev:disabled, .lightbox-next:disabled { opacity: 0.2; cursor: not-allowed; }

.lightbox-error {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f87171;
  font-size: 1.1rem;
  padding: 2rem;
}

.lightbox-actions {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.75rem;
  z-index: 2001;
}

.lightbox-action-btn {
  padding: 0.7rem 1.4rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 28px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(4px);
}

.lightbox-action-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.lightbox-toast {
  position: absolute;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 150, 105, 0.95);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2002;
  transition: opacity 0.3s;
}

.lightbox-overlay button:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .nav-header { padding: 0.5rem 1rem; gap: 0.5rem; }
  .nav-header__brand img { height: 36px; }
  .nav-header__link { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
  .page-title { font-size: 1.6rem; }
  .gallery-hero h1 { font-size: 2rem; }
  .category-grid { grid-template-columns: 1fr; }
  .thumbnail-grid, .thumbnail-grid__inner { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .gallery-toolbar { gap: 0.4rem; }
  .toolbar-btn { padding: 0.4rem 0.7rem; font-size: 0.8rem; }
}
