/* ========================================================
   style.css — ໂຄງສ້າງ CSS ຫຼັກ
   ປ່ຽນສີ theme ໄດ້ໂດຍປ່ຽນ data-theme ໃນ <body>
   ======================================================== */

:root {
  --purple: #D9C6F0;
  --lightblue: #BEE1F5;
  --orange: #FFD8A8;
  --text: #3a3a3a;
  --text-soft: #6b6b6b;
  --card-bg: rgba(255, 255, 255, 0.85);
  --radius: 16px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

body[data-theme="purple"] { --accent: var(--purple); }
body[data-theme="lightblue"] { --accent: var(--lightblue); }
body[data-theme="orange"] { --accent: var(--orange); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Noto Sans Lao", "Noto Sans Thai", system-ui, sans-serif;
  color: var(--text);
  background-color: var(--accent, var(--purple));
  background-image: var(--bg-image, none);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
img { max-width: 100%; display: block; }

/* ---------- Login ---------- */
#view-login {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}
#login-lang-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  border: none;
  background: var(--card-bg);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
#login-project-name {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
}
#login-logo {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  object-fit: cover;
}
#login-user-select {
  width: 100%;
  max-width: 280px;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow);
  font-size: 16px;
  margin-bottom: 16px;
  background: var(--card-bg);
}
#login-btn {
  width: 100%;
  max-width: 280px;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--text);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

/* ---------- App shell ---------- */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top bar */
#topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--card-bg);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
#topbar .icon-btn {
  border: none;
  background: transparent;
  width: 30px;
  height: 30px;
  padding: 0;
}
#topbar .icon-btn img { width: 100%; height: 100%; }
#topbar-title {
  flex: 1;
  font-weight: 800;
  font-size: 18px;
}

/* Hamburger drawer */
#drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 29;
}
#drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 78%;
  max-width: 300px;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  z-index: 30;
  padding: 24px 18px;
  box-shadow: var(--shadow);
}
#drawer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px 22px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  margin-bottom: 12px;
}
#drawer-header img { width: 40px; height: 40px; border-radius: 50%; }
#drawer-header span { font-weight: 800; font-size: 17px; }
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 8px;
  border-radius: 12px;
  font-size: 15px;
}
.drawer-item:hover, .drawer-item:active { background: rgba(0,0,0,0.05); }
.drawer-item img { width: 24px; height: 24px; }
.drawer-item .avatar { width: 30px; height: 30px; border-radius: 50%; background: #ddd; }

/* Masonry feed */
#feed-wrap { padding: 14px; }
#masonry {
  column-count: 2;
  column-gap: 10px;
}
.photo-card {
  break-inside: avoid;
  margin-bottom: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: relative;
}
.photo-card img { width: 100%; display: block; }
.photo-actions {
  position: absolute;
  bottom: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
}
.photo-actions button {
  border: none;
  background: rgba(255,255,255,0.85);
  border-radius: 50%;
  width: 30px; height: 30px;
  padding: 5px;
}
.photo-actions img { width: 100%; height: 100%; }

/* Photo popup modal */
#photo-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
#photo-modal .modal-card {
  background: #fff;
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
#photo-modal img { width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
#photo-modal .modal-body { padding: 16px; }
#photo-modal .modal-buttons {
  display: flex; gap: 10px; padding: 0 16px 16px;
}
#photo-modal .modal-buttons button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  font-weight: 600;
}

/* Search overlay */
#view-search { padding: 16px; }
#search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  background: #fff;
}
#search-box img { width: 20px; height: 20px; flex-shrink: 0; }
#search-input {
  flex: 1;
  width: 100%;
  padding: 10px 0;
  border: none;
  font-size: 15px;
  background: transparent;
}
#search-input:focus { outline: none; }

/* Upload view */
#view-upload { padding: 20px; max-width: 420px; margin: 0 auto; }
.upload-source-row { display: flex; gap: 14px; justify-content: center; margin-bottom: 22px; }
.upload-source-row button {
  width: 76px; height: 76px;
  border-radius: 18px;
  border: none;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  padding: 18px;
}
#view-upload label { font-size: 13px; color: var(--text-soft); display: block; margin: 10px 0 4px; }
#view-upload input[type=text], #view-upload textarea, #view-upload select {
  width: 100%; padding: 12px; border-radius: 12px; border: none; box-shadow: var(--shadow);
  font-size: 15px; background: #fff;
}
#upload-preview { width: 100%; border-radius: var(--radius); margin-bottom: 10px; display: none; }
#upload-submit-btn {
  width: 100%; margin-top: 18px; padding: 14px; border-radius: 12px; border: none;
  background: var(--text); color: #fff; font-weight: 700; font-size: 16px;
}

/* Settings view */
#view-settings { padding: 30px 20px; }
#settings-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 30px; }
.settings-row {
  display: flex; justify-content: flex-end;
  margin-bottom: 18px;
}
.settings-card {
  width: 78%;
  text-align: right;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.settings-card select { text-align: right; }
.bg-choices { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.bg-choices img { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; border: 2px solid transparent; }
.bg-choices img.selected { border-color: var(--text); }

/* Memories / Saved / Liked (reuse feed grid) */
#view-memories, #view-saved, #view-liked { padding: 14px; }
.view-heading { font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.memory-badge {
  display: inline-block; font-size: 12px; background: var(--card-bg);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
