/* =========================
   BASE
========================= */

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

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: #f4f1ee;
  color: #333;
  -webkit-tap-highlight-color: transparent;
}

/* =========================
   TOP BAR
========================= */

.topbar {
  background: linear-gradient(180deg, #c0392b, #a93226);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  /* Safe area for iPhone notch in standalone PWA mode */
  padding-top: max(18px, env(safe-area-inset-top));
  padding-bottom: 18px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1;
}

.logo-tiny {
  font-family: 'Gentium Book Plus', serif;
  font-weight: 700;
  font-style: italic;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
}

.logo-path {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-style: italic;
  font-size: 32px;
  color: white;
  letter-spacing: -0.5px;
}

.settings-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  opacity: 0.85;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-btn svg {
  width: 22px;
  height: 22px;
}

.settings-btn:hover,
.settings-btn:active {
  opacity: 1;
}

/* =========================
   FILTER BANNER
========================= */

.filter-banner {
  background: #fff8e7;
  border-bottom: 1px solid #f0d080;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  color: #555;
}

.filter-banner strong {
  color: #c0392b;
}

.filter-banner button {
  background: none;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  color: #555;
  transition: 0.15s;
}

.filter-banner button:hover {
  border-color: #c0392b;
  color: #c0392b;
}

/* =========================
   CONTAINER
========================= */

.container {
  max-width: 520px;
  margin: 20px auto;
  padding: 0 14px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* =========================
   COMPOSER
========================= */

.composer {
  background: #fff;
  padding: 18px;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

.composer textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid #ddd;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  height: 80px;
}

.composer textarea:focus {
  border-color: #c0392b;
}

/* =========================
   POSTING-AS CHIP
========================= */

.posting-as-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.posting-as-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f4f1ee;
  border: 1.5px solid #e8e3de;
  border-radius: 20px;
  padding: 5px 12px 5px 7px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  font-family: 'Inter', sans-serif;
}

.posting-as-chip:hover {
  border-color: #c0392b;
  background: #fdf0ef;
}

.posting-as-chip .chip-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
}

.posting-as-chip .chip-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.posting-as-chip .chip-edit {
  font-size: 11px;
  color: #aaa;
  margin-left: 1px;
}

.posting-as-prompt {
  font-size: 13px;
  color: #aaa;
  font-style: italic;
  cursor: pointer;
  padding: 6px 0;
}

.posting-as-prompt:hover { color: #c0392b; }

.name-edit-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  animation: fadeSlideIn 0.2s ease;
}

.name-edit-row input {
  flex: 1;
  padding: 9px 14px;
  border-radius: 12px;
  border: 1.5px solid #c0392b;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.name-edit-row button {
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}

.name-edit-row button:hover { background: #a93226; }

/* =========================
   MODE BAR
========================= */

.mode-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 10px 0;
}

.mode-btn {
  cursor: pointer;
  opacity: 0.35;
  transition: opacity 0.2s, transform 0.2s;
  background: none;
  border: none;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #555;
}

.mode-btn svg {
  width: 24px;
  height: 24px;
}

.mode-btn.active {
  opacity: 1;
  color: #c0392b;
  transform: scale(1.15);
}

/* =========================
   POST BUTTON
========================= */

.post-btn {
  background: #c0392b;
  color: white;
  border: none;
  padding: 12px;
  border-radius: 14px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  transition: background 0.2s, transform 0.1s;
}

.post-btn:hover  { background: #a93226; }
.post-btn:active { transform: scale(0.98); }
.post-btn:disabled { opacity: 0.6; cursor: default; }

/* =========================
   LOCATION PREVIEW
========================= */

.location-preview {
  background: #f1f1f1;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  text-align: center;
  margin-bottom: 10px;
}

/* =========================
   DAY HEADERS
========================= */

.day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #aaa;
  padding: 10px 0 6px;
}

/* =========================
   POST CARDS
========================= */

