/* ===== LUXIE GALLERY — Clean Customer Experience CSS ===== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg-primary: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f3f4;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;
  --accent: #1a73e8;
  --accent-light: #e8f0fe;
  --border: #dadce0;
  --border-light: #e8eaed;
  --shadow-sm: 0 1px 2px rgba(60, 64, 67, 0.1);
  --shadow-md: 0 1px 3px rgba(60, 64, 67, 0.15), 0 4px 8px rgba(60, 64, 67, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --gap: 2px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  gap: 20px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.loading-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ===== PASSWORD MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 24px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.modal-icon { font-size: 48px; margin-bottom: 16px; }
.modal-card h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.modal-card p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 24px; }

#password-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  margin-bottom: 16px;
}

#password-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-primary:hover { background: #1765cc; }
.btn-primary:active { transform: scale(0.98); }
.error-text { color: #d93025; font-size: 0.8125rem; margin-top: 12px; }

/* ===== ERROR SCREEN ===== */
.error-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  padding: 24px;
  text-align: center;
  gap: 12px;
}

.error-icon { font-size: 64px; margin-bottom: 8px; }
.error-screen h2 { font-size: 1.25rem; font-weight: 600; }
.error-screen p { color: var(--text-secondary); font-size: 0.875rem; }

/* ===== TOP APP BAR ===== */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.top-bar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar-right {
  flex-shrink: 0;
}

.top-bar-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.icon-btn:hover { background: var(--bg-surface-hover); }
.icon-btn .material-symbols-outlined { font-size: 24px; }

/* ===== ALBUM GRID ===== */
.album-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.album-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.album-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.album-card:active { transform: scale(0.98); }

.album-card-thumb {
  aspect-ratio: 4/3;
  width: 100%;
  object-fit: cover;
  background: var(--bg-primary);
}

.album-card-info { padding: 12px; }
.album-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-card-count { font-size: 0.75rem; color: var(--text-muted); }

/* ===== EMPTY STATE & FOOTER ===== */
.empty-state { text-align: center; padding: 80px 24px; }
.empty-icon { font-size: 64px; color: var(--text-muted); margin-bottom: 16px; display: block; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 8px; }
.empty-state p { color: var(--text-secondary); font-size: 0.875rem; }

.gallery-footer {
  text-align: center;
  padding: 32px 16px calc(var(--safe-bottom) + 32px);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.gallery-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
}

.gallery-footer a:hover { color: var(--accent); }

/* ===== PHOTO GRID — Clean 3 Column ===== */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
  padding: 0 var(--gap) calc(var(--safe-bottom) + 16px);
  max-width: 1200px;
  margin: 0 auto;
}

.grid-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-primary);
  cursor: pointer;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
  will-change: transform;
}

.grid-item img.loading { opacity: 0; }
.grid-item img.loaded { opacity: 1; }
.grid-item:active img { transform: scale(0.96); }

/* Shimmer placeholder */
.grid-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, var(--bg-primary) 8%, var(--bg-surface) 18%, var(--bg-primary) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
  z-index: 0;
}

.grid-item.loaded::before { display: none; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Video badge */
.grid-item .video-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 2;
  text-transform: uppercase;
}

/* Responsive */
@media (min-width: 600px) {
  .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 0 3px 32px; }
  .album-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 16px 24px; }
  .top-bar { padding: calc(var(--safe-top) + 16px) 24px 16px; }
}

@media (min-width: 1024px) {
  .photo-grid { grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 0 4px 48px; }
  .album-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-item:hover img { transform: scale(1.03); }
}

/* ===== LIGHTBOX — Immersive Photo Viewer ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  animation: lightbox-in 0.25s ease;
}

@keyframes lightbox-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Main image — fills ALL space above thumbnail strip */
.lightbox-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 80px; /* Space for thumbnail strip */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  overflow: hidden;
  cursor: pointer;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.2s ease;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  will-change: transform;
}

.lightbox-img.switching { opacity: 0.3; }

/* Top bar — auto-hide on tap */
.lightbox-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 8px) 12px 12px;
  z-index: 20;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.lightbox-header.hidden {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
}

.lightbox-counter {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.lightbox-icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.lightbox-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.lightbox-icon-btn .material-symbols-outlined { font-size: 24px; }

/* Nav arrows — desktop only */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  border: none;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  z-index: 15;
  transition: background var(--transition-fast), opacity var(--transition-normal);
}

.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-nav .material-symbols-outlined { font-size: 32px; }

.lightbox-nav.hidden { opacity: 0; pointer-events: none; }

@media (min-width: 768px) {
  .lightbox-nav { display: flex; }
  .lightbox-nav:hover { background: rgba(0, 0, 0, 0.5); }
}

/* ===== THUMBNAIL STRIP ===== */
.thumbnail-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 15;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  padding: 10px 0 calc(var(--safe-bottom) + 10px);
  transition: opacity var(--transition-normal);
}

.thumbnail-strip.hidden {
  opacity: 0;
  pointer-events: none;
}

.thumbnail-strip-inner {
  display: flex;
  gap: 3px;
  padding: 0 12px;
  overflow-x: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.thumbnail-strip-inner::-webkit-scrollbar { display: none; }

.thumb-item {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--transition-fast), opacity var(--transition-fast);
  opacity: 0.45;
}

.thumb-item:hover { opacity: 0.75; }

.thumb-item.active {
  border-color: #fff;
  opacity: 1;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 0; height: 0; }
