@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap');

/* =====================
   VARIABLES
===================== */
:root {
  --bg: #0b0b0b;
  --card: #ffffff;
  --card-text: #0b0b0b;
  --muted: #9a9a9a;
  --accent: #ff4d6d;
  --divider: #1b1b1b;

  --text-light: #eaeaea;
  --text-muted: #9a9a9a;

  --header-height: 140px;
  --footer-height: 78px;
}

/* =====================
   BASE
===================== */
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  font-family: 'Inter', 'Poppins', Arial, sans-serif;
  color: var(--text-light);
  overflow: hidden;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* =====================
   HEADER
===================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--divider);
  padding: 10px 15px;
  z-index: 100;
}

.top-banner {
  background: #2a2a2a;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 22px;
  font-weight: 600;
  text-align: center;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-container {
  position: relative;
  flex: 1;
  margin: 0 15px;
  max-width: calc(100% - 100px);
}

.search-bar {
  width: 100%;
  padding: 10px 15px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 20px;
  color: var(--text-light);
  font-size: 14px;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-bar:focus {
  outline: none;
  border-color: var(--text-light);
}

.clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0;
}

.clear-search.visible {
  opacity: 1;
}

.menu-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 22px;
  cursor: pointer;
}

/* =====================
   CATEGORY BAR
===================== */
.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-item {
  padding: 6px 14px;
  background: #1b1b1b;
  border-radius: 16px;
  font-size: 13px;
  color: var(--text-light);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid #242424;
}

.category-item.active {
  background: #fff;
  color: #111;
}

/* =====================
   FEED
===================== */
.feed-wrap {
  position: absolute;
  top: var(--header-height);
  bottom: var(--footer-height);
  left: 0;
  right: 0;
  overflow: hidden;
}

.feed {
  height: 100%;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =====================
   POSTS
===================== */
.post-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.avatar-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #333;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seller-avatar {
  background: #fff;
  color: #000;
}

.buyer-avatar {
  background: #333;
}

.admin-avatar {
  background: #fff;
  color: #2a2a2a;
}

.post {
  flex: 1;
}

.username {
  font-size: 14px;
  color: #a8a8a8;
  margin-bottom: 4px;
}

.post-text {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 15px;
}

.post-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chat-btn,
.report-btn {
  background: #1b1b1b;
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 13px;
  cursor: pointer;
}

.divider-line {
  border-top: 1px solid var(--divider);
  margin-top: 12px;
}

/* =====================
   ADMIN POSTS
===================== */
.admin-post {
  background: #2a2a2a;
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 10px;
}

.admin-announcement {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  text-align: center;
  margin-bottom: 6px;
}

/* =====================
   POST PHOTOS
===================== */
.post-photo img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 8px;
  margin-top: 10px;
  cursor: pointer;
}

/* =====================
   FOOTER
===================== */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-height);
  background: #111;
  border-top: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  z-index: 100;
}

.create-post-button {
  width: 100%;
  max-width: 700px;
  padding: 15px;
  background: #2a2a2a;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* =====================
   MODALS
===================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 500;
}

.modal-content {
  background: #2a2a2a;
  width: 90%;
  max-width: 450px;
  padding: 20px;
  border-radius: 14px;
  color: #fff;
  display: block;
  clear: both;
}

.modal-content h2 {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: #fff;
  letter-spacing: 0.5px;
}

.modal-textarea {
  width: 100% !important;
  min-height: 120px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #ddd;
  resize: none;
  font-size: 14px;
  box-sizing: border-box !important;
  border-color: #111;
}

#modalUsername,
#sellerWhatsApp,
#buyerWhatsApp {
  width: 100% !important;
  padding: 8px 12px !important;
  margin-bottom: 10px !important;
  font-size: 14px !important;
  height: 40px !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  border-color: #111 !important;
  outline: none !important;
  float: none !important;
}

.modal-select {
  width: 100% !important;
  padding: 8px 12px !important;
  margin-bottom: 10px !important;
  font-size: 14px !important;
  height: 40px !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  border-color: #111 !important;
  outline: none !important;
}

.modal-post-btn {
  background: #2a2a2a;
  color: #fff;
  border: 2px solid #ccc;
  padding: 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.modal-close {
  background: #2a2a2a;
  border: 2px solid #ccc;
  padding: 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  color: #fff;
}

.hidden {
  display: none;
}

/* =====================
   PHOTO UPLOAD
===================== */
.photo-label {
  display: inline-block;
  padding: 12px 20px;
  background: #2a2a2a;
  border-radius: 20px;
  cursor: pointer;
  border-color: #ccc !important;
  text-align: center;
  border: 2px solid #ccc;
}

/* =====================
   MENU
===================== */
.menu-panel {
  position: fixed;
  top: 0;
  right: -260px;
  width: 260px;
  height: 100%;
  background: #111;
  color: #fff;
  transition: right 0.3s ease;
  z-index: 300;
}

.menu-panel.show {
  right: 0;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid #222;
}

.menu-link {
  padding: 12px;
  background: none;
  border: none;
  color: #ddd;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid #1c1c1c;
}

.menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 250;
}

.menu-overlay.show {
  display: block;
}

/* =====================
   INFO & POPUP
===================== */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 600;
  overflow-y: auto;
}

.info-box {
  background: #000;
  padding: 18px;
  border-radius: 10px;
  color: #fff;
  max-width: 450px;
  width: 90%;
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.popup-box {
  background: #111;
  color: #fff;
  padding: 20px;
  border-radius: 10px;
  max-width: 350px;
  width: 85%;
  text-align: center;
}

.popup-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
}

.contact-admin-btn {
  background: var(--accent);
  color: #fff;
  margin-bottom: 10px;
}

.loading-posts {
  text-align: center;
  margin-top: 40px;
  font-size: 15px;
  color: #aaa;
  opacity: 0.8;
}

.post-text a {
  color: #1DA1F2;
  text-decoration: underline;
  word-break: break-word;
}