:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef2ff;
  --text: #101216;
  --muted: #687083;
  --line: #dde3ee;
  --blue: #0a66ff;
  --pink: #ff2f7d;
  --orange: #ff9900;
  --dark: #131921;
  --ig: linear-gradient(135deg, #f58529, #dd2a7b 45%, #8134af 70%, #515bd4);
  --shadow: 0 18px 45px rgba(14, 25, 49, 0.1);
}

body.dark {
  --bg: #080a0f;
  --surface: #11151d;
  --surface-2: #182032;
  --text: #f6f8fb;
  --muted: #a8b1c3;
  --line: #252d3a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
}

body.lite img {
  filter: saturate(0.75);
}

body.lite .story,
body.lite .post-media,
body.lite .product-card img,
body.lite .profile-cover {
  background-image: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(245, 133, 41, 0.08), transparent 26%),
    linear-gradient(315deg, rgba(81, 91, 212, 0.09), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[dir="rtl"] .nav-item,
body[dir="rtl"] .search input,
body[dir="rtl"] .composer button {
  text-align: right;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand,
.post-head,
.profile-card,
.topbar,
.top-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-bottom: 34px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  color: white;
  font-weight: 900;
  background: var(--ig);
}

.brand span,
.post-head span,
.product-card p,
.profile-card p {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-item,
.wide-btn,
.primary-btn,
.icon-btn,
.sell-btn,
.bazar-search button,
.product-card button,
.composer button {
  border: 0;
  border-radius: 8px;
  font-weight: 700;
}

.nav-item {
  padding: 13px 14px;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.nav-item.active {
  color: white;
  background: var(--ig);
}

.market-entry {
  color: var(--dark);
  background: linear-gradient(135deg, #ffd766, var(--orange));
}

.language-card,
.panel,
.post-card,
.composer,
.filters,
.product-card,
.profile-card,
.feature-card,
.job-card,
.hiring-dashboard,
.news-card,
.notification-list article,
.messages-layout,
.video-stage article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.language-card {
  margin-top: 28px;
  padding: 14px;
  border: 2px solid rgba(10, 102, 255, 0.28);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
}

.language-card > span {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-weight: 900;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chips button,
.category-strip button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  background: var(--surface-2);
}

.chips button.active,
.category-strip button.active {
  color: white;
  border-color: transparent;
  background: var(--ig);
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(680px, 100%);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(14, 25, 49, 0.06);
}

.search span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search input,
.bazar-search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.top-actions {
  gap: 10px;
}

.top-lang {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 2px solid rgba(10, 102, 255, 0.28);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: 0 10px 24px rgba(10, 102, 255, 0.12);
}

.top-lang span {
  padding: 0 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-lang button {
  min-width: 72px;
  border: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: var(--text);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.top-lang button.active {
  color: white;
  background: var(--ig);
}

.icon-btn {
  width: 42px;
  height: 42px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.primary-btn,
.sell-btn {
  padding: 12px 18px;
  color: white;
  background: var(--ig);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.story-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.story {
  position: relative;
  min-height: 170px;
  overflow: hidden;
  border-radius: 8px;
  padding: 12px;
  color: white;
  background: var(--ig);
  outline: 3px solid rgba(221, 42, 123, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.story:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(221, 42, 123, 0.18);
}

.story span {
  position: absolute;
  bottom: 12px;
  left: 12px;
  font-weight: 800;
}

.create-story {
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}

.story-one { background-image: linear-gradient(rgba(0,0,0,.1), rgba(0,0,0,.55)), url("https://images.unsplash.com/photo-1529156069898-49953e39b3ac?auto=format&fit=crop&w=500&q=80"); background-size: cover; }
.story-two { background-image: linear-gradient(rgba(0,0,0,.1), rgba(0,0,0,.55)), url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=500&q=80"); background-size: cover; }
.story-three { background-image: linear-gradient(rgba(0,0,0,.1), rgba(0,0,0,.55)), url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=500&q=80"); background-size: cover; }
.story-four { background-image: linear-gradient(rgba(0,0,0,.1), rgba(0,0,0,.55)), url("https://images.unsplash.com/photo-1504674900247-0877df9cc836?auto=format&fit=crop&w=500&q=80"); background-size: cover; }

.composer {
  gap: 12px;
  padding: 14px;
  margin-bottom: 18px;
}

.composer img,
.post-head img,
.profile-card img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
}

.composer button {
  width: 100%;
  padding: 14px 16px;
  color: var(--muted);
  text-align: left;
  background: var(--surface-2);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.feed {
  display: grid;
  gap: 16px;
}

.post-card {
  padding: 16px;
  max-width: 760px;
  margin: 0 auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.post-card:hover,
.feature-card:hover,
.product-card:hover,
.job-card:hover,
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(14, 25, 49, 0.14);
}

.post-head {
  gap: 10px;
}

.verified-badge {
  position: relative;
  display: inline-block;
  width: 17px;
  height: 17px;
  margin-left: 5px;
  vertical-align: -3px;
  border-radius: 50%;
  background: #0095f6;
}

.verified-badge::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.vip-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  color: white;
  font-size: 11px;
  vertical-align: middle;
  background: var(--ig);
}

.post-media {
  width: 100%;
  max-height: 520px;
  border-radius: 8px;
  object-fit: cover;
}

.reel-preview {
  display: grid;
  place-items: center;
  min-height: 420px;
  border-radius: 8px;
  color: white;
  background: radial-gradient(circle at top, #ff2f7d, #111827 60%);
}

.post-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.post-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: var(--surface-2);
  transition: transform 0.15s ease, background 0.15s ease;
}

.post-actions button:hover,
.wide-btn:hover,
.product-card button:hover,
.category-strip button:hover {
  transform: translateY(-1px);
}

.post-actions button.active {
  color: white;
  background: var(--ig);
}

.right-rail {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel {
  padding: 16px;
}

.wide-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  color: var(--text);
  background: var(--surface-2);
}

.bazar-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, var(--dark), #263142 55%, var(--orange));
}

.bazar-hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 72px);
  letter-spacing: 0;
}

.bazar-search {
  display: flex;
  gap: 10px;
  margin: 16px 0;
  padding: 10px;
  border-radius: 8px;
  background: #febd69;
}

.bazar-search input {
  padding: 12px;
  border-radius: 6px;
  background: white;
  color: #111;
}

.bazar-search button {
  padding: 0 18px;
  color: white;
  background: var(--dark);
}

.category-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.shopping-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 16px;
}

.filters {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.filters label {
  color: var(--muted);
}

.filters select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: var(--surface);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  overflow: hidden;
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-card div {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.product-card span {
  color: #b12704;
  font-weight: 900;
}

.product-card button {
  width: calc(100% - 24px);
  margin: 0 12px 12px;
  padding: 10px;
  color: #111;
  background: #ffd814;
}

.product-card button.active {
  color: white;
  background: #067d62;
}

.product-card.highlight {
  outline: 3px solid #ffd814;
}

.video-stage {
  display: grid;
  min-height: 72vh;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(160deg, #101216, #221033 50%, #0a66ff);
}

.video-stage article {
  max-width: 460px;
  padding: 24px;
  color: var(--text);
}

.messages-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 640px;
  overflow: hidden;
}

.messages-layout aside {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.messages-layout aside button {
  border: 0;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: var(--surface-2);
}

.messages-layout aside button.active {
  color: white;
  background: var(--ig);
}

.messages-layout section {
  padding: 20px;
}

.bubble {
  width: fit-content;
  max-width: 70%;
  padding: 12px 14px;
  border-radius: 18px;
}

.incoming {
  background: var(--surface-2);
}

.outgoing {
  margin-left: auto;
  color: white;
  background: var(--blue);
}

.chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 260px;
}

.chat-composer button {
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: white;
  background: var(--ig);
  font-weight: 900;
}

.message-box {
  min-height: 48px;
  padding: 14px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
}

.message-box.has-text {
  color: var(--text);
}

.message-box:focus {
  outline: 2px solid var(--blue);
}

.profile-cover {
  min-height: 260px;
  border-radius: 8px;
  background-image: linear-gradient(rgba(0,0,0,.08), rgba(0,0,0,.28)), url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1400&q=80");
  background-size: cover;
  background-position: center;
}

.profile-card {
  gap: 18px;
  width: min(760px, calc(100% - 28px));
  margin: -60px auto 0;
  padding: 18px;
}

.profile-card img {
  width: 116px;
  height: 116px;
  border: 5px solid var(--surface);
}

.profile-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.profile-name .verified-badge {
  flex: 0 0 auto;
  margin-left: 0;
  margin-right: 2px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 8px;
  color: white;
  background: var(--ig);
}

.section-head span {
  font-weight: 800;
  opacity: 0.85;
}

.section-head h1 {
  margin: 4px 0;
  font-size: clamp(30px, 4vw, 54px);
  letter-spacing: 0;
}

.section-head p {
  max-width: 720px;
  margin: 0;
}

.feature-grid,
.admin-grid,
.news-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.profile-tools {
  width: min(980px, 100%);
  margin: 18px auto 0;
}

.feature-card,
.job-card,
.hiring-dashboard,
.news-card {
  padding: 16px;
}

.feature-card h3,
.job-card strong,
.news-card h3,
.news-card h2 {
  margin-top: 0;
}

.feature-card p,
.job-card p,
.news-card p,
.notification-list span,
.job-card span {
  color: var(--muted);
}

.feature-card button,
.job-card button,
.hiring-dashboard button,
.news-card button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  color: white;
  background: var(--blue);
  font-weight: 800;
}

.jobs-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
}

.job-list {
  display: grid;
  gap: 14px;
}

.hiring-dashboard {
  align-self: start;
}

.news-grid {
  grid-template-columns: 2fr 1fr 1fr;
}

.main-news {
  grid-row: span 2;
  min-height: 320px;
  color: white;
  background-image: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.72)), url("https://images.unsplash.com/photo-1495020689067-958852a7765e?auto=format&fit=crop&w=1100&q=80");
  background-size: cover;
  background-position: center;
}

.admin-grid {
  margin-bottom: 16px;
}

.metric {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 8px;
  color: white;
  background: linear-gradient(135deg, #111827, #263142);
}

.metric strong {
  font-size: 28px;
}

.notification-list {
  display: grid;
  gap: 12px;
}

.notification-list article {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-left: 4px solid #0095f6;
}

.notification-list article.read {
  opacity: 0.55;
  border-left-color: var(--line);
}

button:active {
  transform: scale(0.98);
}

.bottom-nav {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(340px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: white;
  background: rgba(16, 18, 22, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.55);
}

.modal.open {
  display: grid;
}

.modal-card {
  position: relative;
  width: min(520px, 100%);
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-2);
}

.modal-card textarea {
  width: 100%;
  min-height: 140px;
  margin: 8px 0 14px;
  padding: 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-2);
}

@media (max-width: 1000px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .content-grid,
  .shopping-layout,
  .messages-layout,
  .jobs-layout {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .admin-grid,
  .news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .right-rail,
  .filters {
    display: none;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
    padding: 8px;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .toast {
    bottom: 86px;
  }

  .bottom-nav .nav-item {
    padding: 10px 4px;
    text-align: center;
    font-size: 12px;
  }

  .main {
    padding: 14px 14px 84px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .top-lang {
    width: 100%;
    justify-content: space-between;
    border-radius: 8px;
  }

  .top-lang button {
    flex: 1;
    min-width: 0;
  }

  .story-row {
    grid-template-columns: repeat(5, 118px);
  }

  .product-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .admin-grid,
  .news-grid {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .bazar-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .post-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
