/* ----- Reset & Variables ----- */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-body: #f6f9fc;
  --bg-card: #ffffff;
  --text-primary: #0b1a2e;
  --text-secondary: #2d4b6a;
  --text-muted: #5b7a9a;
  --gold: #d4a24e;
  --gold-light: #f2e1b9;
  --gold-bg: #fcf7ed;
  --forest: #1f3b4c;
  --forest-light: #e8f0f5;
  --shadow-sm: 0 4px 12px rgba(0, 20, 30, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 20, 30, 0.08);
  --radius-card: 20px;
  --radius-btn: 40px;
  --transition: 0.25s ease;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  padding: 0 0 40px 0;
  margin: 0;
}
[dir="rtl"] body { font-family: 'Noto Sans Arabic', 'Inter', sans-serif; }

a { text-decoration: none; color: inherit; }
img, video { display: block; max-width: 100%; }

/* ----- Top Bar ----- */
.topbar {
  background: var(--bg-card);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 10px;
}
.topbar-brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--forest);
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-brand i { color: var(--gold); }
.topbar-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.topbar-nav a {
  margin-inline-start: 8px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--radius-btn);
}
.topbar-nav a:hover { background: var(--bg-body); }
.topbar-nav a.active { color: var(--gold); background: var(--gold-bg); }
.topbar-nav a i { margin-inline-end: 6px; }
.topbar-lang { display: flex; gap: 4px; margin-inline-start: 10px; background: var(--bg-body); border-radius: var(--radius-btn); padding: 3px; }
.topbar-lang a { margin: 0; padding: 6px 11px; font-size: 0.76rem; border-radius: var(--radius-btn); color: var(--text-muted); }
.topbar-lang a.active { background: var(--forest); color: #fff; }

/* ----- Main container ----- */
.feed-shell { max-width: 1300px; margin: 0 auto; padding: 0 20px; }

.feed-hero {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  padding: 30px 24px;
  text-align: center;
  margin-bottom: 28px;
}
.feed-hero h1 { font-size: 1.4rem; margin-bottom: 6px; color: var(--forest); }
.feed-hero p { color: var(--text-muted); font-size: 0.92rem; }

/* ----- Profile header ----- */
.profile-header {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 36px;
  transition: var(--transition);
}
.profile-cover {
  height: 110px;
  background: linear-gradient(145deg, #d4a24e20, #1f3b4c30), linear-gradient(145deg, #f2e1b9, #d4a24e);
  background-blend-mode: overlay;
}
.profile-info {
  padding: 0 28px 28px 28px;
  position: relative;
  margin-top: -40px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 24px;
}
.profile-avatar {
  border-radius: 100%;
  border: 4px solid white;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.profile-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-inline-end: auto;
}
.profile-name-row h1 { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.4px; color: var(--text-primary); }
.tier-badge {
  background: var(--gold-bg);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.profile-meta {
  width: 100%;
  color: var(--text-secondary);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 2px;
}
.profile-meta i { margin-inline-end: 4px; color: var(--gold); }
.profile-stats { display: flex; gap: 28px; font-size: 0.92rem; color: var(--text-secondary); }
.profile-stats strong { color: var(--text-primary); font-weight: 700; font-size: 1.05rem; margin-inline-end: 4px; }

.profile-rating { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; flex-wrap: wrap; margin-top: -4px; }
.stars { display: flex; gap: 3px; cursor: pointer; }
.stars .star-display { color: var(--gold); font-size: 1rem; transition: transform 0.15s ease; }
.stars .star-display:hover { transform: scale(1.15); }
.rating-summary { font-size: 0.82rem; color: var(--text-muted); }

.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-inline-start: auto; }

.btn {
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 9px 22px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}
.btn-gold { background: var(--gold); color: white; box-shadow: 0 4px 10px rgba(212, 162, 78, 0.25); }
.btn-gold:hover { background: #b8893e; transform: translateY(-1px); }
.btn-outline { border: 1.5px solid var(--forest); color: var(--forest); background: transparent; }
.btn-outline:hover { background: var(--forest-light); }
.profile-follow-btn.is-following { background: var(--forest); color: white; }

.profile-tabs { display: flex; gap: 8px; width: 100%; border-top: 1px solid #e9edf2; margin-top: 4px; padding-top: 12px; }
.profile-tab {
  background: transparent;
  border: none;
  padding: 10px 18px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-btn);
  transition: var(--transition);
  font-size: 0.88rem;
  font-family: inherit;
}
.profile-tab.active { color: var(--forest); background: var(--forest-light); }
.profile-tab-panel[hidden] { display: none; }

.about-card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.95rem;
  margin-bottom: 28px;
}
.about-card p { display: flex; align-items: center; gap: 10px; }
.about-card i { color: var(--gold); width: 16px; }

/* ----- Filter bar ----- */
.gallery-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 14px 18px;
  border-radius: var(--radius-btn);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}
.gallery-filter-bar input[type="text"] {
  flex: 1 1 200px;
  border: none;
  background: var(--bg-body);
  padding: 11px 18px;
  border-radius: var(--radius-btn);
  font-size: 0.92rem;
  outline: none;
  font-family: inherit;
}
.gallery-filter-bar input[type="text"]:focus { background: white; box-shadow: 0 0 0 2px var(--gold-light); }
.gallery-filter-bar .btn { padding: 10px 24px; }
.clear-filter { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-weight: 500; font-size: 0.86rem; }
.clear-filter:hover { color: var(--forest); }

.results-count { font-weight: 500; color: var(--text-secondary); margin-bottom: 18px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; }
.results-count i { color: var(--gold); }

.gallery-empty { text-align: center; padding: 60px 20px; background: var(--bg-card); border-radius: var(--radius-card); box-shadow: var(--shadow-sm); }
.gallery-empty .icon { font-size: 2.6rem; margin-bottom: 12px; color: var(--gold-light); }

/* ----- Gallery Grid ----- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}
.gallery-tile {
  position: relative;
  border: none;
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  padding: 0;
  aspect-ratio: 1 / 1;
  transition: var(--transition);
  width: 100%;
}
.gallery-tile:hover { transform: scale(1.01); box-shadow: var(--shadow-md); }
.gallery-tile img, .gallery-tile video { width: 100%; height: 100%; object-fit: cover; }

.play-badge {
  position: absolute;
  top: 50%; inset-inline-start: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: white;
  width: 40px; height: 40px;
  border-radius: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  border: 2px solid rgba(255,255,255,0.3);
}
[dir="rtl"] .play-badge { transform: translate(50%, -50%); }

.tile-stats {
  position: absolute;
  bottom: 8px;
  inset-inline-start: 10px;
  display: flex;
  gap: 10px;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  padding: 3px 12px;
  border-radius: var(--radius-btn);
  color: white;
  font-size: 0.72rem;
  font-weight: 500;
}
.tile-stats span { display: flex; align-items: center; gap: 4px; }

.tile-store-badge {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  padding: 3px 10px 3px 3px;
  border-radius: var(--radius-btn);
  color: white;
  font-size: 0.66rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 12px);
  overflow: hidden;
}
[dir="rtl"] .tile-store-badge { padding: 3px 3px 3px 10px; }
.tile-store-badge span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Avatar circles (shared: profile, tile badge, lightbox) */
.avatar-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 100%;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--forest);
}

