/* =========================================================
   IRAN NFT Market – Stylesheet
   - Dark cinematic layout
   - NFT explore grid
   - My Panel (overview / collection / listings)
   - Converter (Phase 2 UI)
   - Phantom mobile banner + desktop QR card
   ========================================================= */

/* ---------- CSS variables / theme ---------- */
:root {
  --bg: #05070a;
  --bg-soft: #0c1117;
  --card: rgba(13, 19, 28, 0.94);
  --glass: rgba(19, 25, 35, 0.72);
  --ink: #eaf1f9;
  --muted: #9aa5b5;
  --accent: #c4a15e;
  --accent-soft: rgba(196, 161, 94, 0.3);
  --sol: #14f195;
  --danger: #ff4e6a;
  --shadow: 0 26px 60px -28px rgba(0, 0, 0, 0.9);
  --radius-lg: 22px;
  --radius-md: 16px;
}

/* ---------- Basic reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body.theme-dark {
  min-height: 100vh;
  font: 15px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at -10% -10%, #101623 0, transparent 60%),
    radial-gradient(900px 500px at 120% 0%, #111a28 0, transparent 60%),
    linear-gradient(#05070a, #05070a 40%, #05070a);
}

/* Utility */
.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  font-size: 0.8rem;
}

.label-inline {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  color: var(--muted);
  margin-right: 0.3rem;
}

.small {
  font-size: 0.78rem;
}

/* ---------- Header ---------- */
.market-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  background: linear-gradient(
    to bottom,
    rgba(4, 7, 11, 0.96),
    rgba(4, 7, 11, 0.88)
  );
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.7);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.05em;
}

.brand-text p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Top navigation */
.market-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.nav-link {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.25s, color 0.25s, transform 0.15s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  transform: translateY(-1px);
}

.nav-link--tab.active {
  background: rgba(196, 161, 94, 0.16);
  color: var(--accent);
}

/* Wallet area */
.wallet-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 1rem;
}

.wallet-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.badge-sol {
  border-color: rgba(20, 241, 149, 0.4);
  color: var(--sol);
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 999px;
  border: none;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s,
    border-color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.btn-primary {
  background: radial-gradient(
    circle at 0% 0%,
    rgba(20, 241, 149, 0.4),
    rgba(20, 241, 149, 0.1)
  );
  color: #02130a;
  box-shadow: 0 14px 38px -18px rgba(20, 241, 149, 0.8);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 45px -20px rgba(20, 241, 149, 0.95);
}

.btn-secondary {
  background: rgba(196, 161, 94, 0.12);
  color: var(--accent);
  border: 1px solid rgba(196, 161, 94, 0.25);
}

.btn-secondary:hover {
  background: rgba(196, 161, 94, 0.2);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.04);
}

.btn-small {
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
}

/* ---------- Layout ---------- */
.market-main {
  max-width: 1200px;
  margin: 1.5rem auto 2.5rem;
  padding: 0 1.5rem;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.section-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
}

.section-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* ---------- Filters ---------- */
.filters {
  margin: 1.1rem 0 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-select {
  background: rgba(19, 25, 35, 0.9);
  color: var(--ink);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  outline: none;
}

/* ---------- NFT grid & cards ---------- */
.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.1rem;
}

.nft-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 0.7rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  overflow: hidden;
}

.nft-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 68px -32px rgba(0, 0, 0, 0.95);
  border-color: rgba(196, 161, 94, 0.45);
}

.nft-thumb-wrapper {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: radial-gradient(
    circle at 0 0,
    rgba(196, 161, 94, 0.15),
    rgba(4, 8, 15, 0.9)
  );
}

.nft-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.nft-card:hover .nft-thumb {
  transform: scale(1.05);
}

