/* ---------- Papa's Albums – warm scrapbook theme ---------- */

@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;600&family=Inter:wght@400;500;600&display=swap');

:root {
  --bg:        #faf6f0;
  --bg-card:   #fff8f0;
  --sepia:     #8b6914;
  --sepia-lt:  #c9a84c;
  --brown:     #5c3d2e;
  --brown-lt:  #8b6b5a;
  --cream:     #f5ead6;
  --accent:    #b8860b;
  --danger:    #c0392b;
  --success:   #27ae60;
  --text:      #3e2a1c;
  --text-lt:   #7a6455;
  --shadow:    0 2px 8px rgba(92, 61, 46, .12);
  --radius:    8px;
  --font-hand: 'Caveat', cursive;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

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

/* ---------- Header ---------- */

header {
  background: linear-gradient(135deg, var(--brown) 0%, #3e2a1c 100%);
  color: var(--cream);
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
}

header h1 {
  font-family: var(--font-hand);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: .5px;
}

header nav { display: flex; gap: .6rem; }
header nav a, header nav button {
  color: var(--cream);
  text-decoration: none;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius);
  padding: .4rem .9rem;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s;
}
header nav a:hover, header nav button:hover {
  background: rgba(255,255,255,.22);
}

/* ---------- Activity bar ---------- */

.activity-bar {
  display: none;
  gap: .8rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: .55rem 1rem;
  background: linear-gradient(90deg, var(--cream), #f9f0dc);
  border-bottom: 1px solid rgba(184, 134, 11, .2);
  font-size: .82rem;
  color: var(--brown);
}

.activity-item {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.activity-item::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- Hero / Memory ---------- */

.hero {
  position: relative;
  width: 100%;
  max-height: 420px;
  overflow: hidden;
  background: var(--brown);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  opacity: .88;
}

.hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  background: linear-gradient(transparent, rgba(62, 42, 28, .85));
  color: #fff;
}

.hero-overlay h2 {
  font-family: var(--font-hand);
  font-size: 1.8rem;
}

.hero-overlay p {
  font-size: .9rem;
  opacity: .85;
  margin-top: .25rem;
}

/* ---------- Main ---------- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ---------- Photo Grid ---------- */

.section-title {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--brown);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--cream);
  padding-bottom: .3rem;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}

.photo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.photo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(92, 61, 46, .18);
}

.photo-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.photo-card .meta {
  padding: .4rem .55rem;
  font-size: .72rem;
  color: var(--text-lt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card .face-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
}

.photo-card .note-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--brown);
  color: var(--cream);
  font-size: .65rem;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 10px;
}

.photo-card .pending-badge {
  position: absolute;
  bottom: 32px;
  left: 0;
  right: 0;
  background: rgba(184, 134, 11, .88);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  padding: 3px 6px;
  text-align: center;
  letter-spacing: .3px;
}

/* ---------- Lightbox ---------- */

.lightbox-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.88);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}
.lightbox-backdrop.active { display: flex; }

.lightbox {
  background: var(--bg-card);
  border-radius: 12px;
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.lightbox-img-wrap {
  position: relative;
  background: #1a1a1a;
  display: inline-block;
  margin: 0 auto;
  line-height: 0;
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: 65vh;
  display: block;
}

/* ---------- Face bounding boxes ---------- */

.face-box {
  position: absolute;
  border: 2px solid rgba(184, 134, 11, .8);
  border-radius: 4px;
  pointer-events: none;
}

.face-box-label {
  position: absolute;
  bottom: -1.4em;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(62, 42, 28, .8);
  color: #fff;
  font-size: .65rem;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
  font-family: var(--font-body);
}

.lightbox-info {
  padding: 1rem 1.25rem;
}

.lightbox-info h3 {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--brown);
  margin-bottom: .4rem;
}

.lightbox-info .detail-row {
  font-size: .85rem;
  color: var(--text-lt);
  margin-bottom: .2rem;
}

/* ---------- Faces in lightbox ---------- */

.faces-section {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--cream);
}

.faces-section h4 {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--brown);
  margin-bottom: .6rem;
}

.face-list {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

.face-item {
  text-align: center;
  width: 90px;
}

.face-item img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--cream);
}