/* ----- Pagination ----- */
.gallery-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 20px 0 30px; }
.gallery-pagination a {
  padding: 8px 16px;
  border-radius: var(--radius-btn);
  background: var(--bg-card);
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.gallery-pagination a.active { background: var(--gold); color: white; box-shadow: 0 4px 12px rgba(212, 162, 78, 0.25); }
.gallery-pagination a:hover { transform: translateY(-2px); }

/* ----- Lightbox ----- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 30, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  padding: 20px;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox-body {
  background: var(--bg-card);
  border-radius: 26px;
  max-width: 1000px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  position: relative;
}
.lightbox-media { background: #0d1c2a; display: flex; align-items: center; justify-content: center; min-height: 280px; max-height: 52vh; overflow: hidden; }
.lightbox-media img, .lightbox-media video { width: 100%; height: 100%; object-fit: contain; }
.lightbox-panel { padding: 20px 24px 24px; overflow-y: auto; background: white; }

.lightbox-store-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.lightbox-store-link { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text-primary); min-width: 0; }
.lightbox-store-link .avatar-circle { width: 32px; height: 32px; font-size: 0.9rem; }
.lightbox-store-link span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.post-follow-btn {
  background: var(--gold);
  border: none;
  color: white;
  padding: 6px 16px;
  border-radius: var(--radius-btn);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}
.post-follow-btn.is-following { background: var(--forest); }

.lightbox-text { margin: 10px 0 14px; color: var(--text-secondary); font-size: 0.94rem; }

.lightbox-action-row { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; position: relative; }
.action-btn {
  background: transparent;
  border: none;
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 5px 9px;
  border-radius: var(--radius-btn);
  transition: var(--transition);
}
.action-btn:hover { background: var(--bg-body); }
.action-btn.is-liked { color: #c44545; }
.action-btn.is-liked .far { display: none; }

.share-wrap { position: relative; }
.share-menu {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 34px;
  inset-inline-start: 0;
  background: white;
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  min-width: 160px;
  border: 1px solid #eef3f8;
  z-index: 10;
}
.share-menu.open { display: flex; }
.share-menu a, .share-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 8px 18px;
  text-align: start;
  font-weight: 500;
  font-size: 0.86rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
}
.share-menu a:hover, .share-menu button:hover { background: var(--forest-light); }

.report-menu { min-width: 220px; padding: 12px; gap: 8px; flex-direction: column; display: none; }
.report-menu.open { display: flex; }
.report-menu input[type="text"] {
  border: 1px solid #dee7ef;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-family: inherit;
}
.report-menu button {
  background: var(--forest);
  color: #fff;
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  font-weight: 600;
  text-align: center;
  justify-content: center;
}
.report-menu button:hover { background: var(--forest); opacity: 0.9; }
.report-thanks { font-size: 0.8rem; color: var(--text-muted); text-align: center; margin: 0; }

.lightbox-comments { margin-top: 4px; }
.comments-title { font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.comments-title i { color: var(--gold); }
.comments-list {
  max-height: 140px;
  overflow-y: auto;
  background: var(--bg-body);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}
.comment-item { display: flex; flex-direction: column; gap: 1px; padding: 6px 0; border-bottom: 1px solid #edf2f7; }
.comment-item:last-child { border-bottom: none; }
.comment-item strong { color: var(--forest); font-size: 0.84rem; }
.no-comments { color: var(--text-muted); font-size: 0.85rem; }

.comment-form { display: flex; flex-direction: column; gap: 8px; }
.honeypot-field { position: absolute; left: -9999px; opacity: 0; height: 0; }
.comment-form input[type="text"] { border: 1px solid #dee7ef; border-radius: var(--radius-btn); padding: 9px 16px; font-family: inherit; font-size: 0.86rem; }
.comment-input-row { display: flex; gap: 8px; }
.comment-input-row input { flex: 1; }
.comment-input-row button {
  background: var(--gold);
  border: none;
  border-radius: var(--radius-btn);
  padding: 0 18px;
  color: white;
  font-weight: 600;
  cursor: pointer;
}
.comment-error { color: #c44545; font-size: 0.78rem; margin-top: 2px; min-height: 14px; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(6px);
  border: none;
  font-size: 1.1rem;
  color: white;
  width: 44px; height: 44px;
  border-radius: 100%;
  cursor: pointer;
  transition: 0.2s;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { inset-inline-start: 16px; }
.lightbox-next { inset-inline-end: 16px; }
.lightbox-close {
  position: absolute;
  top: 16px;
  inset-inline-end: 20px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  border: none;
  color: white;
  font-size: 1.2rem;
  width: 42px; height: 42px;
  border-radius: 100%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-footer {
  text-align: center;
  margin-top: 50px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid #e2e9f0;
  padding-top: 24px;
}

@media (max-width: 680px) {
  .profile-info { flex-direction: column; align-items: flex-start; }
  .profile-name-row { margin-inline-end: 0; }
  .profile-actions { margin-inline-start: 0; width: 100%; }
  .profile-stats { width: 100%; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .nav-label { display: none; }
  .lightbox-body { max-height: 94vh; }
  .lightbox-media { max-height: 38vh; }
}
