/* ══════════════════════════════════════════
   APP PAGE — app.css
   PinPint dark green theme
══════════════════════════════════════════ */

:root {
  --app-bg:        #0a0f0b;
  --app-surface:   #111810;
  --app-card:      #141f15;
  --app-border:    rgba(74,222,128,0.12);
  --app-green:     #4ade80;
  --app-green-dim: #16a34a;
  --app-text:      #e8f5e9;
  --app-muted:     #6b9e7a;
  --app-danger:    #ef4444;
  --app-danger-bg: rgba(239,68,68,0.08);
  --app-radius:    14px;
  --nav-h:         64px;
  --header-h:      56px;
}

/* ── BASE ── */
body.app-page {
  margin: 0;
  padding: 0;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── HEADER ── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: linear-gradient(90deg, #061008, #0c1a0d);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.app-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(74,222,128,0.1);
  border: 1px solid var(--app-border);
  color: var(--app-green);
  text-decoration: none;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.app-back-btn:hover { background: rgba(74,222,128,0.2); }

.app-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.app-logo-icon { font-size: 22px; }
.app-logo-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--app-green);
  letter-spacing: -0.3px;
}

.app-header-right { display: flex; align-items: center; gap: 10px; }

.app-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d, #4ade80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #052e16;
  font-size: 13px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(74,222,128,0.3);
}

/* ── MAIN ── */
.app-main {
  margin-top: var(--header-h);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px);
  min-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

/* ── TABS ── */
.app-tab-content {
  display: none;
  padding: 16px;
  padding-bottom: 32px;
  animation: tabFadeIn 0.25s ease;
}
.app-tab-content.active { display: block; }

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

/* ── SECTION HEADER ── */
.app-section-header { margin-bottom: 16px; }
.app-section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--app-text);
  margin: 0 0 4px;
}
.app-section-sub {
  font-size: 13px;
  color: var(--app-muted);
  margin: 0;
}

/* ── CITY SELECT ── */
.app-city-select-wrap {
  margin-bottom: 12px;
}
.app-city-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  color: var(--app-text);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234ade80' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
.app-city-select:focus {
  outline: none;
  border-color: var(--app-green);
  box-shadow: 0 0 0 2px rgba(74,222,128,0.15);
}

/* ── PUB STATS BAR ── */
.app-pub-stats {
  font-size: 12px;
  color: var(--app-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 10px;
  padding: 0 2px;
}
.app-pub-stats span { color: var(--app-green); }

/* ── PUB LIST ── */
.app-pub-list { display: flex; flex-direction: column; gap: 8px; }

.app-pub-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.app-pub-item:hover, .app-pub-item:active {
  background: rgba(74,222,128,0.07);
  border-color: rgba(74,222,128,0.3);
  transform: translateX(2px);
}

.app-pub-item.visited { border-left: 3px solid var(--app-green); }

.app-pub-number {
  font-size: 11px;
  color: var(--app-muted);
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.app-pub-visited-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--app-green);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(74,222,128,0.5);
}
.app-pub-unvisited-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.app-pub-info { flex: 1; min-width: 0; }
.app-pub-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--app-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-pub-addr {
  font-size: 12px;
  color: var(--app-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-pub-rating {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 700;
  flex-shrink: 0;
}
.app-pub-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.app-pub-price {
  font-size: 11px;
  color: var(--app-green);
  font-weight: 700;
  white-space: nowrap;
}
.app-pub-arrow {
  font-size: 16px;
  color: var(--app-muted);
  flex-shrink: 0;
}

/* ── EMPTY STATE ── */
.app-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 10px;
}
.app-empty-icon { font-size: 40px; }
.app-empty-text { font-size: 15px; color: var(--app-muted); font-weight: 500; }
.app-cta-btn {
  margin-top: 8px;
  padding: 10px 24px;
  background: var(--app-green);
  color: #052e16;
  border-radius: 99px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}

/* ════════════════════════════
   CHAT
════════════════════════════ */

/* Friend conversation list */
.chat-friend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.18s;
  position: relative;
}
.chat-friend-row:hover, .chat-friend-row:active {
  background: rgba(74,222,128,0.07);
}

