/* ═══════════════════════════════════════════════════════════════
   Client Portal — Cinematic & Luxury Edition
   ═══════════════════════════════════════════════════════════════ */

:root {
  --brand-deep: #080a11;
  --brand-surface: #111420;
  --accent: #6366f1;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --font-display: "Cormorant Garamond", serif;
  --font-body: "DM Sans", sans-serif;
  --font-mono: "Space Mono", monospace;
}

/* ── Mesh Background ────────────────────────────────────────── */
body {
  background-color: var(--brand-deep);
  color: #e2e8f0;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  position: relative;
}

#bg-blobs {
  position: fixed; inset: 0; z-index: -1;
  overflow: hidden; pointer-events: none; opacity: 0.6;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(140px);
  animation: blob-float 30s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
}
.blob-1 { width: 600px; height: 600px; background: #6366f120; top: -10%; left: -10%; }
.blob-2 { width: 500px; height: 500px; background: #8b5cf615; bottom: -5%; right: -5%; animation-delay: -5s; }
.blob-3 { width: 400px; height: 400px; background: #06b6d415; top: 30%; right: 15%; animation-delay: -10s; }

@keyframes blob-float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 10%) scale(1.1); }
  100% { transform: translate(-5%, -5%) scale(0.9); }
}

/* ── Typography & Refinement ────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); font-weight: 300; font-style: italic; }
.text-gradient {
  background: linear-gradient(to right, #fff, #a5b4fc);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.font-mono { font-family: var(--font-mono); letter-spacing: 0.15em; }

/* ── Luxury Card Design ─────────────────────────────────────── */
.photos-grid {
  columns: 4 280px; column-gap: 12px; padding: 2rem 0;
}
@media (max-width: 1024px) { .photos-grid { columns: 3 240px; } }
@media (max-width: 640px) { .photos-grid { columns: 2 160px; } }

/* List View Support - Ultra Compact */
.photos-grid.view-list {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 0;
}
.photos-grid.view-list .photo-item {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  width: 100%;
  border-radius: 8px;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* faint separator */
  margin-bottom: 0;
  transition: background 0.2s;
}
.photos-grid.view-list .photo-item:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: none; /* disable hover lift */
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.05) !important; /* disable border glow */
}
.photos-grid.view-list .photo-item img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 16px;
}
.photos-grid.view-list .photo-item:hover img {
  transform: none;
  filter: none;
}
/* Reformat top bar into list info */
.photos-grid.view-list .photo-top-bar {
  position: static !important;
  background: transparent !important;
  opacity: 1 !important;
  flex: 1;
  display: flex !important;
  flex-direction: row;
  align-items: center;
  padding: 0 !important;
  overflow: hidden;
}
/* Convert flex-col container to grid for Name and Date */
.photos-grid.view-list .photo-top-bar > div:first-child {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 16px;
  width: 100%;
  align-items: center;
  pointer-events: auto !important;
}
/* Filename styling */
.photos-grid.view-list .photo-top-bar span:first-child {
  font-size: 13px !important;
  font-family: var(--font-body) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  font-weight: 500 !important;
  color: #e2e8f0 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Date styling */
.photos-grid.view-list .photo-top-bar span:last-child {
  font-size: 13px !important;
  color: #64748b !important;
  letter-spacing: normal !important;
  font-family: var(--font-body) !important;
}
.photos-grid.view-list .photo-top-bar span:last-child i {
  display: none !important; /* Hide clock icon to match pure text */
}

.photos-grid.view-list .photo-copy-btn {
  margin-left: 16px;
  margin-right: 16px;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #64748b !important;
}

/* Reformat actions */
.photos-grid.view-list .photo-actions {
  position: static !important;
  background: transparent !important;
  opacity: 1 !important;
  transform: none !important;
  flex-shrink: 0;
  display: flex !important;
  align-items: center;
  padding: 0 !important;
  gap: 8px;
}
.photos-grid.view-list .photo-expand-btn {
  display: none !important;
}
.photos-grid.view-list .pa-comment,
.photos-grid.view-list .pa-later {
  width: 32px;
  height: 32px;
  border-radius: 6px;
}
.photos-grid.view-list .pa-select {
  height: 32px;
  padding: 0 12px !important;
  border-radius: 6px;
  font-size: 11px !important;
}
@media (max-width: 640px) {
  .photos-grid.view-list .photo-top-bar > div:first-child {
    grid-template-columns: 1fr; /* Hide date on mobile */
  }
  .photos-grid.view-list .photo-top-bar span:last-child {
    display: none !important;
  }
}

.photo-item {
  break-inside: avoid; margin-bottom: 12px;
  position: relative; overflow: hidden;
  border-radius: 20px; cursor: zoom-in;
  background: #111420; border: 1px solid rgba(255,255,255,0.03);
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(20px); opacity: 0; /* Entry animation base */
}
.photo-item.reveal { transform: translateY(0); opacity: 1; }
.photo-item:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.5), 0 0 20px rgba(99, 102, 241, 0.1);
}

