:root {
  --text: #0f172a;
  --accent: #06b6d4;
  --border: #e2e8f0;
  --primary: #2563eb;
  --secondary: #0ea5e9;
  --background: #ffffff;
  --brand-purple: #a53cfb;
  --brand-blue: #1486fd;
  --brand-aqua: #2dd9eb;
  --fontFamily: 'Inter', system-ui, sans-serif;
  --accentForeground: #155e75;
  --primaryForeground: #ffffff;
  --secondaryForeground: #ffffff;
  --custom-fadedtext: #64748b;
  --custom-primarybutton: #2563eb;
  --custom-primarybuttonhover: #1d4ed8;
  --custom-primarybuttontext: #ffffff;
  --custom-secondarybutton: #f1f5f9;
  --custom-lighttext: #0f172a;
  --custom-fadedbackground: #f8fafc;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --sidebar-background: #ffffff;
  --nav-active: #a53cfb;
  --navs: #191919;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 18px 50px rgba(15, 23, 42, 0.14);
  --container: 1280px;
  --page-padding: 24px;
  --mobile-nav-height: 60px;
}
[data-theme="dark"] {
  --text: #f8fafc;
  --accent: #22d3ee;
  --border: #1e293b;
  --primary: #3b82f6;
  --secondary: #06b6d4;
  --background: #020617;
  --accentForeground: #cffafe;
  --primaryForeground: #ffffff;
  --secondaryForeground: #ffffff;
  --custom-fadedtext: #94a3b8;
  --custom-primarybutton: #ff2f5f;
  --custom-primarybuttonhover: #e11d48;
  --custom-primarybuttontext: #ffffff;
  --custom-secondarybutton: #111827;
  --custom-lighttext: #f8fafc;
  --custom-fadedbackground: #0f172a;
  --surface: #020617;
  --surface-elevated: #0f172a;
  --sidebar-background: #000000;
  --nav-active: #ff2f5f;
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 50px rgba(0, 0, 0, 0.45);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body, #root {
  height: 100% !important;
  font-family: var(--fontFamily) !important;
  background: var(--background) !important;
  color: var(--text) !important;
  overflow: hidden !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button {
  font-family: var(--fontFamily);
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}
input,
textarea {
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus,
textarea:focus {
    border: 1px solid var(--brand-purple);
    outline: none;
}
/* ========== APP LAYOUT ========== */
.hidden {
    display:none;
}
.app-layout {
  display: flex;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  background: var(--background);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
.app-main,
.feed-container,
.feed-desktop-multi,
.feed-viewport {
    min-height: 0;
}
.product-action-topbar {
    position: relative;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 6px;
    z-index: 200;
    background: #ebe7e7;
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}
.brand-icon {
    width: 36px;
    height: 36px;
}
/* ========== DESKTOP SIDEBAR ========== */
.desktop-sidebar {
  width: 240px;
  height: 100dvh;
  background: var(--sidebar-background);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: relative;
  z-index: 50;
  flex-shrink: 0;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 24px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.sidebar-logo svg {
  color: var(--nav-active);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.sidebar-nav-item {
  display: flex;
  position: relative;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  color: var(--custom-fadedtext);
  transition: all 0.15s ease;
  cursor: pointer;
  text-decoration:none;
}
.sidebar-nav-item:hover {
  background: var(--custom-fadedbackground);
  color: var(--text);
}
.sidebar-nav-item.active {
  color: var(--nav-active);
  background: rgba(239, 47, 255, 0.08);
  font-weight: 600;
}
.sidebar-nav-item svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.action-rail-btn.active svg {
    fill: currentColor;
}
.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-footer-link {
  font-size: 12px;
  color: var(--custom-fadedtext);
  padding: 4px 14px;
  cursor: pointer;
  transition: color 0.15s ease;
}
.sidebar-footer-link:hover {
  color: var(--text);
}
/* ========== MOBILE BOTTOM NAV ========== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: var(--navs);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 500;
  color: var(--custom-fadedtext);
  transition: color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item {
  transition: color 0.15s ease, transform 0.15s ease;
}

.mobile-nav-item:hover {
  color: #03e0ed;
  transform: translateY(-1px);
}

.mobile-nav-item.active {
  color: #03e0ed;
}
@media (hover: hover) {
  .mobile-nav-item:hover {
    color: #03e0ed;
  }
}
.mobile-nav-item svg {
  width: 24px;
  height: 24px;
}
/* ========== PRODUCT FEED ========== */
.feed-container {
  flex: 1;
  min-height: 0; 
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.feed-desktop-multi {
  flex: 1;

  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;

  padding: 16px 12px;

  min-height: 0;
}

.feed-desktop-multi .feed-viewport {
  width: 100%;
  max-width: 550px;
    height: 100%;
    max-height: 100%;
  flex: 1;
  

  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}
.feed-viewport {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.feed-viewport-inner {
  width: 100%;
  min-height: 100%;
  padding: 16px;
  box-sizing: border-box;
  will-change: transform;
  transform: translateY(0);
}
.feed-mobile-single {
  display: flex;
  width: 100%;
  height: 100%;
}
.feed-mobile-single,
.feed-viewport,
.feed-slide,
.product-card-feed {
    height: 100%;
    min-height: 0;
    max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
/* ── SEARCH MODAL ── */
.search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
}
.search-modal {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%)!important;
  width: min(600px, calc(100vw - 32px));
  background: var(--surface-elevated);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  z-index: 201;
  overflow: hidden;
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  outline: none;
  font-family: inherit;
}
.search-input::placeholder {
  color: var(--text-muted);
}
.search-clear-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 50%;
  transition: color 0.15s;
}
.search-clear-btn:hover { color: var(--text); }
.search-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--nav-active);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 6px;
  white-space: nowrap;
}
.search-results {
  max-height: 480px;
  overflow-y: auto;
  padding-bottom: 8px;
}
.search-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.search-section {
  padding: 0;
}
.search-section-label {
  padding: 10px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.search-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  color: var(--text);
}
.search-result-row:hover {
  background: var(--surface);
}
.search-seller-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.search-product-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}
.search-result-info {
  flex: 1;
  min-width: 0;
}
.search-result-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-result-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
}
.search-result-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--nav-active);
  flex-shrink: 0;
}
.sidebar-search-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.sidebar-search-btn:hover {
  border-color: var(--nav-active);
  color: var(--text);
}
.mobile-search-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--custom-fadedtext);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 10px;
  transition: color 0.15s;
}
.mobile-search-icon-btn:hover,
.mobile-search-icon-btn.active { color: var(--nav-active); }