.chat-friend-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d, #4ade80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #052e16;
  font-size: 16px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.chat-online-indicator {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--app-card);
}

.chat-friend-info { flex: 1; min-width: 0; }
.chat-friend-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--app-text);
}
.chat-friend-preview {
  font-size: 12px;
  color: var(--app-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-friend-time {
  font-size: 11px;
  color: var(--app-muted);
  flex-shrink: 0;
}
.chat-unread-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--app-green);
  color: #052e16;
  font-size: 10px;
  font-weight: 800;
  border-radius: 99px;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}

/* Conversation view */
.chat-conversation-view {
  position: fixed;
  inset: 0;
  background: var(--app-bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.chat-conv-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(90deg, #061008, #0c1a0d);
  border-bottom: 1px solid var(--app-border);
  flex-shrink: 0;
  padding-top: max(12px, env(safe-area-inset-top));
}
.chat-back-btn {
  background: none;
  border: none;
  color: var(--app-green);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  font-family: inherit;
}
.chat-conv-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d, #4ade80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #052e16;
  font-size: 15px;
  overflow: hidden;
  flex-shrink: 0;
}
.chat-conv-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--app-text);
}
.chat-conv-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--app-muted);
  margin-top: 2px;
}
.chat-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #6b9e7a;
}
.chat-status-dot.online { background: #22c55e; box-shadow: 0 0 5px #22c55e; }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chat-loading { color: var(--app-muted); font-size: 13px; text-align: center; padding: 24px; }

.chat-msg {
  max-width: 72%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-msg.mine {
  align-self: flex-end;
  background: var(--app-green);
  color: #052e16;
  font-weight: 500;
  border-bottom-right-radius: 4px;
}
.chat-msg.theirs {
  align-self: flex-start;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  border-bottom-left-radius: 4px;
}
.chat-msg-time {
  font-size: 10px;
  color: rgba(5,46,22,0.6);
  margin-top: 3px;
  text-align: right;
}
.chat-msg.theirs .chat-msg-time { color: var(--app-muted); }

.chat-date-divider {
  text-align: center;
  font-size: 11px;
  color: var(--app-muted);
  margin: 8px 0;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Input bar */
.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--app-surface);
  border-top: 1px solid var(--app-border);
  flex-shrink: 0;
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 99px;
  color: var(--app-text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.chat-input:focus { border-color: rgba(74,222,128,0.4); }
.chat-send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--app-green);
  border: none;
  color: #052e16;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.chat-send-btn:hover { background: #22c55e; }

/* ════════════════════════════
   SETTINGS
════════════════════════════ */
.settings-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius);
  padding: 16px;
  margin-bottom: 12px;
}
.settings-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--app-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

/* Avatar row */
.settings-avatar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.settings-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #15803d, #4ade80);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: #052e16;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid rgba(74,222,128,0.3);
}
.settings-avatar-hint {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  opacity: 0;
  transition: opacity 0.2s;
}
.settings-avatar:hover .settings-avatar-hint { opacity: 1; }
.settings-avatar-name { font-size: 17px; font-weight: 700; color: var(--app-text); }
.settings-avatar-email { font-size: 12px; color: var(--app-muted); margin-top: 2px; }

/* Form fields */
.settings-field { margin-bottom: 12px; }
.settings-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.settings-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  color: var(--app-text);
  font-size: 14px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  box-sizing: border-box;
}
.settings-input:focus {
  border-color: rgba(74,222,128,0.4);
  background: rgba(74,222,128,0.04);
}
.settings-save-btn {
  width: 100%;
  padding: 11px;
  background: rgba(74,222,128,0.15);
  border: 1px solid rgba(74,222,128,0.3);
  border-radius: 10px;
  color: var(--app-green);
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-save-btn:hover { background: rgba(74,222,128,0.25); }

/* Toggle rows */
.settings-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--app-border);
}
.settings-toggle-row:last-child { border-bottom: none; }
.settings-toggle-label { font-size: 14px; font-weight: 600; color: var(--app-text); }
.settings-toggle-sub { font-size: 12px; color: var(--app-muted); margin-top: 2px; }