.photo-item img {
  width: 100%; height: auto; display: block;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.photo-item:hover img { transform: scale(1.08); filter: brightness(1.1); }

/* Selection Glow States */
.photo-item.state-selected { border-color: #22c55e !important; box-shadow: 0 0 25px rgba(34, 197, 94, 0.15); }
.photo-item.state-later { border-color: #f59e0b !important; box-shadow: 0 0 25px rgba(245, 158, 11, 0.15); }

/* ── Lightbox Overlay Redesign ─────────────────────────────── */
.lightbox {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; flex-direction: column;
}
.lb-backdrop {
  position: fixed; inset: 0; z-index: 8900;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
  backdrop-filter: blur(24px);
}
#lb-img {
  max-width: 90vw; max-height: 80vh; object-fit: contain;
  box-shadow: 0 50px 100px -20px rgba(0,0,0,0.8);
  border-radius: 4px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lb-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  padding: 4rem 1rem;
}

.lb-close {
  position: absolute; top: 1.5rem; right: 1.5rem; z-index: 9100;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
  color: #fff; cursor: pointer; transition: all 0.3s;
}
.lb-close:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.5); transform: rotate(90deg); }

.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 9100;
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
  color: #fff; cursor: pointer; transition: all 0.3s;
}
.lb-nav:hover { background: rgba(255,255,255,0.15); border-color: var(--accent); transform: translateY(-50%) scale(1.05); }
.lb-prev { left: 1.5rem; }
.lb-next { right: 1.5rem; }

.lb-loader {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 9200; display: flex; align-items: center; justify-content: center;
}

.lb-toolbar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 9010;
  padding: 2.5rem; display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(to top, var(--brand-deep), transparent);
}

