/* =========================
   0) Base / legacy (safe to keep)
   ========================= */

body {
  background-color: black;
  color: white;
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

html,
body {
  overflow-x: hidden;
}

/* Hide legacy heading if present */
h1 {
  display: none;
}

/* Legacy containers (kept in case HTML still has them) */
#auth-ui {
  padding: 20px;
  max-width: 400px;
  width: 90%;
  margin-bottom: 20px;
}

#auth-ui h2 {
  display: none;
}

#app-content {
  padding: 20px;
  border-radius: 8px;
  background-color: #333;
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  max-width: 400px;
  width: 90%;
  margin-bottom: 20px;
}

/* Default button style (many views override this) */
button {
  background-color: white;
  color: black;
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin: 5px;
  font-size: 16px;
}

button:hover {
  background-color: #e0e0e0;
}

p { margin: 10px 0; }
ul { list-style: none; padding: 0; }
li {
  background-color: #444;
  margin-bottom: 5px;
  padding: 8px;
  border-radius: 4px;
}

li img {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  background-color: #fff;
}

/* Global hide helper (critical for view switching) */
.hidden {
  display: none !important;
}

/* Error text */
.error {
  color: #ff6b6b;
  margin-top: 8px;
}

/* Make the app container full width so view backgrounds can fill the screen */
#app {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Remove top bar entirely */
#topbar {
  display: none !important;
}

/* =========================
   1) Login + Categories views (background image)
   ========================= */

#loginView,
#categoriesView {
  background-image: url("assets/projectchristmas2025background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  min-height: 100vh;
  width: 100%;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  position: relative;
  padding: 40px 20px;
  box-sizing: border-box;
}

/* Ensure content sits above background */
#loginView > *,
#categoriesView > * {
  position: relative;
  z-index: 1;
}

/* -------------------------
   Login styling
   ------------------------- */

#loginView label {
  display: none;
}

#loginView h2 {
  display: none;
}

/* Bubble inputs */
#loginView input[type="text"],
#loginView input[type="password"] {
  width: min(420px, 90vw);
  padding: 14px 18px;
  margin: 10px 0;

  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;

  background: rgba(255,255,255,0.10);
  outline: none;

  text-align: center;
  font-size: 1.2rem;            /* ~20% bigger */
  color: #ffffff;               /* typed text white */
}

#loginView input::placeholder {
  text-align: center;
  font-size: 1.2rem;
  color: rgba(255,255,255,0.85);
}

/* Solid white login button */
#loginView button#loginBtn {
  width: min(100px, 90vw);
  padding: 12px 18px;
  margin-top: 14px;

  border: none;
  border-radius: 999px;

  background: #fff;
  color: #000;
  font-weight: 600;
}

#loginView #loginMsg {
  width: min(420px, 90vw);
  text-align: center;
}

/* -------------------------
   Categories styling
   ------------------------- */

#categoriesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

#categoriesView .catName {
  font-size: 1.5em;
  margin-bottom: 6px;
}

#categoriesView .catDesc {
  font-style: italic;
  opacity: 0.85;
}

/* Categories logout button (styled like login button) */
/* Categories logout button (bottom-center) */
#categoriesView #logoutBtnCategories {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);

  margin: 0 !important;
  right: auto !important;

  width: 120px;          /* match your other nav buttons */
  padding: 12px 18px;

  border: none;
  border-radius: 999px;

  background: #fff;
  color: #000;
  font-weight: 600;

  cursor: pointer;
  z-index: 9999;
}

/* =========================
   2) Category (individual group) page
   ========================= */

#categoryView {
  background: #ffffff;
  color: #000000;
  min-height: 100vh;
  width: 100vw;
  padding: 40px 20px;
  box-sizing: border-box;
}

/* Center title/desc */
#categoryHeader {
  width: 100%;
  max-width: 900px;
  margin: 0 auto 10px auto;
  text-align: center;
}

#categoryTitle {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
}

#categoryDesc {
  max-width: 900px;
  margin: 10px auto 30px auto;
  text-align: center;
  font-style: italic;
  color: rgba(0, 0, 0, 0.7);
}

