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

:root {
  --bg-deep: #0d1621;
  --bg-mid: #1a2940;
  --bg-surface: #1a2332;
  --accent: #d4a574;
  --accent-light: #f4e4c1;
  --text-secondary: #7a9ec7;
  --text-body: #9fb5d1;
  --text-muted: rgba(122,158,199,0.4);
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg-surface);
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text-body);
}

/* === Animated background === */
.waves-bg {
  position: fixed;
  width: 200%; height: 200%;
  top: -50%; left: -50%;
  z-index: 0;
  background: linear-gradient(45deg, #0d1621 0%, #1a2940 25%, #2d4a6b 50%, #1a2940 75%, #0d1621 100%);
  animation: waveAnimation 20s ease-in-out infinite;
}

@keyframes waveAnimation {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(1deg) scale(1.05); }
  50% { transform: rotate(-1deg) scale(1); }
  75% { transform: rotate(1deg) scale(1.05); }
}

.particles { position: fixed; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.particle {
  position: absolute;
  width: 2px; height: 2px;
  background: linear-gradient(45deg, #d4a574, #f4e4c1);
  border-radius: 50%;
  animation: floatUp 15s infinite linear;
  opacity: 0;
}

@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(100vh) scale(0); }
  10%  { opacity: 1; transform: translateY(80vh) scale(1); }
  90%  { opacity: 1; transform: translateY(10vh) scale(1); }
  100% { opacity: 0; transform: translateY(-10vh) scale(0); }
}

/* === Layout === */
.page-wrapper {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
}

.container {
  text-align: center;
  max-width: 800px;
  width: 100%;
  animation: fadeInUp 1.2s ease-out;
}

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

/* === Title === */
.title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 3.2em;
  font-weight: 300;
  background: linear-gradient(135deg, #d4a574, #f4e4c1, #d4a574);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: 3px;
  background-size: 200% 200%;
  animation: shimmer 3s ease-in-out infinite;
}

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

.subtitle {
  font-size: 1.1em;
  font-weight: 300;
  color: var(--text-secondary);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 40px;
}

/* === Form === */
.form-group {
  margin-bottom: 28px;
  text-align: left;
}

.form-label {
  display: block;
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  padding: 14px 20px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1em;
  font-weight: 300;
  color: var(--accent-light);
  background: rgba(26,41,64,0.6);
  border: 1px solid rgba(212,165,116,0.25);
  border-radius: 12px;
  outline: none;
  transition: all 0.3s ease;
}

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

.form-input:focus {
  border-color: rgba(212,165,116,0.5);
  box-shadow: 0 0 20px rgba(212,165,116,0.1);
  background: rgba(26,41,64,0.8);
}

/* === Drop Zone === */
.dropzone {
  border: 2px dashed rgba(212,165,116,0.3);
  border-radius: 16px;
  padding: 50px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s ease;
  background: rgba(26,41,64,0.3);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212,165,116,0.05), rgba(244,228,193,0.02));
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 14px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: rgba(212,165,116,0.6);
  box-shadow: 0 0 30px rgba(212,165,116,0.1);
}

.dropzone:hover::before, .dropzone.dragover::before { opacity: 1; }

.dropzone-icon {
  font-size: 3em;
  margin-bottom: 16px;
  opacity: 0.6;
}

.dropzone-text {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dropzone-hint {
  font-size: 0.85em;
  color: var(--text-muted);
}

.dropzone input[type="file"] { display: none; }

/* === Previews === */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.preview-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(212,165,116,0.15);
  animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #ff6b6b;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.preview-item:hover .remove-btn { opacity: 1; }

.preview-info {
  text-align: center;
  margin-bottom: 16px;
  font-size: 0.85em;
  color: var(--text-muted);
}

/* === URL Input === */
.url-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(212,165,116,0.15);
}

.url-input-row {
  display: flex;
  gap: 10px;
}

.url-input-row .form-input { flex: 1; }

.btn-add-url {
  padding: 12px 20px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--accent);
  background: rgba(212,165,116,0.1);
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-add-url:hover {
  background: rgba(212,165,116,0.2);
  border-color: rgba(212,165,116,0.5);
}

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 40px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1em;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(212,165,116,0.35);
  border-radius: 50px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25,0.46,0.45,0.94);
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212,165,116,0.15), rgba(244,228,193,0.08));
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50px;
}

.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(244,228,193,0.15), transparent);
  animation: btnSheen 4s ease-in-out infinite;
}