.lb-action-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 0.75rem 1.5rem; border-radius: 16px;
  backdrop-filter: blur(12px); color: #94a3b8;
  font-weight: 500; font-size: 0.9rem; transition: all 0.3s;
}
.lb-action-btn:hover { background: rgba(255,255,255,0.1); color: #fff; transform: translateY(-2px); }
.lb-action-btn.active { background: white; color: black; border-color: white; }

/* ── Selection Tab Luxury Animation ────────────────────────── */
.sel-tab {
  position: relative; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sel-tab.active {
  background: var(--accent) !important; color: white !important;
  box-shadow: 0 8px 20px -4px var(--accent-glow);
}

/* ── Utilities ──────────────────────────────────────────────── */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.client-toast {
  position: fixed; bottom: 2.5rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: white; color: #080a11;
  padding: 0.8rem 2rem; border-radius: 20px;
  font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  z-index: 10000; opacity: 0; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.client-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Animation Delays for Staggered Load */
.delayed-1 { animation-delay: 0.1s; }
.delayed-2 { animation-delay: 0.2s; }
.delayed-3 { animation-delay: 0.3s; }
.delayed-4 { animation-delay: 0.4s; }

/* ── Download Progress Toast ──────────────────────────────────── */
.dl-progress-wrap {
  position: fixed;
  bottom: 2.5rem;
  right: 2.5rem;
  width: 320px;
  background: rgba(17, 20, 32, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 1.25rem;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  font-family: var(--font-body);
  color: #fff;
  animation: dl-slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes dl-slide-up {
  0% { transform: translateY(40px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
.dl-progress-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.dl-progress-bar-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.dl-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.dl-progress-sub {
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 640px) {
  .dl-progress-wrap {
    bottom: 1.5rem;
    right: 1.5rem;
    left: 1.5rem;
    width: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CLIENT PORTAL — Mobile Responsive Enhancements
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Photos Grid ── */
@media (max-width: 1024px) { .photos-grid { columns: 3 200px; } }
@media (max-width: 768px)  { .photos-grid { columns: 2 150px; column-gap: 8px; } }
@media (max-width: 480px)  { .photos-grid { columns: 2 120px; column-gap: 6px; } }

/* ── Photo items: always show actions on touch (mobile can't hover) ── */
@media (max-width: 768px) {
  .photo-item { border-radius: 12px; margin-bottom: 8px; }
  .photo-item:hover { transform: none; box-shadow: none; border-color: rgba(255,255,255,0.03); }

  /* Always show top bar and actions on mobile */
  .photo-top-bar { opacity: 1 !important; padding: 0.5rem !important; }
  .photo-actions {
    opacity: 1 !important;
    transform: translateY(0) !important;
    background: linear-gradient(to top, rgba(8, 10, 17, 0.9), transparent) !important;
    padding: 0.5rem !important;
    gap: 0.4rem !important;
  }

  /* Make action buttons small and uniform so they don't cover the image */
  .photo-expand-btn, .pa-comment, .pa-later, .pa-select {
    width: 30px !important; 
    height: 30px !important; 
    min-height: 30px !important;
    padding: 0 !important; 
    border-radius: 8px !important;
    backdrop-filter: blur(4px) !important; /* Lighter blur for perf */
  }
}

/* ── Mobile Performance Utilities ── */
@media (max-width: 640px) {
  .glass-heavy {
    backdrop-filter: blur(8px) !important; /* Reduce 24px blur to 8px on mobile */
    background: rgba(17, 20, 32, 0.95); /* More opaque config to compensate */
  }
}

/* ── Album Detail: main screen ── */
@media (max-width: 640px) {
  #album-screen main {
    padding: 1rem 0.75rem 5rem; /* Extra bottom for thumb space */
  }
  #album-title { font-size: 1.75rem !important; word-break: break-word; }
  #album-desc { font-size: 0.85rem; }

  /* sel-info banner */
  #sel-info { font-size: 0.8rem; padding: 0.6rem 1rem; }
}

/* ── Dashboard Header ── */
@media (max-width: 640px) {
  #dashboard-screen main { padding: 4rem 1rem 3rem; }

  /* Albums grid → 1 column on very small screens */
  #albums-grid { grid-template-columns: 1fr !important; }
}

/* ── Lightbox on Mobile ── */
@media (max-width: 640px) {
  .lb-stage { padding: 3.5rem 0.5rem 9rem; } /* More bottom padding for toolbar */
  #lb-img { max-height: 60vh; border-radius: 8px; }
  .lb-nav { width: 44px; height: 44px; border-radius: 12px; }
  .lb-prev { left: 0.5rem; }
  .lb-next { right: 0.5rem; }
  .lb-close { top: 0.75rem; right: 0.75rem; width: 36px; height: 36px; border-radius: 10px; }

  /* Toolbar: horizontal row of icon-only buttons */
  .lb-toolbar {
    padding: 0.75rem 1rem;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .lb-counter { font-size: 0.6rem; }
  .lb-actions { display: flex; gap: 0.5rem; }
  .lb-action-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 10px;
    gap: 0.25rem;
  }
  .lba-text { display: none; } /* Hide text, show icons only */
}

/* ── Toast notification ── */
@media (max-width: 480px) {
  .client-toast {
    bottom: 5rem;
    left: 1rem;
    right: 1rem;
    transform: translateX(0) translateY(20px);
    border-radius: 16px;
    text-align: center;
  }
  .client-toast.show {
    transform: translateX(0) translateY(0);
  }
}

/* ── Download progress toast ── */
@media (max-width: 640px) {
  .dl-progress-wrap {
    bottom: 1.5rem;
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}