/* Hide old inline upload + gallery header/status */
#uploadSection { display: none !important; }
#galleryHeader { display: none !important; }
#galleryStatus { display: none !important; }

/* =========================
   3) Buttons: Contribute / Back / Select + Selection bar
   ========================= */

#contributeBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;

  width: 120px;
  padding: 12px 18px;

  border: none;
  border-radius: 999px;

  background: #fff;
  color: #000;
  font-weight: 600;
  cursor: pointer;
}

#backToCatsBtn {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;

  width: 120px;
  padding: 12px 18px;

  border: none;
  border-radius: 999px;

  background: #fff;
  color: #000;
  font-weight: 600;
  cursor: pointer;
}

#selectBtn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;

  width: 120px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;

  background: #fff;
  color: #000;
  font-weight: 600;
  cursor: pointer;
}

/* Selection action bar (bottom-center) */
#selectionBar {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 10000;

  display: flex;
  gap: 10px;
  padding: 10px;

  background: rgba(255,255,255,0.95);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}

#selectionBar button {
  width: 120px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
}

#deleteSelectedBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================
   4) Contribute modal
   ========================= */

#contributeModal {
  position: fixed;
  inset: 0;
  z-index: 10000;

  display: flex;
  justify-content: center;
  align-items: center;

  background: rgba(0,0,0,0.45);
}

#contributeModalCard {
  width: min(520px, 92vw);
  background: #fff;
  color: #000;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  position: relative;
}

#contributeModalCard h3 {
  text-align: center;
  margin: 0 0 14px 0;
}

#closeContributeModalBtn {
  position: absolute;
  top: 12px;
  right: 12px;

  width: 36px;
  height: 36px;

  border: none;
  border-radius: 999px;

  background: rgba(0,0,0,0.06);
  color: #000;
  cursor: pointer;
  font-size: 16px;
}

#contributeModalCard input[type="text"],
#contributeModalCard input[type="date"],
#contributeModalCard input[type="file"] {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 14px 0;
}

#uploadBtnModal {
  width: 100%;
  padding: 12px 18px;

  border: none;
  border-radius: 999px;

  background: #000;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

/* =========================
   Contribute modal text sizing
   ========================= */

/* Labels / general text inside modal */
#contributeModalCard {
  font-size: 1.05rem;   /* slightly larger overall */
}

/* Text inputs + date + file picker */
#contributeModalCard input[type="text"],
#contributeModalCard input[type="date"],
#contributeModalCard input[type="file"],
#contributeModalCard textarea {
  font-size: 1.05rem;
}

/* Upload button text */
#uploadBtnModal {
  font-size: 1.05rem;
}

/* Error / status text inside modal */
#contributeModalCard .error,
#contributeModalCard .status {
  font-size: 0.95rem;
}

/* =========================
   5) Gallery masonry + photo cards
   ========================= */

/* Masonry layout (CSS columns) */
#galleryGrid {
  display: block !important;
  column-count: 4;
  column-gap: 20px !important;     /* horizontal spacing */
  padding: 0 30px;
  padding-bottom: 30px;
  box-sizing: border-box;
}

/* Each card is a masonry "brick" */
.photoCard {
  display: inline-block !important;
  width: 100%;
  margin: 0 0 20px 0;              /* vertical spacing (match column-gap) */
  break-inside: avoid;
  -webkit-column-break-inside: avoid;

  background: #f7d6df;             /* light pink */
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.12);

  /* Content layout */
  box-sizing: border-box;
}

/* Image stays uncropped */
.photoImg {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

/* Per-photo text styling */
.photoDate,
.photoLocation {
  text-align: center;
  font-size: 0.95rem;
  color: rgba(0,0,0,0.75);
}

.photoLocation {
  margin-bottom: 6px;
  font-style: italic;
}

.photoCaption {
  text-align: left;
  font-size: 1rem;
  color: rgba(0,0,0,0.9);
}

/* Selection UX */
.photoCard.selectable {
  cursor: pointer;
}

/* IMPORTANT: only ONE selection highlight (on the image) */
.photoCard.selected {
  outline: none; /* prevents the glitched card outline */
}

.photoCard.selected .photoImg {
  outline: 4px solid #000;
  outline-offset: 4px;
  border-radius: 12px;
}

/* =========================
   Mobile install screen
   ========================= */

#installView {
  min-height: 100vh;
  width: 100vw;
  padding: 40px 20px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;
}