/* Toggle switch */
.settings-toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.settings-toggle input { opacity: 0; width: 0; height: 0; }
.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.settings-toggle input:checked + .settings-toggle-slider { background: var(--app-green); }
.settings-toggle input:checked + .settings-toggle-slider::before { transform: translateX(20px); }

/* Danger zone */
.settings-danger-card { border-color: rgba(239,68,68,0.2); }
.settings-danger-text { font-size: 13px; color: var(--app-muted); margin: 0 0 14px; line-height: 1.5; }
.settings-delete-btn {
  width: 100%;
  padding: 11px;
  background: var(--app-danger-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  color: var(--app-danger);
  font-size: 14px;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
}
.settings-delete-btn:hover { background: rgba(239,68,68,0.15); }

/* ════════════════════════════
   BOTTOM NAV
════════════════════════════ */
.app-bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: linear-gradient(0deg, #061008, #0c1a0d);
  border-top: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
.app-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  position: relative;
  transition: transform 0.15s;
}
.app-nav-btn:active { transform: scale(0.92); }
.app-nav-icon { font-size: 22px; filter: grayscale(0.5) opacity(0.5); transition: filter 0.2s; }
.app-nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--app-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transition: color 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.app-nav-btn.active .app-nav-icon { filter: none; }
.app-nav-btn.active .app-nav-label { color: var(--app-green); }
.app-nav-btn.active::after {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 2px;
  background: var(--app-green);
  border-radius: 0 0 2px 2px;
}
.app-nav-badge {
  position: absolute;
  top: 5px; right: calc(50% - 16px);
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: 99px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

/* ════════════════════════════
   MODAL
════════════════════════════ */
.app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.app-modal {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}
.app-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--app-text);
  margin-bottom: 10px;
}
.app-modal-text {
  font-size: 13px;
  color: var(--app-muted);
  line-height: 1.55;
  margin-bottom: 16px;
}
.app-modal-actions { display: flex; gap: 10px; }
.app-modal-cancel {
  flex: 1;
  padding: 11px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--app-border);
  border-radius: 10px;
  color: var(--app-muted);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}
.app-modal-confirm {
  flex: 1;
  padding: 11px;
  background: var(--app-danger-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px;
  color: var(--app-danger);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
}

/* ── TOAST ── */
.app-toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(20,31,21,0.98);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.app-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── DESKTOP ADJUSTMENTS ── */
@media (min-width: 640px) {
  .app-main { max-width: 600px; margin-left: auto; margin-right: auto; }
  .chat-conversation-view { max-width: 600px; left: 50%; transform: translateX(-50%); }
  .app-bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); border-left: 1px solid var(--app-border); border-right: 1px solid var(--app-border); }
  .app-header { justify-content: center; }
  .app-header-logo { max-width: 600px; width: 100%; }
}

/* ── AD SLOTS ── */
/* Ad slots are collapsed until Google confirms a fill (.ad-filled added by
   the ad controller script). No reserved 100px box, no empty grey strip. */
.app-ad-slot{width:100%;max-height:0;min-height:0;margin:0;overflow:hidden;border:none;background:transparent;transition:max-height .3s ease}
.app-ad-slot.ad-filled{max-height:300px;min-height:60px;margin:12px 0;border-radius:10px;background:rgba(255,255,255,0.03);border:1px solid rgba(255,255,255,0.06)}
.app-ad-slot ins.adsbygoogle[data-ad-status="unfilled"]{display:none!important}
