/* =============================================
   NS ADS — Custom Styles (Sneat-compatible)
============================================= */
:root {
  --ns-purple: #7B5EA7;
  --ns-pink: #C850C0;
  --ns-teal: #4ECDC4;
  --ns-bg: #F8F6FF;
  --ns-dark: #1a1a2e;
  --ns-muted: #6C7E99;
  --ns-gradient: linear-gradient(135deg, #7B5EA7, #C850C0);
}

* { font-family: 'Open Sans', sans-serif; }
html { height: 100%; } body { min-height: 100%; }
body { background: var(--ns-bg); color: var(--ns-dark); }

/* ---- SNEAT LAYOUT OVERRIDE ---- */
.layout-wrapper {
  display: flex !important;
  align-items: stretch;
  width: 100%;
  min-height: 100vh;
}
.layout-container {
  display: flex !important;
  align-items: stretch;
  flex: 1 1 auto;
  width: 100%;
}
.layout-menu {
  width: 260px !important;
  min-width: 260px !important;
  flex-shrink: 0 !important;
  background: #fff;
  border-right: 1px solid #ede9f8;
  position: fixed !important;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
}
.layout-page {


  min-width: 0;
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-height: 100vh;
}
.layout-navbar {
  position: sticky !important;
  top: 0;
  z-index: 999;
  background: #fff !important;
  border-bottom: 1px solid #ede9f8;
  box-shadow: 0 2px 12px rgba(123,94,167,0.06);
  padding: 0.5rem 1.5rem;
  width: 100% !important;
}
.content-wrapper {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.container-xxl {
  width: 100%;
  max-width: 100%;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}
.content-footer {
  border-top: 1px solid #ede9f8;
  background: #fff;
  margin-top: auto;
}

/* ---- SIDEBAR ---- */
.app-brand {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid #ede9f8;
  display: flex;
  align-items: center;
  min-height: 64px;
}
.menu-inner { list-style: none; padding: 0.5rem 0; margin: 0; }
.menu-inner .menu-item { list-style: none; }
.menu-inner .menu-item .menu-link {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  margin: 1px 10px;
  border-radius: 8px;
  color: var(--ns-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
  gap: 10px;
}
.menu-inner .menu-item .menu-link:hover {
  background: rgba(123,94,167,0.08);
  color: var(--ns-purple);
}
.menu-inner .menu-item.active .menu-link {
  background: linear-gradient(135deg, rgba(123,94,167,0.15), rgba(200,80,192,0.08));
  color: var(--ns-purple);
  font-weight: 600;
}
.menu-icon { font-size: 1.15rem; min-width: 20px; }
.menu-header {
  padding: 1rem 1.5rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ns-muted);
  opacity: 0.7;
}
.menu-header-text { display: block; }
.menu-inner-shadow { display: none; }

/* ---- CARDS ---- */
.card {
  border: 1px solid #ede9f8 !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(123,94,167,0.05) !important;
}
.card-header {
  background: transparent !important;
  border-bottom: 1px solid #ede9f8 !important;
  font-weight: 600;
  color: var(--ns-dark);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--ns-gradient) !important;
  border: none !important;
  font-weight: 600;
  border-radius: 8px;
}
.btn-primary:hover, .btn-primary:focus {
  background: linear-gradient(135deg, #6a4f96, #b040b0) !important;
  border: none !important;
}
.btn-outline-primary {
  color: var(--ns-purple) !important;
  border-color: var(--ns-purple) !important;
  border-radius: 8px;
  font-weight: 600;
  background: transparent !important;
}
.btn-outline-primary:hover {
  background: var(--ns-purple) !important;
  color: #fff !important;
}

/* ---- BADGES ---- */
.bg-label-primary {
  background: rgba(123,94,167,0.12) !important;
  color: var(--ns-purple) !important;
  font-weight: 600;
}

/* ---- FORMS ---- */
.form-control:focus, .form-select:focus {
  border-color: var(--ns-purple);
  box-shadow: 0 0 0 0.2rem rgba(123,94,167,0.15);
}
.form-label {
  font-weight: 600;
  color: var(--ns-dark);
  font-size: 0.875rem;
}

/* ---- TABLES ---- */
.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ns-muted);
  font-weight: 700;
  border-bottom: 2px solid #ede9f8;
  padding: 10px 16px;
}
.table td { vertical-align: middle; padding: 12px 16px; }