.nft-chip {
  position: absolute;
  left: 0.6rem;
  top: 0.6rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(4, 9, 15, 0.7);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.nft-body {
  padding: 0.6rem 0.2rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.nft-title {
  font-size: 0.95rem;
  margin: 0;
}

.nft-collection {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.nft-footer {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.price-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(6, 46, 28, 0.7);
  color: var(--sol);
  font-weight: 500;
}

.price-label {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Empty state */
.empty-state {
  margin: 3rem auto;
  text-align: center;
  max-width: 360px;
  background: var(--glass);
  padding: 1.2rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(255, 255, 255, 0.12);
}

.empty-state h3 {
  margin-top: 0;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
}

/* ---------- My Panel ---------- */
.panel-card {
  margin-top: 1.2rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-lg);
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
}

.panel-card h3 {
  margin-top: 0;
  margin-bottom: 0.4rem;
}

.panel-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

/* Inner tabs */
.panel-tabs {
  display: inline-flex;
  gap: 0.4rem;
  padding: 0.18rem;
  border-radius: 999px;
  background: rgba(5, 9, 16, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 0.9rem;
}

.panel-tab-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.panel-tab-btn.active {
  background: rgba(196, 161, 94, 0.18);
  color: var(--accent);
}

.panel-tab {
  display: none;
}

.panel-tab.active {
  display: block;
}

/* Overview grid */
.panel-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
}

.stat-card {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(5, 9, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-caption {
  font-size: 0.8rem;
}

/* Panel grid for collection / listings */
.panel-grid-tight {
  margin-top: 0.8rem;
}

.nft-card.panel-compact {
  padding: 0.6rem;
}

.nft-card.panel-compact .nft-thumb-wrapper {
  aspect-ratio: 4 / 3;
}

.nft-card.panel-compact .nft-body {
  padding-top: 0.5rem;
}

.nft-card.panel-compact .nft-footer {
  align-items: flex-end;
}

.nft-card .nft-actions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.nft-status-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(196, 161, 94, 0.4);
  color: var(--accent);
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(20, 241, 149, 0.14), transparent 50%),
    rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(18px);
}

.modal-dialog {
  position: relative;
  max-width: 900px;
  width: calc(100% - 2rem);
  margin: 4vh auto;
  background: linear-gradient(
    135deg,
    rgba(8, 13, 20, 0.98),
    rgba(5, 10, 18, 0.98)
  );
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 40px 100px -38px rgba(0, 0, 0, 1);
  padding: 0.9rem;
}

.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.4fr);
  gap: 0.9rem;
}

.modal-image-wrapper {
  border-radius: 22px;
  overflow: hidden;
  background: radial-gradient(
    circle at 0% 0%,
    rgba(196, 161, 94, 0.25),
    #05070a
  );
}

.modal-image-wrapper img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.modal-content {
  padding: 0.3rem 0.4rem 0.3rem 0.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.modal-content h3 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-tags {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.modal-description {
  font-size: 0.9rem;
  color: var(--ink);
  opacity: 0.9;
}

.modal-meta {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.3rem;
}

.modal-meta .label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.price-line {
  margin-top: 0.15rem;
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--sol);
}

.currency-tag {
  font-size: 0.77rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(20, 241, 149, 0.12);
  color: var(--sol);
}

.modal-actions {
  margin-top: 0.6rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-note {
  margin: 0.3rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.modal-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border-radius: 999px;
  border: none;
  background: rgba(3, 5, 9, 0.7);
  color: var(--muted);
  width: 26px;
  height: 26px;
  cursor: pointer;
}

/* ---------- Phase 2 converter ---------- */
.converter-card {
  margin-top: 1.4rem;
  padding: 1.1rem 1.3rem;
  border-radius: var(--radius-lg);
  background: rgba(5, 9, 16, 0.92);
  border: 1px dashed rgba(196, 161, 94, 0.35);
}

.converter-header h4 {
  margin: 0 0 0.3rem;
}

.converter-header p {
  margin: 0 0 0.6rem;
}

.converter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: stretch;
}

.converter-field {
  flex: 1 1 230px;
}

.converter-field label {
  display: block;
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
  color: var(--ink);
}

.converter-field input[type="number"] {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(7, 11, 18, 0.95);
  color: var(--ink);
  font-size: 0.9rem;
  outline: none;
}

.converter-field input[type="number"]::placeholder {
  color: rgba(154, 165, 181, 0.7);
}

.converter-field input[type="number"]:focus {
  border-color: rgba(196, 161, 94, 0.7);
  box-shadow: 0 0 0 1px rgba(196, 161, 94, 0.35);
}

.converter-result {
  flex: 1 1 260px;
}

.stat-card.converter-stat {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-card.converter-stat .btn {
  margin-top: 0.4rem;
  align-self: flex-start;
}

.project-notes {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.project-notes h4 {
  margin: 0 0 0.4rem;
}

.project-notes ul {
  padding-left: 1.2rem;
  margin: 0.4rem 0 0.2rem;
}

.project-notes li {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ---------- Phantom mobile banner & desktop QR ---------- */

/* Fixed banner at the bottom (only for mobile, controlled via media queries + JS) */
.mobile-phantom-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 0.5rem 1rem 0.75rem;
  background: linear-gradient(
    to top,
    rgba(5, 9, 16, 0.98),
    rgba(5, 9, 16, 0.8)
  );
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px);
}

.mobile-phantom-banner .banner-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.mobile-phantom-banner .banner-text {
  font-size: 0.8rem;
  color: var(--muted);
}

/* Desktop QR card (bottom-right) */
.phantom-qr-card {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 25;
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-lg);
  background: rgba(5, 9, 16, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.phantom-qr-text {
  font-size: 0.78rem;
  color: var(--muted);
}

.phantom-qr-text span {
  font-size: 0.72rem;
  opacity: 0.9;
}

.phantom-qr-card img {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  background: #fff;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .modal-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 768px) {
  .market-header {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .market-nav {
    order: 3;
    width: 100%;
    margin: 0.5rem 0 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .wallet-area {
    margin-left: auto;
  }

  .market-main {
    padding: 0 1rem;
  }

  .converter-grid {
    flex-direction: column;
  }

  /* On mobile we hide QR card (only show banner) */
  .phantom-qr-card {
    display: none !important;
  }
}

@media (min-width: 769px) {
  /* On desktop we hide the mobile banner (even if JS removes .hidden) */
  .mobile-phantom-banner {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .brand-text h1 {
    font-size: 1.05rem;
  }

  .nav-link {
    font-size: 0.78rem;
    padding-inline: 0.7rem;
  }

  .modal-dialog {
    margin: 2.5vh auto;
  }
}
