:root {
  --bg: #0c1323;
  --card: #111a2f;
  --muted: #94a3b8;
  --text: #e8ecf1;
  --accent-start: #fd3a84;
  --accent-end: #7b5cff;
  --accent: #9b5cff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  direction: rtl;
  scroll-behavior: smooth;
}

body {
  font-family: "Cairo", system-ui, -apple-system, Segoe UI, Roboto,
    "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  background: radial-gradient(800px 400px at 22% 55%,
      rgba(91, 78, 255, 0.25),
      transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 92%);
  margin-inline: auto;
}

/* ====== NAV ====== */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.logo .cube {
  width: 22px;
  height: 22px;
  background: conic-gradient(from 180deg, #7b5cff, #fd3a84, #7b5cff);
  border-radius: 6px;
  transform: rotate(25deg);
  box-shadow: 0 8px 30px rgba(123, 92, 255, 0.4);
}

.nav .btn {
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  white-space: nowrap;
}

/* ====== HERO ====== */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
  padding: 40px 0 60px;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero .visual {
    order: -1;
    margin-bottom: 20px;
  }
}

.headline {
  font-size: clamp(26px, 5vw, 56px);
  line-height: 1.2;
  font-weight: 900;
  margin-bottom: 12px;
}

.sub {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: clamp(15px, 2.5vw, 18px);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: none;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 16px;
  color: white;
  background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
  box-shadow: 0 8px 25px rgba(123, 92, 255, 0.45);
  transition: transform 0.2s ease;
}

.cta:hover {
  transform: translateY(-2px);
}

.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 960px) {
  .btns {
    justify-content: center;
  }
}

/* ====== VISUAL / MOCKUP ====== */
.visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 380px;
}

.glow {
  position: absolute;
  inset: auto;
  width: 90%;
  height: 100%;
  background: radial-gradient(closest-side,
      rgba(123, 92, 255, 0.45),
      transparent 60%);
  filter: blur(30px);
  z-index: 0;
}

.phone {
  position: relative;
  z-index: 2;
  width: min(340px, 95%);
  aspect-ratio: 9/19;
  border-radius: 30px;
  background: linear-gradient(180deg, #0f172a, #111827);
  box-shadow: 0 35px 60px rgba(0, 0, 0, 0.5),
    0 15px 40px rgba(123, 92, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.screen {
  width: 100%;
  height: 100%;
  padding: 16px;
  background: linear-gradient(180deg, #ffd29d 0%, #7b5cff 60%, #111827 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
}

.screen .bar {
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.screen .bar.thin {
  height: 20px;
  opacity: 0.9;
}

/* ====== GENERAL SECTIONS ====== */
.badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: #0b1220;
  background: white;
  font-weight: 800;
  margin-bottom: 8px;
}

.section {
  padding: 30px 0 70px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.card:hover {
  transform: translateY(-3px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1000px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* ====== FORMS ====== */
.input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: #0f172a;
  color: var(--text);
  outline: none;
}

.input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(123, 92, 255, 0.35);
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.form-row {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 740px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ====== TABLES ====== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.table th {
  color: var(--muted);
  text-align: right;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
}

/* ====== FOOTER ====== */
.footer {
  opacity: 0.75;
  padding: 22px 0 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ====== ALERTS ====== */
.success,
.error {
  padding: 10px 14px;
  border-radius: 12px;
  margin: 10px 0;
}

.success {
  background: rgba(34, 197, 94, 0.15);
  color: #a7f3d0;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.error {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* ====== EXTRA ELEMENTS ====== */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.badge-tag-uplo {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}

.badge-tag-uplo:hover {
  background-color: #151e33;
}

small.help {
  display: block;
  color: var(--muted);
  opacity: 0.9;
}

.download {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

/* ====== THUMBS ====== */
.thumb-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
  display: block;
}

.thumb-ph {
  width: 100%;
  height: 180px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: radial-gradient(600px 200px at 20% 20%,
      rgba(123, 92, 255, 0.35),
      transparent 60%),
    linear-gradient(135deg, #0e1729, #151e33);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

/* ====== SEARCH FORM SPECIAL ====== */
form.card input.input {
  flex: 1;
  min-width: 0;
}

/*====== Header compatility with new ===== */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
}

.nav .links>li>a,
.nav .links>li>button {
  white-space: nowrap;
}

.nav-backdrop {
  z-index: 55;
}

.viewer-controls input[type=color] {
  width: 42px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  background: #0f172a;
}


/* ====== PROFILE PAGE ====== */
.profile-header {
  text-align: center;
  margin-bottom: 30px;
}

.profile-header .avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.profile-header-1 .avatar-1 {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.profile-header h1 {
  margin: 0;
  font-size: clamp(22px, 4vw, 36px);
  font-weight: 800;
}

.profile-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* grid نفسه المستخدم للبطاقات */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.profile-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}

.profile-card:hover {
  transform: translateY(-4px);
}

.profile-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 12px;
}

.profile-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
}

.profile-card .meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 14px;
}

.profile-card .actions {
  display: flex;
  gap: 8px;
}

/* ====== view page layout ====== */
.view-layout {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .view-layout {
    grid-template-columns: 1fr;
  }
}

/* حاوية العارض ثلاثي الأبعاد */
.viewer {
  width: 100%;
  height: 520px;
  /* ديسكتوب */
  background: #0b1220;
}

@media (max-width: 960px) {
  .viewer {
    height: 60vh;
    /* موبايل: نسبة من ارتفاع الشاشة */
    min-height: 360px;
    border-radius: 16px;
  }
}

/* لو الموبايل طويل */
@media (max-width: 960px) and (min-height: 750px) {
  .viewer {
    height: 70vh;
  }
}

.social {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.icon-btn i {
  font-size: 14px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-btn.active i {
  color: #ff6b9e;
}

/* عند الإعجاب */

.icon-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 2;
}

.icon-btn * {
  pointer-events: none;
}

.social {
  position: relative;
  z-index: 2;
}

/* ===== Modal for comments ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.modal-content {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-content h3 {
  margin-top: 0;
}

.modal-body {
  overflow-y: auto;
  margin-top: 10px;
  padding-right: 6px;
  flex: 1;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.modal .close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 28px;
  cursor: pointer;
  color: var(--text);
}

.icon-static {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.icon-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.icon-btn i,
.icon-static i {
  font-size: 16px;
}

.icon-btn.liked i {
  color: #ff6b93;
}

.count {
  opacity: .85;
  font-variant-numeric: tabular-nums;
}

.badge-tag-uplo {
  position: relative;
  z-index: 2;
}

/* ===== Notifications ===== */
.notif-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.notif-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  padding: 12px;
  transition: transform .15s ease, background .15s ease;
}

.notif-item:hover {
  transform: translateY(-2px);
}

.notif-item.unread {
  background: rgba(123, 92, 255, .08);
  border-color: rgba(123, 92, 255, .25);
}

.ni-ico {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 16px;
}

.ni-ico.like {
  background: rgba(253, 58, 132, .15);
  border-color: rgba(253, 58, 132, .35);
}

.ni-ico.comment {
  background: rgba(123, 92, 255, .15);
  border-color: rgba(123, 92, 255, .35);
}

.ni-ico.follow {
  background: rgba(34, 197, 94, .15);
  border-color: rgba(34, 197, 94, .35);
}

.ni-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ni-text {
  font-weight: 700;
}


.viewer-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  justify-content: center;
}

.viewer-controls button,
.viewer-controls input[type=color] {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #222;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: 0.2s;
}

.viewer-controls button:hover {
  background: #444;
}

.viewer-controls input[type=color] {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
}

.light-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 14px;
}

.light-mode button {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #222;
  color: #fff;
  cursor: pointer;
  transition: 0.2s;
}

.light-mode button:hover {
  background: #444;
}

#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast-msg {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 10px 16px;
  margin-top: 10px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transform: translateY(20px);
  animation: slideIn 0.4s forwards, fadeOut 0.5s 3s forwards;
}

@keyframes slideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(20px);
  }
}

/* ===== Compact header ===== */
.nav {
  padding: 12px 0;
  gap: 16px;
}

.nav .logo {
  font-size: 18px;
  font-weight: 800;
}

.nav .links {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav .links a {
  padding: 8px 10px;
  border-radius: 10px;
}

.nav .links a:hover {
  background: rgba(255, 255, 255, .06);
}

.user-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-inline-start: auto;
}

.user-area .btn {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.user-area .btn.ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .2);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  color: var(--text);
  cursor: pointer;
}

.user-btn .avatar-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .12);
}