.post {
  background: #fff;
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  margin-bottom: 16px;
  animation: fadeSlideIn 0.35s ease both;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.post-user {
  display: flex;
  align-items: center;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e8e0da;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  color: white;
  flex-shrink: 0;
}

.username {
  font-weight: 600;
  font-size: 14px;
}

.filter-link {
  cursor: pointer;
  transition: color 0.15s;
}

.filter-link:hover {
  color: #c0392b;
}

.timestamp {
  font-size: 12px;
  color: #aaa;
  margin-top: 1px;
}

.text {
  margin: 10px 0 6px;
  line-height: 1.5;
  font-size: 15px;
}

.post-image {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 14px;
  margin-top: 8px;
  display: block;
  cursor: pointer;
}

/* =========================
   LOCATION PILL
========================= */

.location-pill {
  display: inline-block;
  background: #f4f1ee;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #666;
  margin: 6px 0;
}

/* =========================
   POST ACTIONS (VOTES)
========================= */

.post-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.vote-btn {
  background: #f7f4f2;
  border: 1.5px solid #ece8e5;
  border-radius: 22px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s, transform 0.12s, border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  min-height: 38px;
}

.vote-btn svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.vote-btn:hover {
  background: #eee9e5;
  border-color: #d9d0c9;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.vote-btn:active {
  transform: scale(0.93);
  box-shadow: none;
}

.vote-count {
  font-weight: 700;
  font-size: 14px;
}

.comment-hint {
  font-size: 13px;
  color: #bbb;
  cursor: pointer;
  margin-left: auto;
  transition: color 0.15s;
  padding: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.comment-hint svg {
  width: 14px;
  height: 14px;
}

.comment-hint:hover { color: #c0392b; }

/* =========================
   POST DETAIL OVERLAY
========================= */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: #f4f1ee;
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: slideInFromRight 0.28s cubic-bezier(0.32, 0.72, 0, 1);
}

.detail-overlay.hidden {
  display: none !important;
}

.detail-header {
  background: linear-gradient(180deg, #c0392b, #a93226);
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.detail-back {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
  font-family: 'Inter', sans-serif;
  line-height: 1;
}

.detail-title {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-style: italic;
  color: white;
  font-size: 20px;
  letter-spacing: -0.3px;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.detail-post {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.detail-image {
  width: 100%;
  border-radius: 14px;
  margin-top: 8px;
  cursor: pointer;
  display: block;
  pointer-events: auto;
}

.detail-votes {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

/* =========================
   COMMENT SECTION
========================= */

.comment-section {
  background: #fff;
  border-top: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  max-height: 44vh;
  flex-shrink: 0;
}

.comment-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 0;
  -webkit-overflow-scrolling: touch;
}

.comment {
  padding: 9px 0;
  border-bottom: 1px solid #f5f5f5;
  font-size: 14px;
  line-height: 1.45;
  animation: fadeSlideIn 0.25s ease;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.comment:last-child { border-bottom: none; }

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  flex-shrink: 0;
  margin-top: 1px;
}

.comment-content {
  flex: 1;
}

.comment-user {
  font-weight: 600;
  margin-right: 6px;
  color: #333;
}

.comment-text {
  color: #555;
}

.no-comments {
  text-align: center;
  color: #bbb;
  font-size: 14px;
  padding: 20px 0;
  margin: 0;
}

.comment-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid #f0f0f0;
  background: #fff;
  flex-shrink: 0;
}

.comment-input-row input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.comment-input-row input:focus {
  border-color: #c0392b;
}

.comment-input-row button {
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}

.comment-input-row button:hover { background: #a93226; }

/* =========================
   IMAGE MODAL
========================= */

.image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.image-modal.hidden {
  display: none !important;
}

.image-modal img {
  max-width: 95%;
  max-height: 85%;
  border-radius: 14px;
}

.close-modal-btn {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: 24px;
  color: white;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.close-modal-btn:hover { opacity: 1; }

/* =========================
   SETTINGS / INSTALL MODAL
========================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.modal-overlay.hidden {
  display: none !important;
}

.settings-card {
  background: #fff;
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  animation: slideUpCard 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

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

.settings-title {
  font-size: 18px;
  font-weight: 700;
  color: #222;
}

.close-btn {
  background: #f0f0f0;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: background 0.15s;
  flex-shrink: 0;
}

.close-btn:hover { background: #e4e4e4; }

.settings-subtitle {
  font-size: 15px;
  color: #555;
  margin: 0 0 18px;
  line-height: 1.4;
}

.install-steps {
  margin: 0 0 18px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1;
  color: #333;
}

.install-steps li {
  padding: 7px 0;
  line-height: 1.4;
}

.step-note {
  color: #999;
  font-size: 13px;
}

.share-icon {
  display: inline-block;
  background: #007aff;
  color: white;
  border-radius: 6px;
  padding: 1px 5px;
  font-size: 13px;
  vertical-align: middle;
  font-style: normal;
}

.settings-tip {
  background: #f4f1ee;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #666;
  margin: 0;
  line-height: 1.4;
}

.settings-version {
  text-align: center;
  font-size: 11px;
  color: #bbb;
  padding: 10px 0 2px;
  letter-spacing: 0.04em;
}

/* =========================
   ANIMATIONS
========================= */

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

@keyframes slideInFromRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

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

/* =========================
   CHARACTER COUNTER
========================= */

.char-counter {
  text-align: right;
  font-size: 12px;
  color: #ccc;
  margin: -6px 0 8px;
  transition: color 0.2s;
}

.char-counter.char-near { color: #e67e22; }
.char-counter.char-over { color: #c0392b; font-weight: 600; }

/* =========================
   IMAGE-ONLY POST CARD
========================= */

.post--image-only {
  padding: 0;
  overflow: hidden;
}

.post--image-only .post-header {
  padding: 12px 14px 8px;
}

.post--image-only .location-pill {
  display: block;
  margin: 0 14px 8px;
}

.post--image-only .post-image {
  border-radius: 0;
  margin: 0;
}

.post--image-only .post-actions {
  padding: 8px 14px 14px;
  margin-top: 0;
  border-top: none;
}

/* =========================
   SHARE BUTTON
========================= */

.share-btn {
  margin-left: auto;
}


/* =========================
   UTILITY
========================= */

.hidden {
  display: none !important;
}

/* =========================
   TOUCH ZOOM CONTROL
   Disabled globally, re-enabled only in
   image modal and detail overlay.
========================= */

body {
  touch-action: pan-y; /* vertical scroll only — no pinch zoom */
  -webkit-user-select: none;
  user-select: none;
}

/* Re-enable zoom inside fullscreen image modal */
#imageModal {
  touch-action: auto;
}

#modalImage {
  touch-action: auto;
  pointer-events: auto;
  max-width: 95vw;
}

/* Re-enable zoom inside detail overlay */
.detail-overlay {
  touch-action: pan-y pinch-zoom;
}

/* =========================
   LINK STYLING
========================= */

.post-link {
  color: #2980b9;
  text-decoration: none;
  border-bottom: 1px solid rgba(41, 128, 185, 0.35);
  word-break: break-all;
}

.post-link:hover {
  color: #1a6a9a;
  border-bottom-color: #1a6a9a;
}

/* =========================
   IMAGE GRID (multi-photo)
========================= */

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 4px;
  margin-top: 10px;
  border-radius: 12px;
  overflow: hidden;
}

.image-grid img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: pointer;
}

/* =========================
   AUTH OVERLAY
========================= */

.auth-overlay {
  position: fixed;
  inset: 0;
  background: #f4f1ee;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top));
}

.auth-overlay.hidden {
  display: none !important;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.10);
  animation: slideUpCard 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

.auth-logo {
  display: flex;
  align-items: baseline;
  gap: 6px;
  justify-content: center;
  margin-bottom: 24px;
}

.auth-title {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #222;
  margin: 0 0 20px;
  text-align: center;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-fields input {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 1.5px solid #ddd;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.auth-fields input:focus {
  border-color: #c0392b;
}

.auth-error {
  color: #c0392b;
  font-size: 13px;
  margin: 0;
  min-height: 18px;
  text-align: center;
}

.auth-submit-btn {
  background: #c0392b;
  color: white;
  border: none;
  padding: 14px;
  border-radius: 14px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  transition: background 0.2s, transform 0.1s;
  margin-top: 4px;
}

.auth-submit-btn:hover   { background: #a93226; }
.auth-submit-btn:active  { transform: scale(0.98); }
.auth-submit-btn:disabled { opacity: 0.6; cursor: default; }

.auth-toggle-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  text-align: center;
  padding: 4px;
  transition: color 0.15s;
}

.auth-toggle-btn:hover { color: #c0392b; }

/* =========================
   SETTINGS — ACCOUNT SECTION
========================= */

.settings-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #f0f0f0;
}

.settings-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: #bbb;
  margin-bottom: 12px;
}

.settings-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.settings-display-name {
  font-weight: 600;
  font-size: 15px;
  color: #222;
}

.settings-edit-btn {
  background: none;
  border: 1.5px solid #ddd;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  color: #555;
  transition: border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}

.settings-edit-btn:hover {
  border-color: #c0392b;
  color: #c0392b;
}

.settings-name-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #c0392b;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.settings-save-btn {
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 9px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
  margin-bottom: 8px;
}

.settings-save-btn:hover    { background: #a93226; }
.settings-save-btn:disabled { opacity: 0.6; }

.settings-err {
  color: #c0392b;
  font-size: 12px;
  margin: 0 0 8px;
  min-height: 16px;
}

.logout-btn {
  width: 100%;
  background: none;
  border: 1.5px solid #e0e0e0;
  border-radius: 12px;
  padding: 10px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #888;
  cursor: pointer;
  margin-top: 4px;
  transition: border-color 0.15s, color 0.15s;
}

.logout-btn:hover {
  border-color: #c0392b;
  color: #c0392b;
}