@keyframes btnSheen {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

.btn-primary:hover {
  color: var(--accent-light);
  border-color: rgba(244,228,193,0.6);
  box-shadow: 0 0 20px rgba(212,165,116,0.2), 0 0 40px rgba(212,165,116,0.1);
  transform: translateY(-3px);
}

.btn-primary:hover::before { opacity: 1; }

.btn-primary:active { transform: translateY(-1px); }

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.btn-row .btn-primary {
  padding: 14px 32px;
  font-size: 0.9em;
}

/* === Gallery page === */
.gallery-page {
  max-width: 1200px;
}

.folder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
}

.folder-tab {
  -webkit-appearance: none;
  appearance: none;
  padding: 8px 18px;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85em;
  font-weight: 400;
  color: var(--text-muted);
  background: rgba(26,41,64,0.4);
  border: 1px solid rgba(212,165,116,0.15);
  border-radius: 20px;
  cursor: pointer;
  outline: none;
  transition: all 0.25s ease;
}

.folder-tab:hover {
  color: var(--text-secondary);
  border-color: rgba(212,165,116,0.3);
}

.folder-tab.active {
  color: var(--accent);
  background: rgba(212,165,116,0.1);
  border-color: rgba(212,165,116,0.4);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.gallery-card {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(212,165,116,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-card:hover {
  border-color: rgba(212,165,116,0.4);
  transform: scale(1.03);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.gallery-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .btn-row { gap: 10px; }
  .btn-row .btn-primary { padding: 12px 24px; font-size: 0.8em; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .folder-tab { padding: 6px 14px; font-size: 0.8em; }
}

/* === Progress Bar === */
.upload-progress {
  margin-top: 20px;
  display: none;
}

.upload-progress.active { display: block; }

.progress-bar-outer {
  width: 100%;
  height: 4px;
  background: rgba(122,158,199,0.2);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  width: 0%;
  border-radius: 4px;
  box-shadow: 0 0 10px rgba(212,165,116,0.5);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-align: center;
}

/* === Result === */
.result {
  margin-top: 30px;
  padding: 24px;
  border-radius: 14px;
  background: rgba(26,41,64,0.5);
  border: 1px solid rgba(212,165,116,0.2);
  text-align: center;
  animation: fadeInUp 0.5s ease-out;
}

.result.success { border-color: rgba(100,200,150,0.3); }
.result.error { border-color: rgba(255,100,100,0.3); }

.result-message {
  font-size: 1em;
  color: var(--text-body);
  margin-bottom: 8px;
}

.result-detail {
  font-size: 0.85em;
  color: var(--text-muted);
}

/* === Footer === */
.footer {
  margin-top: auto;
  padding-top: 40px;
  text-align: center;
}

.footer-divider {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,165,116,0.25), transparent);
  margin: 0 auto 16px;
}

.footer-link {
  font-size: 0.8em;
  font-weight: 300;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.3s;
}

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

/* === Admin === */
.admin-wrapper {
  max-width: 1000px;
  width: 100%;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.2em;
  font-weight: 300;
  color: var(--accent);
}

.admin-actions { display: flex; gap: 10px; align-items: center; }

.folder-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.folder-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: rgba(26,41,64,0.5);
  border: 1px solid rgba(212,165,116,0.15);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.folder-card:hover {
  border-color: rgba(212,165,116,0.4);
  box-shadow: 0 0 20px rgba(212,165,116,0.08);
  transform: translateX(4px);
}

.folder-info { flex: 1; }

.folder-name {
  font-size: 1.1em;
  color: var(--accent-light);
  margin-bottom: 4px;
}

.folder-meta {
  font-size: 0.8em;
  color: var(--text-muted);
}

.folder-count {
  font-size: 0.9em;
  color: var(--text-secondary);
  padding: 6px 14px;
  background: rgba(212,165,116,0.1);
  border-radius: 20px;
  border: 1px solid rgba(212,165,116,0.2);
}

.folder-delete {
  padding: 6px 12px;
  font-size: 0.8em;
  color: #ff6b6b;
  background: rgba(255,100,100,0.08);
  border: 1px solid rgba(255,100,100,0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 12px;
}

.folder-delete:hover {
  background: rgba(255,100,100,0.15);
  border-color: rgba(255,100,100,0.4);
}

/* === Gallery Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,22,33,0.9);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  overflow-y: auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 900px;
  margin-bottom: 24px;
}

.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8em;
  color: var(--accent);
}

.modal-counter {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-left: auto;
  margin-right: 16px;
}

.modal-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,100,100,0.1);
  border: 1px solid rgba(255,100,100,0.2);
  color: #ff6b6b;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255,100,100,0.2);
}

.modal-overlay .gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 900px;
}

.modal-overlay .gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(212,165,116,0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-overlay .gallery-item:hover {
  border-color: rgba(212,165,116,0.4);
  transform: scale(1.02);
}

.modal-overlay .gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-overlay .gallery-item .gallery-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: #ff6b6b;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

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

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon { font-size: 3em; margin-bottom: 16px; opacity: 0.4; }

.modal-overlay .gallery-item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: var(--text-body);
  font-size: 0.75em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s;
}

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

/* === Lightbox === */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5,10,18,0.95);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255,100,100,0.25);
  border-color: rgba(255,100,100,0.5);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(212,165,116,0.2);
  border-color: rgba(212,165,116,0.5);
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-img-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 70px;
  width: 100%;
  min-height: 0;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  user-select: none;
}