.face-item .face-name {
  font-size: .75rem;
  margin-top: .2rem;
  color: var(--text-lt);
}

.face-item .face-name.unknown {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Annotation form ---------- */

.annotate-form {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .35rem;
}

.annotate-form input {
  padding: .35rem .5rem;
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  font-size: .8rem;
  flex: 1;
  min-width: 100px;
}

.annotate-form button {
  padding: .35rem .7rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
}

/* ---------- Name autocomplete ---------- */

.name-autocomplete {
  position: relative;
  flex: 1;
  min-width: 100px;
}

.name-autocomplete input {
  width: 100%;
}

.autocomplete-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--cream);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  max-height: 180px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: .4rem .6rem;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text);
}

.autocomplete-item:hover {
  background: var(--cream);
}

/* ---------- Correction form ---------- */

.correction-section {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--cream);
}

.correction-section h4 {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--brown);
  margin-bottom: .5rem;
}

.correction-form {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

.correction-select {
  padding: .35rem .5rem;
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  font-size: .8rem;
  background: #fff;
  min-width: 140px;
}

/* ---------- Notes ---------- */

.notes-section {
  margin-top: 1rem;
  padding-top: .8rem;
  border-top: 1px solid var(--cream);
}

.notes-section h4 {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--brown);
  margin-bottom: .6rem;
}

.notes-list {
  margin-bottom: .8rem;
}

.notes-empty {
  font-size: .85rem;
  color: var(--text-lt);
  font-style: italic;
}

.note-item {
  background: var(--cream);
  border-radius: var(--radius);
  padding: .6rem .8rem;
  margin-bottom: .5rem;
}

.note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .25rem;
}

.note-author {
  font-weight: 600;
  font-size: .8rem;
  color: var(--brown);
}

.note-date {
  font-size: .72rem;
  color: var(--text-lt);
}

.note-body {
  font-size: .85rem;
  color: var(--text);
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.note-form textarea {
  padding: .45rem .6rem;
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  font-size: .85rem;
  font-family: var(--font-body);
  resize: vertical;
  min-height: 50px;
}

.note-form-row {
  display: flex;
  gap: .4rem;
}

.note-form-row input {
  padding: .35rem .5rem;
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  font-size: .8rem;
  flex: 1;
}

.note-form-row button {
  padding: .35rem .7rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- Tabs ---------- */

.tab-bar {
  display: flex;
  gap: .3rem;
  margin-bottom: 1rem;
}

.tab-bar button {
  padding: .5rem 1rem;
  background: var(--cream);
  border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: .85rem;
  cursor: pointer;
  color: var(--brown-lt);
  font-weight: 500;
}

.tab-bar button.active {
  background: var(--bg-card);
  border-color: var(--cream);
  border-bottom-color: var(--bg-card);
  color: var(--brown);
}

/* ---------- Admin ---------- */

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: .75rem;
  display: flex;
  gap: 1rem;
  align-items: center;
  box-shadow: var(--shadow);
}

.admin-card img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--cream);
}

.admin-card .details { flex: 1; }
.admin-card .details h4 { font-size: 1rem; color: var(--brown); }
.admin-card .details p { font-size: .82rem; color: var(--text-lt); margin-top: .15rem; }

.admin-actions { display: flex; gap: .5rem; }

.btn {
  padding: .45rem .9rem;
  border: none;
  border-radius: var(--radius);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-approve { background: var(--success); color: #fff; }
.btn-reject  { background: var(--danger); color: #fff; }

.stats-bar {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.stat {
  background: var(--bg-card);
  border: 1px solid var(--cream);
  border-radius: var(--radius);
  padding: .7rem 1.2rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat .num {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--brown);
  font-family: var(--font-hand);
}

.stat .label {
  font-size: .75rem;
  color: var(--text-lt);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ---------- Loading ---------- */

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-lt);
  font-family: var(--font-hand);
  font-size: 1.3rem;
}

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-lt);
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  header h1 { font-size: 1.5rem; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; }
  .hero { max-height: 280px; }
  .hero img { max-height: 280px; }
  .lightbox { border-radius: 0; max-height: 100vh; }
  .admin-card { flex-direction: column; text-align: center; }
}
