/* Base layout */

:root {
  --rs-bg: #020617;
  --rs-bg-soft: #020617;
  --rs-bg-card: rgba(15, 23, 42, 0.97);
  --rs-border-soft: rgba(148, 163, 184, 0.22);
  --rs-border-strong: rgba(148, 163, 184, 0.4);
  --rs-text-main: #e5e7eb;
  --rs-text-muted: #9ca3af;
  --rs-accent: #f97316;
  --rs-accent-soft: rgba(249, 115, 22, 0.14);
  --rs-accent-strong: #f97316;
  --rs-radius-lg: 18px;
  --rs-radius-xl: 22px;
  --rs-shadow-soft: 0 18px 42px rgba(15, 23, 42, 0.85);
  --rs-danger: #ef4444;
  --rs-success: #22c55e;
}

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

body.rs-body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1e293b 0, #020617 45%, #000 100%);
  color: var(--rs-text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.rs-app {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 64px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */

.rs-header {
  position: relative;
  padding: 16px 16px 10px;
  overflow: hidden;
}

.rs-header-glow {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at top left, rgba(251, 146, 60, 0.4), transparent 55%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.28), transparent 60%);
  opacity: 0.85;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: rsGlowPulse 16s ease-in-out infinite alternate;
}

@keyframes rsGlowPulse {
  0% { transform: translate3d(0,0,0) scale(1); opacity: 0.8; }
  50% { transform: translate3d(-4px, -3px, 0) scale(1.03); opacity: 1; }
  100% { transform: translate3d(4px, 2px, 0) scale(1.02); opacity: 0.9; }
}

.rs-header-main {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.9);
}

.rs-logo-circle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, #fed7aa, #f97316 55%, #7c2d12 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0b1120;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 12px 28px rgba(248, 250, 252, 0.9);
  flex-shrink: 0;
}

.rs-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.rs-brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.rs-brand-sub {
  font-size: 11px;
  color: var(--rs-text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.rs-header-pills {
  position: relative;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rs-pill {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.94);
  color: var(--rs-text-muted);
  backdrop-filter: blur(12px);
}

.rs-pill--accent {
  border-color: rgba(248, 250, 252, 0.9);
  color: #111827;
  background: linear-gradient(135deg, #f97316, #fb923c);
  font-weight: 600;
}

/* Tabs */

.rs-main {
  position: relative;
  padding: 0 12px 80px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.rs-tabs {
  display: flex;
  gap: 6px;
  padding: 2px 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.38);
  margin-bottom: 10px;
}

.rs-tab {
  flex: 1;
  border-radius: 999px;
  border: none;
  padding: 6px 8px;
  font-size: 12px;
  color: var(--rs-text-muted);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.rs-tab--active {
  background: rgba(15, 23, 42, 0.98);
  color: #fef3c7;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.8);
  transform: translateY(-0.5px);
}

.rs-tab-badge {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--rs-accent);
  color: #111827;
  font-size: 11px;
  font-weight: 600;
}

/* Views */

.rs-view {
  display: none;
  animation: rsViewFadeIn 0.18s ease-out;
}

.rs-view--active {
  display: block;
}

@keyframes rsViewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.rs-section-header {
  margin: 10px 2px 8px;
}

.rs-section-header h2 {
  margin: 0 0 3px;
  font-size: 18px;
}

.rs-section-header p {
  margin: 0;
  font-size: 12px;
  color: var(--rs-text-muted);
}

.rs-section-header--tight {
  margin-top: 8px;
  margin-bottom: 4px;
}

.rs-section-header--tight h3 {
  margin: 0;
  font-size: 15px;
}

/* Chips row */

.rs-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rs-chip-row--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}

.rs-chip-row--scroll::-webkit-scrollbar {
  height: 4px;
}
.rs-chip-row--scroll::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.8);
  border-radius: 999px;
}

.rs-chip {
  flex-shrink: 0;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  font-size: 12px;
  background: rgba(15, 23, 42, 0.96);
  color: var(--rs-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.08s ease;
}

.rs-chip span.rs-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.85);
}

.rs-chip--active {
  background: radial-gradient(circle at top left, rgba(249, 115, 22, 0.45), rgba(15, 23, 42, 0.98));
  color: #fef3c7;
  border-color: rgba(249, 115, 22, 0.9);
  transform: translateY(-0.5px);
}

.rs-chip--active span.rs-chip-dot {
  background: #fbbf24;
}

/* Cards / inputs */

.rs-card {
  border-radius: var(--rs-radius-lg);
  background: var(--rs-bg-card);
  border: 1px solid var(--rs-border-soft);
  padding: 10px 12px;
  box-shadow: var(--rs-shadow-soft);
}

.rs-card--soft {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.96));
}

.rs-card--accent {
  background: radial-gradient(circle at top left, rgba(249, 115, 22, 0.14), rgba(15, 23, 42, 0.98));
  border-color: rgba(249, 115, 22, 0.7);
}

.rs-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}

.rs-field-label {
  font-size: 12px;
  color: var(--rs-text-muted);
}

.rs-input {
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: rgba(15, 23, 42, 0.96);
  color: var(--rs-text-main);
  padding: 7px 9px;
  font-size: 13px;
  outline: none;
  resize: none;
  min-height: 0;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.rs-input:focus {
  border-color: var(--rs-accent);
  box-shadow: 0 0 0 1px var(--rs-accent-soft);
  background: #020617;
}

.rs-input--area {
  border-radius: 12px;
}

.rs-btn {
  border-radius: 999px;
  border: none;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.08s ease;
}

.rs-btn--primary {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #111827;
  box-shadow: 0 14px 28px rgba(249, 115, 22, 0.7);
}

.rs-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(249, 115, 22, 0.85);
}