/* ========== BUY PANEL ========== */
.buy-panel {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.btn-buy {
  flex: 1;
  background: #a53cfb;
  color: #fff;
  padding: 12px 14px;
    border-radius: 10px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  transition: background 0.15s ease;
}
.btn-buy:hover {
  background: var(--custom-primarybuttonhover);
}
.btn-cart {
  padding: 14px 20px;
  background: #ffffff;
  color: #111;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  transition: background 0.15s ease;
  border: 1px solid var(--border);
}
.btn-cart:hover {
  background: var(--custom-fadedbackground);
}
.btn-save-sheet {
  padding: 14px;
  background: var(--custom-secondarybutton);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  transition: background 0.15s ease;
}

.btn-save-sheet:hover {
  background: var(--custom-fadedbackground);
}

.btn-save-sheet svg {
  width: 20px;
  height: 20px;
}

/* ========== SELLER PAGE ========== */
.seller-page {
  height: 100%;
  overflow-y: auto;
  background: var(--background);
}

.seller-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 24px 32px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.seller-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 16px;
  border: 3px solid var(--border);
}

.seller-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.seller-username {
  font-size: 14px;
  color: var(--custom-fadedtext);
  margin-bottom: 12px;
}

.seller-bio {
  font-size: 14px;
  color: var(--custom-lighttext);
  max-width: 400px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.seller-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 20px;
}

.seller-stat {
  text-align: center;
}

.seller-stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.seller-stat-label {
  font-size: 12px;
  color: var(--custom-fadedtext);
}

.seller-actions {
  display: flex;
  gap: 10px;
}

.btn-follow {
  padding: 10px 28px;
  background: var(--custom-primarybutton);
  color: var(--custom-primarybuttontext);
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  transition: background 0.15s ease;
}

.btn-follow:hover {
  background: var(--custom-primarybuttonhover);
}

.btn-shop {
  padding: 10px 28px;
  background: var(--custom-secondarybutton);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  transition: background 0.15s ease;
}

.btn-shop:hover {
  background: var(--custom-fadedbackground);
}

/* ========== PRODUCT GRID ========== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 2px;
}

.product-grid-card {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  cursor: pointer;
  background: var(--custom-fadedbackground);
}

.product-grid-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.product-grid-card:hover img {
  transform: scale(1.04);
}

.product-grid-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
  color: #fff;
}

.product-grid-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-grid-price {
  font-size: 15px;
  font-weight: 800;
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--custom-fadedtext);
  transition: all 0.15s ease;
}

.theme-toggle:hover {
  background: var(--custom-fadedbackground);
  color: var(--text);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* ========== LOADING STATE ========== */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--custom-primarybutton);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 769px), (max-height: 850px)  {
  .desktop-sidebar {
    display: none;
  }
  .mobile-bottom-nav {
    display: block;
  }
  .product-info-overlay {
    padding-bottom: calc(var(--mobile-nav-height) + 7px);
  }
  .action-rail {
    bottom: calc(var(--mobile-nav-height) + 7px);
  }
}

@media (min-width: 769px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 769px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 769px) {
  .product-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}