/* ---- MOBILE ---- */
@media (max-width: 1199px) {
  .layout-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .layout-menu.show {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .layout-page {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* Auth page success alert */
.alert-success {
  background: #f0fae8 !important;
  border: 1.5px solid #479c19 !important;
  color: #479c19 !important;
  border-radius: 12px !important;
}
.alert-success .btn-close { filter: none; }
.alert-success i { color: #479c19 !important; font-size: 1.1rem; }

/* Navbar dropdown refinement */
.dropdown-user .dropdown-menu {
  min-width: 220px;
  padding: 0.5rem 0;
  border: 1px solid #ede9f8;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(123,94,167,0.15);
}
.dropdown-user .dropdown-item {
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #697a8d;
  transition: all 0.15s;
}
.dropdown-user .dropdown-item:hover {
  background: rgba(123,94,167,0.06);
  color: var(--ns-purple);
}
.dropdown-user .dropdown-item i {
  font-size: 1.1rem;
  width: 20px;
}
.dropdown-user .dropdown-item.text-danger { color: #ef5350 !important; }
.dropdown-user .dropdown-item.text-danger:hover { background: rgba(239,83,80,0.06); }
.dropdown-user .dropdown-divider { margin: 0.35rem 0; border-color: #ede9f8; }

/* Avatar online indicator */
.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #71dd37;
  border: 2px solid #fff;
}
.avatar { position: relative; display: inline-flex; }

/* Navbar compact */
#layout-navbar { padding: 0.5rem 1.5rem; }
.navbar-nav-right { width: 100%; }


/* NS Ads Mobile Fix — Final */
@media (max-width: 1199.98px) {
  .layout-page { margin-left: 0 !important; width: 100% !important; }
  #layout-menu {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    height: 100% !important; margin: 0 !important;
    z-index: 1100 !important;
    transform: translate3d(-100%, 0, 0) !important;
  }
  .layout-menu-expanded #layout-menu {
    transform: translate3d(0, 0, 0) !important;
  }
  .layout-overlay {
    position: fixed !important;
    display: none !important;
    background: #22303e !important;
    opacity: 0.5 !important;
    top: 0 !important; left: 0 !important;
    width: 100% !important; height: 100% !important;
    z-index: 1099 !important;
    cursor: pointer;
    pointer-events: none !important;
    overscroll-behavior: none !important;
  }
  .layout-menu-expanded .layout-overlay {
    pointer-events: auto !important;
  }
  .layout-menu-expanded .layout-overlay {
    display: block !important;
  }
}

/* NS Ads Mobile Fix */
@media (max-width: 1199px) {
  /* Navbar */
  .layout-navbar {
    overflow: visible !important;
    padding-right: 8px !important;
  }
  .layout-navbar .navbar-nav-right {
    flex-wrap: nowrap !important;
    overflow: visible !important;
  }
  .layout-navbar .nav-item.dropdown {
    position: static !important;
  }
  .layout-navbar .dropdown-menu {
    position: fixed !important;
    top: 60px !important;
    right: 8px !important;
    left: auto !important;
    z-index: 9999 !important;
  }
  /* Page layout */
  .layout-page {
    margin-left: 0 !important;
    width: 100% !important;
  }
  /* Tables scroll horizontally */
  .table-responsive, .table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- MOBILE SCROLL FIX ---- */
/* Force body to be scrollable whenever the sidebar is not open.
   The Sneat core sets .layout-menu-expanded body { overflow: hidden }
   which is correct for open-sidebar state, but Bootstrap dropdown events
   can leave overflow:hidden on body after dropdown hide. This rule
   overrides any such leak and also beats any inline style thanks to !important. */
@media (max-width: 1199.98px) {
  html:not(.layout-menu-expanded) body:not(.modal-open) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  /* Prevent sidebar scroll from propagating to the page; block iOS swipe-back drag */
  #layout-menu {
    overscroll-behavior-y: contain;
    touch-action: pan-y !important;
    overscroll-behavior-x: none !important;
  }
}

/* ---- HERO CARD ---- */
@keyframes ns-shimmer {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.ns-hero-card {
  background: linear-gradient(135deg, #2D1B69 0%, #6B2FA0 45%, #B83280 100%) !important;
  background-size: 200% 200% !important;
  animation: ns-shimmer 8s ease infinite !important;
  border-radius: 16px !important;
  border: none !important;
  overflow: visible !important;
  position: relative !important;
}
.ns-hero-body {
  padding: 24px !important;
  position: relative;
}
.ns-hero-title {
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
}
.ns-hero-divider {
  border: none !important;
  border-top: 1px solid rgba(255,255,255,0.2) !important;
  margin: 12px 0;
}
.ns-hero-balances { display: flex; align-items: center; gap: 16px; }
.ns-hero-col { flex: 1; }
.ns-hero-col-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.68);
  margin-bottom: 4px;
  white-space: nowrap;
}
.ns-hero-col-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
}
.ns-hero-col-sub { font-size: 0.72rem; color: rgba(255,255,255,0.58); margin-top: 2px; }
.ns-hero-vr { width: 1px; height: 60px; background: rgba(255,255,255,0.22); flex-shrink: 0; }
.ns-hero-btn {
  background: #fff !important;
  color: var(--ns-purple) !important;
  font-weight: 600 !important;
  border-radius: 50px !important;
  border: none !important;
  padding: 8px 24px !important;
  font-size: 0.88rem;
  width: auto;
  display: inline-flex !important;
  align-items: center;
  text-decoration: none !important;
  margin-top: 16px;
}
.ns-hero-btn:hover { background: #f3f0ff !important; color: var(--ns-purple) !important; }
.ns-hero-progress { border-top: 1px solid rgba(255,255,255,0.18); padding-top: 12px; margin-top: 12px; }

/* Left content: right padding reserves space for the absolute image */
.ns-hero-left { padding-right: 272px; }

/* Wallet image — absolutely centred on the card's right side */
.ns-hero-imgwrap {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  width: 240px;
  z-index: 2;
  text-align: center;
}
.ns-hero-glow {
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.13) 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ns-hero-img {
  width: 240px;
  height: auto;
  margin-top: -30px;
  filter: drop-shadow(0 12px 32px rgba(0,0,0,0.35));
  position: relative;
  z-index: 2;
}

/* Mobile: flex-row-reverse puts imgwrap on right, text on left */
@media (max-width: 575.98px) {
  .ns-hero-body {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 12px;
    padding: 16px !important;
  }
  .ns-hero-left { padding-right: 0; flex: 1; min-width: 0; }
  .ns-hero-title { font-size: 1.5rem; }
  .ns-hero-col-val { font-size: 1.6rem; }
  .ns-hero-imgwrap {
    position: relative;
    right: auto; top: auto;
    transform: none;
    width: 120px;
    min-width: 100px;
    flex-shrink: 0;
    margin-top: -10px;
  }
  .ns-hero-img { width: 100%; margin-top: 0; }
  .ns-hero-vr { height: 44px; }
  .ns-hero-btn { width: 100% !important; justify-content: center; }
}

/* ---- STAT CARD HOVER ---- */
.hover-shadow { transition: box-shadow 0.2s, transform 0.15s; }
.hover-shadow:hover { box-shadow: 0 8px 24px rgba(123,94,167,0.18) !important; transform: translateY(-2px); }

/* ---- STAT CARDS MOBILE ---- */
@media (max-width: 575.98px) {
  .ns-stat-card .card-body { padding: 0.85rem !important; gap: 0.75rem !important; }
  .ns-stat-icon { width: 42px !important; height: 42px !important; min-width: 42px !important; }
  .ns-stat-val { font-size: 1.2rem !important; }
}

/* ---- MOBILE NAVBAR ---- */
@media (max-width: 1199.98px) {
  #layout-navbar .navbar-nav-right {
    flex-wrap: nowrap;
    overflow: hidden;
    min-width: 0;
  }
  #layout-navbar .navbar-nav-right > ul > li {
    flex-shrink: 1;
    min-width: 0;
  }
  #layout-navbar .nav-item.dropdown-user {
    flex-shrink: 0;
  }
}
@media (max-width: 390px) {
  .ns-nav-pill-cash { display: none !important; }
}