#installView h2 {
  margin: 0 0 12px 0;
}

.install-subtitle {
  max-width: 520px;
  margin: 0 0 18px 0;
  opacity: 0.9;
}

#installActions {
  margin: 0 0 18px 0;
}

#installInstructions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(720px, 100%);
}

.installCard {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
}

.installCard h3 {
  margin: 0 0 8px 0;
}

.installCard ol {
  margin: 0;
  padding-left: 18px;
}

.install-footnote {
  margin-top: 16px;
  opacity: 0.8;
}

/* =========================
   PWA-only layout pass (Steps 1–4)
   ========================= */

html.pwa body {
  display: block;
  min-height: 100vh;
  margin: 0;
  text-align: center;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);

  position: relative;
  background-color: transparent !important;
}

html.pwa body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("/assets/projectchristmas2025mobilebackground.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

html.pwa #app {
  background: transparent !important;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* IMPORTANT: let the body background show through in PWA */
html.pwa #loginView,
html.pwa #categoriesView {
  background-image: none !important;
  background: transparent !important;
}

/* (Optional) if you also want background behind the category feed: */
html.pwa #categoryView {
  background: transparent !important;
}

/* phone-friendly widths */
html.pwa #loginView,
html.pwa #categoriesView,
html.pwa #categoryView {
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding: 22px 16px;
  padding-bottom: 110px;
  box-sizing: border-box;
}

/* Hide the header/title area in installed PWA */
html.pwa #topbar {
  display: none !important;
}

/* Bottom action containers */
html.pwa .pwaBottomActions {
  position: fixed;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 9999;

  display: grid;
  gap: 10px;
  box-sizing: border-box;

  width: calc(100vw - 24px);
  max-width: 430px;

  justify-items: stretch;
}

/* Smaller centered logout */
html.pwa .pwaBottomActions.one {
  width: min(240px, calc(100vw - 24px)) !important;
  justify-items: center;
}

html.pwa .pwaBottomActions.three {
  grid-template-columns: 1fr 1fr 1fr;
}

html.pwa .pwaBottomActions button {
  width: 95%;
  min-height: 48px;
  border-radius: 12px;
}

/* PWA: never show the original logout button (we use the PWA clone) */
html.pwa #logoutBtnCategories {
  display: none !important;
}

html.pwa #loginView {
  justify-content: flex-start !important;
  padding-top: 350px !important; /* your existing 22px + 100px shift */
}

html.pwa #pwaLogoutBtn {
  width: 120px;
  justify-self: center;
}

html.pwa #categoriesGrid {
  margin-top: 320px;
  padding-bottom: 25px;
} /* keeps space above logout */


html.pwa #categoryView {
  background: #fff !important;   /* solid white */
}

/* PWA: VSCO-style gallery but 2 columns */
html.pwa #galleryGrid {
  column-count: 2 !important;
  column-gap: 14px !important;
  padding: 0 14px !important;
  padding-bottom: 30px !important;
}

/* =========================
   Photo lightbox (click to enlarge)
   ========================= */

#photoLightbox {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  box-sizing: border-box;
  background: rgba(0,0,0,0.65);
}

#photoLightbox.hidden {
  display: none !important;
}

#photoLightboxCard {
  width: min(980px, 96vw);
  max-height: 92vh;
  background: #fff;
  color: #000;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
}

#closePhotoLightboxBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 999px;
  background: rgba(0,0,0,0.08);
  cursor: pointer;
  font-size: 18px;
}

#photoLightboxImg {
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  background: #000;
}

#photoLightboxMeta {
  padding: 14px 16px 16px 16px;
  text-align: left;
}

#photoLightboxMeta .metaLine {
  margin: 2px 0;
  opacity: 0.8;
  font-size: 0.95rem;
}

#photoLightboxMeta .metaCaption {
  margin-top: 8px;
  font-size: 1.05rem;
  opacity: 0.95;
}