/* ============================================
   DUKHAANSIN — PHOTOGRAPHY PORTFOLIO
   ============================================ */

:root {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-muted: #777;
  --border: #e5e5e5;
  --accent: #2a2a2a;
  --accent-hover: #444;
  --danger: #d44;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --max-width: 1400px;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- NAV ---- */
.nav {
  max-width: var(--max-width);
  margin: 0 auto;
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
}
.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.nav-links { display: flex; gap: 24px; }
.nav-links a {
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text); }

/* ---- HERO ---- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
}
.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* ---- ALBUMS GRID ---- */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 28px;
  padding-bottom: 80px;
}
.album-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}
.album-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.album-card-img {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #eee;
}
.album-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.album-card:hover .album-card-img img {
  transform: scale(1.03);
}
.album-card-placeholder {
  width: 100%;
  height: 100%;
  background: #eee;
}
.album-card-info {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.album-card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
}
.album-card-count {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ---- ALBUM PAGE ---- */
.album-header {
  padding: 40px 0 30px;
}
.back-link {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: inline-block;
  margin-bottom: 12px;
  transition: color var(--transition);
}
.back-link:hover { color: var(--text); }
.album-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
}
.album-description {
  color: var(--text-muted);
  margin-top: 8px;
  max-width: 600px;
}

/* ---- MASONRY GRID ---- */
.masonry {
  columns: 3;
  column-gap: 16px;
  padding-bottom: 80px;
}
.masonry-item {
  break-inside: avoid;
  margin-bottom: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
}
.masonry-item img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease, filter 0.4s ease;
}
.masonry-item:hover img {
  transform: scale(1.02);
  filter: brightness(0.95);
}

@media (max-width: 1024px) { .masonry { columns: 2; } }
@media (max-width: 600px) {
  .masonry { columns: 1; }
  .albums-grid { grid-template-columns: 1fr; }
}

/* ---- LOADING ---- */
.loading-spinner {
  text-align: center;
  padding: 40px;
}
.loading-text {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

/* ---- LIGHTBOX ---- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.lightbox.active {
  display: flex;
  opacity: 1;
}
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
}
.lightbox-close, .lightbox-prev, .lightbox-next {
  position: fixed;
  background: none;
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 1001;
  opacity: 0.7;
  transition: opacity var(--transition);
  padding: 16px;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { opacity: 1; }
.lightbox-close { top: 16px; right: 24px; font-size: 2rem; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lightbox-counter {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
}

/* ---- BUTTONS ---- */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
}
.btn:hover { background: var(--bg); border-color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-small { padding: 6px 14px; font-size: 0.82rem; }
.btn-full { width: 100%; text-align: center; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 500; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---- FLASH / ALERTS ---- */
.flash-error {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
  background: #fde8e8;
  color: var(--danger);
}

/* ---- ADMIN ---- */
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}
.admin-topbar h1 {
  font-family: var(--font-display);
  font-weight: 500;
}

.admin-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.admin-section h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.stats-row {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 32px;
  box-shadow: var(--shadow);
  flex: 1;
  text-align: center;
}
.stat-number {
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
}
.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 6px;
  display: block;
}

/* ---- ALBUM LIST (Admin) ---- */
.album-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--bg);
  transition: background var(--transition);
  margin-bottom: 8px;
}
.album-row:hover { background: #f0f0f0; }
.album-row-thumb {
  width: 64px;
  height: 48px;
  border-radius: 6px;
  overflow: hidden;
  background: #ddd;
  flex-shrink: 0;
}
.album-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.album-row-info { flex: 1; }
.album-row-info strong { display: block; }
.album-row-info span { font-size: 0.85rem; color: var(--text-muted); }
.album-row-actions { display: flex; gap: 8px; }

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--accent);
  background: #f5f5f5;
}

.upload-progress { margin-top: 16px; }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ---- PREVIEW MASONRY (Admin) ---- */
.preview-masonry {
  columns: 3;
  column-gap: 12px;
}

.preview-item {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.preview-item:active { cursor: grabbing; }
.preview-item img { width: 100%; display: block; }
.preview-item:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.preview-item.dragging { opacity: 0.3; transform: scale(0.95); }
.preview-item.drag-over {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  box-shadow: 0 0 0 6px rgba(42,42,42,0.1);
}

/* Photo action overlays */
.preview-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.preview-item:hover .preview-actions { opacity: 1; }

.preview-action-btn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), transform 0.15s ease;
  backdrop-filter: blur(4px);
  font-size: 0.85rem;
}
.preview-action-btn:hover { background: rgba(0,0,0,0.85); transform: scale(1.1); }
.delete-photo-btn:hover { background: var(--danger); }
.set-cover-btn.active { color: #ffd700; }

/* Drag hint */
.drag-hint {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  color: #fff;
  border-radius: 12px;
  padding: 4px 12px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  font-size: 0.75rem;
}
.preview-item:hover .drag-hint { opacity: 0.7; }

@media (max-width: 1024px) { .preview-masonry { columns: 2; } }
@media (max-width: 600px) { .preview-masonry { columns: 1; } }

/* ---- MISC ---- */
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-muted); }
.photo-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 400; }

/* ---- FOOTER ---- */
.footer {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .hero { padding: 50px 0 40px; }
  .stats-row { flex-direction: column; }
  .album-row { flex-wrap: wrap; }
  .album-row-actions { width: 100%; justify-content: flex-end; }
}
