:root {
  --cream: #fbf6f0;
  --cream-2: #f3e9df;
  --rose: #d9a7a0;
  --rose-deep: #c08a82;
  --gold: #c9a96a;
  --ink: #4a423c;
  --ink-soft: #8a7f76;
  --white: #fffdfb;
  --shadow: 0 8px 30px rgba(120, 90, 70, 0.12);
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(160deg, var(--cream), var(--cream-2));
  min-height: 100vh;
}

.serif { font-family: var(--serif); font-weight: 600; letter-spacing: 0.3px; }
.muted { color: var(--ink-soft); font-size: 0.9rem; }
.error { color: #b4453c; font-size: 0.9rem; }
.hidden { display: none !important; }

button { font-family: var(--sans); cursor: pointer; border: none; }

.btn-primary {
  background: var(--rose);
  color: var(--white);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover { background: var(--rose-deep); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-weight: 500;
}
.btn-ghost:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }

input, select {
  font-family: var(--sans);
  font-size: 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--cream-2);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--rose); }

/* --- Login --- */
.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.login-flower { font-size: 2.5rem; }
.login-card h1 { font-size: 2rem; margin: 0.3rem 0 0.2rem; }
.login-card form { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1.2rem; }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 253, 251, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--cream-2);
  flex-wrap: wrap;
}
.topbar h1 { font-size: 1.5rem; margin: 0; flex: 1; min-width: 180px; }
.topbar-actions { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.topbar-actions input[type="search"] { min-width: 160px; }

.content { padding: 1.5rem; max-width: 1200px; margin: 0 auto; }
.section-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--rose-deep);
  margin: 1.5rem 0 0.8rem;
}

/* --- Album grid --- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.1rem;
}
.album-card {
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.album-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(120, 90, 70, 0.18); }
.album-cover {
  aspect-ratio: 4 / 3;
  background: var(--cream-2);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--rose);
}
.album-meta { padding: 0.7rem 0.9rem; }
.album-meta .name { font-family: var(--serif); font-size: 1.15rem; }
.album-meta .count { color: var(--ink-soft); font-size: 0.85rem; }

/* --- Photo grid (masonry via columns) --- */
.photo-grid { columns: 4 220px; column-gap: 0.8rem; }
.photo-grid .photo {
  width: 100%;
  margin-bottom: 0.8rem;
  border-radius: 10px;
  display: block;
  cursor: pointer;
  background: var(--cream-2);
  break-inside: avoid;
  transition: opacity 0.4s;
  opacity: 0;
}
.photo-grid .photo.loaded { opacity: 1; }

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(60, 45, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}
.modal-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.8rem;
  max-width: 460px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-card h2 { margin-top: 0; }
.modal-card label { display: block; font-size: 0.9rem; margin: 0.8rem 0 0.3rem; }
.modal-card input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.4rem; }
.inline-form { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.inline-form input { flex: 1; }
.modal-card h3 { font-size: 1rem; margin: 1.4rem 0 0.5rem; color: var(--rose-deep); }

.dropzone {
  border: 2px dashed var(--rose);
  border-radius: 12px;
  padding: 1.6rem;
  text-align: center;
  margin-top: 0.8rem;
  cursor: pointer;
  background: var(--cream);
  transition: background 0.2s;
}
.dropzone.drag { background: var(--cream-2); }
.dropzone p { margin: 0 0 0.3rem; font-weight: 500; }
.dropzone small { color: var(--ink-soft); }

.progress-wrap {
  height: 8px;
  background: var(--cream-2);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.9rem;
}
.progress-bar { height: 100%; width: 0%; background: var(--rose); transition: width 0.2s; }

.uploads-list { display: flex; flex-direction: column; gap: 0.4rem; }
.uploads-list .row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.5rem 0.7rem; background: var(--cream); border-radius: 8px;
}
.uploads-list .row button {
  background: #e7b7b1; color: #7a322c; padding: 0.3rem 0.7rem; border-radius: 6px; font-size: 0.85rem;
}

/* --- Lightbox --- */
.lightbox {
  position: fixed; inset: 0; background: rgba(20, 15, 13, 0.94);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 6px; }
.lightbox button {
  position: absolute; background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 2rem; width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, 0.25); }
.lb-close { top: 1rem; right: 1rem; font-size: 1.8rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-download {
  position: absolute; bottom: 1.3rem; left: 50%; transform: translateX(-50%);
  background: var(--rose); color: #fff; padding: 0.6rem 1.3rem; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.lb-download:hover { background: var(--rose-deep); }

/* --- Toast --- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--white); padding: 0.8rem 1.4rem;
  border-radius: 999px; box-shadow: var(--shadow); z-index: 200; font-size: 0.92rem;
}

@media (max-width: 600px) {
  .topbar h1 { font-size: 1.2rem; }
  .photo-grid { columns: 2 140px; }
  .lb-prev, .lb-next { width: 44px; height: 44px; font-size: 1.6rem; }
}