.lightbox-info {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  font-size: 0.85em;
  color: rgba(255,255,255,0.5);
  background: rgba(0,0,0,0.4);
  border-top: 1px solid rgba(255,255,255,0.06);
  width: 100%;
  justify-content: center;
}

.lightbox-download {
  color: var(--accent);
  text-decoration: none;
  padding: 6px 16px;
  border: 1px solid rgba(212,165,116,0.3);
  border-radius: 20px;
  transition: all 0.2s;
  font-size: 0.9em;
}

.lightbox-download:hover {
  background: rgba(212,165,116,0.15);
  border-color: rgba(212,165,116,0.6);
  color: var(--accent-light);
}

/* === Auth screen === */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.auth-form {
  max-width: 400px;
  width: 100%;
  text-align: center;
}

/* === Back link === */
.back-link {
  display: inline-block;
  font-size: 0.9em;
  font-weight: 300;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 20px;
  transition: color 0.3s;
  letter-spacing: 0.5px;
}

.back-link:hover { color: var(--accent); }

/* === Collage === */
.collage-page {
  max-width: 1100px;
}

.collage-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 20px 0;
  min-height: 200px;
  perspective: 1000px;
}

.collage-item {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3), 0 0 0 1px rgba(212,165,116,0.12);
  transform: rotate(var(--rotation, 0deg)) scale(var(--scale, 1));
  opacity: 0;
  transition: box-shadow 0.4s ease, transform 0.5s cubic-bezier(0.25,0.46,0.45,0.94);
  cursor: default;
  flex-shrink: 0;
}

.collage-loaded .collage-item {
  animation: collageReveal 0.8s ease-out forwards;
}

@keyframes collageReveal {
  from {
    opacity: 0;
    transform: rotate(var(--rotation, 0deg)) scale(calc(var(--scale, 1) * 0.6)) translateY(30px);
  }
  to {
    opacity: 1;
    transform: rotate(var(--rotation, 0deg)) scale(var(--scale, 1)) translateY(0);
  }
}

.collage-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@keyframes collageFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.collage-item:hover {
  box-shadow: 0 12px 40px rgba(212,165,116,0.25), 0 0 0 1px rgba(212,165,116,0.3);
  transform: rotate(0deg) scale(1.08) !important;
  z-index: 10;
}

.collage-loading {
  width: 100%;
  text-align: center;
  padding: 40px 0;
}

@keyframes progressPulse {
  0%, 100% { width: 20%; }
  50% { width: 80%; }
}

.photo-count {
  text-align: center;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: 24px;
  letter-spacing: 1px;
}

/* === Responsive === */
@media (max-width: 768px) {
  .title { font-size: 2.2em; }
  .subtitle { font-size: 0.9em; }
  .dropzone { padding: 30px 20px; }
  .preview-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .folder-card { flex-direction: column; align-items: flex-start; gap: 12px; }
  .admin-header { flex-direction: column; align-items: flex-start; }
  .collage-item { width: 130px; height: 130px; }
  .collage-container { gap: 12px; }
  .lightbox-img-wrap { padding: 50px 16px; }
  .lightbox-nav { width: 40px; height: 40px; font-size: 22px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .modal-header { flex-wrap: wrap; }
  .modal-counter { margin-left: 0; width: 100%; margin-top: 4px; }
}