.user-btn .user-name {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-btn .chev {
  font-size: 12px;
  opacity: .8;
}

.user-btn.open {
  background: rgba(255, 255, 255, .10);
}

/* === Mobile off-canvas nav (matches header behavior) === */
@media (max-width: 980px) {
  .nav {
    position: sticky;
    top: 0;
    z-index: 60;
  }

  .nav-toggle {
    display: block;
  }

  .nav .links {
    position: fixed;
    top: 0;
    right: 0;
    width: 78vw;
    max-width: 320px;
    height: 100vh;
    padding: 84px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;

    background: var(--card);
    border-left: 1px solid rgba(255, 255, 255, .08);
    box-shadow: -12px 0 30px rgba(0, 0, 0, .45);

    transform: translateX(110%);
    visibility: hidden;
    transition: transform .25s ease, visibility .25s ease;
    z-index: 1001;
  }

  .nav .links.show {
    transform: translateX(0);
    visibility: visible;
  }

  .nav .links>li {
    border-bottom: 1px solid rgba(255, 255, 255, .06);
  }

  .nav .links>li>a,
  .nav .links>li>button {
    display: block;
    width: 100%;
    background: transparent;
    border-radius: 10px;
    padding: 12px 14px;
    text-align: right;
  }

  /* user dropdown داخل القائمة على الموبايل */
  .nav .user-li .dd {
    position: static;
    display: none;
    padding-right: 10px;
  }

  .nav .user-li.open .dd {
    display: block;
  }
}

/* backdrop */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  display: none;
  z-index: 1000;
}

.nav-backdrop.show {
  display: block;
}

/* امنع سكرول الصفحة أثناء فتح القائمة */
body.menu-open {
  overflow: hidden;
}


/* يمنع أي ابنّ من توسيع الكرت */
.card > * { min-width: 0; }

/* صف العنوان: قصّ لو العنوان طويل */
.card .title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card .title-row h3 {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* صف الأيقونات: لفّ بدل ما يزق عرض الكرت */
.social { flex-wrap: wrap; }
.icon-btn, .icon-static { white-space: nowrap; }

/* أمان: لو فيه عنصر أكبر من الحاوية ما يسبب سكرول أفقي */
