/* styles.css - Premium dark editorial gallery theme */

:root {
  --bg-primary: #080808;
  --bg-secondary: #0f0f0f;
  --bg-card: #151515;
  --bg-elevated: #1a1a1a;
  --bg-glass: rgba(20, 20, 20, 0.8);
  --text-primary: #e8e0d4;
  --text-secondary: #7a756e;
  --text-muted: #3d3a37;
  --accent: #b8956a;
  --accent-hover: #d4ad7d;
  --accent-dim: rgba(184, 149, 106, 0.12);
  --selection: #b8956a;
  --success: #6b9e6b;
  --error: #c45050;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.1);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Manrope', -apple-system, sans-serif;
}

/* ===== Base ===== */

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Subtle dot grid texture on the body */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

::selection {
  background: var(--accent-dim);
  color: var(--text-primary);
}

/* ===== Scrollbar ===== */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: #2a2724;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3d3935;
}

/* ===== Auth Landing Page ===== */

.auth-landing {
  background: var(--bg-primary);
  overflow: hidden;
}

/* Ambient warm glow */
.auth-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
}

.auth-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(184, 149, 106, 0.07) 0%, transparent 70%);
  top: 25%;
  left: 35%;
  transform: translate(-50%, -50%);
  animation: glowDrift1 25s ease-in-out infinite;
}

.auth-glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(160, 120, 80, 0.05) 0%, transparent 70%);
  bottom: 15%;
  right: 20%;
  animation: glowDrift2 30s ease-in-out infinite;
}

.auth-glow-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(184, 149, 106, 0.04) 0%, transparent 70%);
  top: 60%;
  left: 15%;
  animation: glowDrift3 20s ease-in-out infinite;
}

@keyframes glowDrift1 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  33% { transform: translate(-45%, -55%) scale(1.1); }
  66% { transform: translate(-55%, -45%) scale(0.9); }
}

@keyframes glowDrift2 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, -40px); }
}

@keyframes glowDrift3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

/* Auth entrance animations */
.auth-content {
  position: relative;
  z-index: 1;
}

.auth-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 4rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-primary);
  opacity: 0;
  animation: authReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

@media (min-width: 640px) {
  .auth-title {
    font-size: 5.5rem;
  }
}

.auth-separator {
  width: 60px;
  height: 1px;
  background: var(--accent);
  margin: 1.5rem auto;
  opacity: 0;
  animation: authLineGrow 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

@keyframes authLineGrow {
  from { opacity: 0; width: 0; }
  to { opacity: 0.6; width: 60px; }
}

.auth-tagline {
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.875rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-secondary);
  opacity: 0;
  animation: authReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.6s forwards;
}

.auth-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  animation: authReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

@keyframes authReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Auth input */
.auth-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  transition: border-color 0.4s, box-shadow 0.4s;
}

.auth-input::placeholder {
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.15em;
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim), 0 0 30px rgba(184, 149, 106, 0.06);
}

/* Auth submit button */
.auth-submit {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-submit:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth footer text */
.auth-footer {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3rem;
  opacity: 0;
  animation: authReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 1.1s forwards;
}

/* ===== Gallery Header ===== */

.gallery-header {
  background: rgba(8, 8, 8, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
}

.gallery-header.scrolled {
  border-bottom-color: var(--border);
}

.header-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* Selection counter badge */
.selection-counter-badge {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid rgba(184, 149, 106, 0.2);
}

/* Canvas button in header */
.canvas-btn {
  background: var(--accent);
  color: var(--bg-primary);
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(184, 149, 106, 0.2);
}

/* ===== Hero Section ===== */

.hero-section {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  position: relative;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
}

.hero-title {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text-primary);
}

@media (min-width: 640px) {
  .hero-title {
    font-size: 3rem;
  }
}

.hero-subtitle {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

/* ===== Search ===== */

.search-input {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 0.9rem;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ===== Category Buttons ===== */

.category-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  padding: 6px 18px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.category-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.category-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
  font-weight: 500;
}

/* ===== Gallery Hint ===== */

.gallery-hint {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
}

/* ===== Loading Skeleton ===== */

.skeleton-item {
  border-radius: 8px;
  overflow: hidden;
}

.skeleton-item > div {
  background: linear-gradient(110deg, var(--bg-card) 8%, var(--bg-elevated) 18%, var(--bg-card) 33%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

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

/* ===== Gallery Grid Items ===== */

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid transparent;
  transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  animation: itemReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes itemReveal {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-item:hover {
  border-color: rgba(184, 149, 106, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(184, 149, 106, 0.1);
  transform: translateY(-4px);
}

.gallery-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 8px 30px rgba(184, 149, 106, 0.15);
  transform: scale(0.97);
}

.gallery-item.selected:hover {
  transform: scale(0.97);
}

/* Image wrapper */
.gallery-img-wrap {
  background: var(--bg-card);
}

.gallery-img {
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

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

/* Selection checkmark */
.selection-check {
  background: var(--accent);
  color: var(--bg-primary);
  border: 2px solid var(--bg-primary);
}

/* Image overlay */
.image-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  padding: 16px;
}

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

.image-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.image-tags {
  font-size: 0.7rem;
  font-weight: 300;
  color: rgba(232, 224, 212, 0.5);
  letter-spacing: 0.05em;
  margin-top: 2px;
}

/* ===== Canvas Screen ===== */

.canvas-header {
  background: rgba(8, 8, 8, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.canvas-back-btn {
  color: var(--text-secondary);
  transition: color 0.2s;
}

.canvas-back-btn:hover {
  color: var(--text-primary);
}

/* Canvas Items */
.canvas-item {
  cursor: move;
  user-select: none;
}

.canvas-item:hover .canvas-item-delete {
  opacity: 1 !important;
}

.canvas-item img {
  pointer-events: none;
}

/* A4/Letter Canvas */
#a4-canvas {
  background: white;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

/* Image Tray */
.tray-item {
  transition: all 0.2s ease;
  border-color: var(--border-strong);
}

.tray-item:hover {
  transform: scale(1.05);
  border-color: var(--accent);
}

/* Canvas hint */
.canvas-hint-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* ===== Notification ===== */

#notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 400;
  animation: notifSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes notifSlide {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===== Lazy Image Placeholder ===== */

.lazy {
  background: var(--bg-card);
}

/* ===== Responsive ===== */

@media (max-width: 640px) {
  .auth-title {
    font-size: 2.5rem;
    letter-spacing: 0.12em;
  }

  .hero-title {
    font-size: 2rem;
  }

  #a4-canvas {
    max-width: 100%;
  }

  .tray-item {
    width: 60px;
    height: 60px;
  }
}