/* ---- DEAL PROGRESS TIMELINE ---- */
.deal-timeline { display:flex; align-items:flex-start; padding:0.5rem 0; overflow-x:auto; }
.tl-step { display:flex; flex-direction:column; align-items:center; flex-shrink:0; min-width:60px; }
.tl-dot { width:40px; height:40px; border-radius:50%; background:#f4f0fb; border:2px solid #ede9f8; display:flex; align-items:center; justify-content:center; font-size:1.1rem; color:#bbb; margin-bottom:0.4rem; }
.tl-label { font-size:0.68rem; text-align:center; color:var(--ns-muted); font-weight:500; line-height:1.3; max-width:66px; }
.tl-step.done .tl-dot { background:linear-gradient(135deg,var(--ns-purple),var(--ns-pink)); border-color:var(--ns-purple); color:#fff; }
.tl-step.active .tl-dot { background:#fff; border-color:var(--ns-purple); color:var(--ns-purple); box-shadow:0 0 0 4px rgba(123,94,167,0.12); }
.tl-step.done .tl-label, .tl-step.active .tl-label { color:var(--ns-dark); font-weight:600; }
.tl-line { flex:1; height:2px; background:#ede9f8; margin-top:19px; min-width:12px; }
.tl-line.done { background:var(--ns-purple); }
@media (max-width:575px) {
  .deal-timeline { flex-direction:column; align-items:stretch; overflow-x:visible; }
  .tl-step { flex-direction:row; align-items:center; gap:0.75rem; min-width:auto; }
  .tl-dot { width:34px; height:34px; min-width:34px; font-size:0.95rem; margin-bottom:0; }
  .tl-label { font-size:0.78rem; text-align:left; max-width:none; }
  .tl-line { width:2px; height:18px; flex:none; margin-top:0; margin-left:16px; min-width:2px; }
}

/* Page title icon */
.ns-page-title-icon { font-size: 1.1rem; vertical-align: middle; margin-right: 2px; }

/* ---- NAVBAR WALLET DROPDOWN ---- */
.ns-wallet-dropdown {
  width: 220px;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  border: 1px solid #ede9f8;
  padding: 0;
  overflow: hidden;
}
.ns-wd-header {
  background: linear-gradient(135deg, #2D1B69, #7B3FA0);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.ns-wd-header i { font-size: 1.1rem; opacity: 0.85; }
.ns-wd-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid #f5f3ff;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.ns-wd-row:hover { background: #faf8ff; }
.ns-wd-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.ns-wd-icon.nsc { background: #ede7f6; color: #7B5EA7; }
.ns-wd-icon.cash { background: #e8f5e9; color: #2e7d32; }
.ns-wd-info { flex: 1; min-width: 0; }
.ns-wd-val { font-size: 15px; font-weight: 800; color: #1a1a1a; line-height: 1.2; }
.ns-wd-label { font-size: 10px; color: #999; margin-top: 1px; }
.ns-wd-arrow { margin-left: auto; color: #ccc; font-size: 1.1rem; flex-shrink: 0; }
.ns-wd-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  background: #faf8ff;
  border-top: 1px solid #f0ebff;
  color: #7B5EA7;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.ns-wd-footer i { font-size: 1rem; }
.ns-wd-footer:hover { background: #f0ebff; }

/* Wallet button in navbar */
.ns-wallet-btn {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: #f5f0ff;
  border: 1.5px solid #e0d6f7;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #7B5EA7;
  font-size: 1.2rem;
  padding: 0;
}
.ns-wallet-btn.show,
.ns-wallet-btn:hover {
  background: #ede9f8;
  border-color: #c4b5f4;
}

/* ---- TRANSACTION FILTER PILLS ---- */
.ns-txn-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.ns-txn-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 30px;
  border: 1.5px solid #e0d6f7; background: #fff;
  color: #666; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.ns-txn-pill:hover { border-color: #7B5EA7; color: #7B5EA7; }
.ns-txn-pill.active { background: #7B5EA7; border-color: #7B5EA7; color: #fff; }
.ns-txn-count {
  background: rgba(255,255,255,0.25);
  padding: 1px 6px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.ns-txn-pill:not(.active) .ns-txn-count { background: #f0ebff; color: #7B5EA7; }

/* ---- CASH STAT GRID ---- */
.ns-cash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.ns-cash-stat {
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ns-cash-stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
/* ---- WAYS TO EARN CARD ---- */
.ns-earn-card {
  border-left: 4px solid var(--ns-purple) !important;
}

@media (max-width: 575.98px) {
  .ns-cash-grid { grid-template-columns: repeat(2, 1fr); }
  .ns-cash-grid .ns-cash-stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---- BROWSE LISTINGS (enhanced) ---- */
.ns-listing-card {
  border-radius: 14px;
  transition: box-shadow 0.2s;
  height: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid #ede9f8;
}
.ns-listing-card:hover { box-shadow: 0 4px 20px rgba(123,94,167,0.15); }
.ns-listing-card .card-body { display: flex; flex-direction: column; flex: 1; }
.ns-listing-card .ns-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}
.ns-listing-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ns-search-wrap .input-group { border: 1.5px solid #e0d6f7; border-radius: 10px; overflow: hidden; }
.ns-search-wrap .form-control:focus,
.ns-search-wrap .input-group-text { border-color: transparent; box-shadow: none; }
.ns-filter-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ns-muted);
  margin-bottom: 5px;
  font-weight: 600;
}

/* ---- BID SUBMITTED BUTTON ---- */
.ns-bid-submitted-btn {
  opacity: 1 !important;
  background: #f0fdf4 !important;
  border: 1.5px solid #22c55e !important;
  color: #16a34a !important;
  font-weight: 600 !important;
  cursor: default !important;
}

/* ---- MOBILE NAVBAR FIX (avatar overflow) ---- */
@media (max-width: 575.98px) {
  #layout-navbar .navbar-nav-right {
    flex-wrap: nowrap;
    min-width: 0;
    overflow: visible;
  }
  #layout-navbar .navbar-nav-right > ul {
    flex-wrap: nowrap;
    align-items: center;
  }
  .ns-wallet-btn {
    flex-shrink: 0;
  }
  .navbar-nav .nav-item.navbar-dropdown {
    flex-shrink: 0;
  }
}

/* ---- BROWSE LISTINGS MOBILE CARD SPACING ---- */
@media (max-width: 575.98px) {
  .ns-listing-card {
    margin-bottom: 4px;
  }
  .ns-listing-card .card-body {
    padding: 14px;
  }
  .ns-card-footer {
    padding-top: 10px;
  }
}

/* ---- RESPONSIVE WIDTH UTILITY ---- */
@media (min-width: 768px) {
  .w-md-auto { width: auto !important; }
}

/* ---- MOBILE BADGE & ACTION OVERFLOW PREVENTION ---- */
@media (max-width: 767px) {
  .ns-status-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .ns-status-badges .badge {
    flex-shrink: 0;
  }
  .ns-deal-action-btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .ns-bid-card-badges {
    flex-wrap: wrap !important;
  }
}