.rs-btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 10px 20px rgba(249, 115, 22, 0.65);
}

.rs-btn--ghost {
  background: transparent;
  color: var(--rs-text-main);
  border: 1px solid var(--rs-border-strong);
  box-shadow: none;
}

.rs-btn--sm {
  padding: 5px 10px;
  font-size: 12px;
}

.rs-btn--wide {
  width: 100%;
}

/* Product list */

.rs-product-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.rs-product-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr 2.4fr 1.1fr;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), #020617);
  border: 1px solid rgba(55, 65, 81, 0.9);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.85);
}

.rs-product-image {
  border-radius: 13px;
  overflow: hidden;
  background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.12), transparent 70%);
  border: 1px solid rgba(55, 65, 81, 0.9);
  min-height: 64px;
  max-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rs-product-image img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.rs-product-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rs-product-name {
  font-size: 13px;
  font-weight: 600;
}

.rs-product-meta {
  font-size: 11px;
  color: var(--rs-text-muted);
}

.rs-product-link {
  font-size: 11px;
  color: #bfdbfe;
  text-decoration: underline;
}

.rs-product-price-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4px;
}

.rs-product-price {
  font-size: 14px;
  font-weight: 700;
}

.rs-product-unit {
  font-size: 11px;
  color: var(--rs-text-muted);
}

.rs-qty-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  border: 1px solid rgba(75, 85, 99, 0.95);
  padding: 2px 6px;
  background: rgba(15, 23, 42, 0.98);
}

.rs-qty-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: rgba(31, 41, 55, 0.95);
  color: var(--rs-text-main);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.rs-qty-value {
  min-width: 18px;
  text-align: center;
  font-size: 13px;
}

/* Empty states */

.rs-empty-state {
  margin-top: 16px;
  padding: 20px 16px;
  text-align: center;
  border-radius: 18px;
  border: 1px dashed rgba(75, 85, 99, 0.95);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), #020617);
}

.rs-empty-icon {
  font-size: 26px;
  margin-bottom: 4px;
}

.rs-empty-title {
  font-size: 14px;
  font-weight: 600;
}

.rs-empty-sub {
  font-size: 12px;
  color: var(--rs-text-muted);
}

/* Calculator */

.rs-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.rs-result-label {
  font-size: 12px;
  color: var(--rs-text-muted);
}

.rs-result-value {
  font-size: 16px;
  font-weight: 700;
}

.rs-result-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--rs-text-muted);
}

.rs-error-text {
  min-height: 16px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--rs-danger);
}

.rs-success-text {
  margin-top: 6px;
  font-size: 12px;
  color: var(--rs-success);
}

/* Segmented control */

.rs-segment {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.96);
  gap: 2px;
}

.rs-segment-item {
  border: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  background: transparent;
  color: var(--rs-text-muted);
  cursor: pointer;
}

.rs-segment-item--active {
  background: rgba(15, 23, 42, 0.98);
  color: #fef3c7;
}

/* Cart */

.rs-cart-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rs-cart-item {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 16px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.96), #020617);
  border: 1px solid rgba(55, 65, 81, 0.95);
}

.rs-cart-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rs-cart-name {
  font-size: 13px;
  font-weight: 600;
}

.rs-cart-meta {
  font-size: 11px;
  color: var(--rs-text-muted);
}

.rs-cart-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
}

.rs-cart-sum {
  font-size: 14px;
  font-weight: 700;
}

.rs-cart-remove {
  font-size: 11px;
  color: var(--rs-text-muted);
  text-decoration: underline;
  cursor: pointer;
}

/* Profile */

.rs-text {
  font-size: 13px;
  margin: 2px 0 8px;
}

.rs-text--muted {
  color: var(--rs-text-muted);
  margin-top: 10px;
}

.rs-profile-block {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 14px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: rgba(15, 23, 42, 0.96);
}

.rs-profile-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.rs-profile-label {
  color: var(--rs-text-muted);
}

.rs-profile-value {
  font-weight: 500;
}

/* Notes */

.rs-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--rs-text-muted);
}

/* Bottom nav */

.rs-bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: 0 10px;
  z-index: 20;
  pointer-events: none;
}

.rs-bottom-nav-inner {
  display: flex;
}

.rs-bottom-nav-item {
  pointer-events: auto;
  flex: 1;
  border: none;
  margin: 0 2px;
  border-radius: 999px;
  padding: 6px 0 5px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(55, 65, 81, 0.95);
  color: var(--rs-text-muted);
  font-size: 11px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease, box-shadow 0.1s ease;
}

.rs-bottom-nav-item--active {
  background: radial-gradient(circle at top left, rgba(249, 115, 22, 0.5), rgba(15, 23, 42, 0.98));
  border-color: rgba(249, 115, 22, 0.9);
  color: #fef3c7;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.9);
  transform: translateY(-0.5px);
}

.rs-bottom-nav-icon {
  font-size: 15px;
}

.rs-bottom-nav-label {
  font-size: 10px;
}

.rs-bottom-nav-badge {
  position: absolute;
  top: 3px;
  right: 22%;
  min-width: 16px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--rs-accent);
  color: #111827;
  font-size: 10px;
  font-weight: 600;
}

/* Small screen fixes */

@media (max-width: 480px) {
  .rs-main {
    padding-inline: 10px;
  }
  .rs-header {
    padding-inline: 10px;
  }
  .rs-product-card {
    grid-template-columns: 1.3fr 2.6fr;
    grid-template-rows: auto auto;
  }
  .rs-product-price-block {
    grid-column: 1 / span 2;
    flex-direction: row;
    align-items: center;
  }
}

/* In case WebApp is inside Telegram with its own bottom bar,
   we keep our bottom nav but it blends with it.
*/