/* ========================================
   GULDOKON — NATIVE APP DESIGN SYSTEM
   v1.0 — full-screen, gestures, transitions
   ======================================== */

:root {
  --brand: #1f8a3e;
  --brand-2: #16a34a;
  --brand-3: #22c55e;
  --brand-soft: #e8f5ee;
  --brand-dark: #15692e;
  --brand-grad: linear-gradient(135deg, #22c55e 0%, #1f8a3e 60%, #15692e 100%);

  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --text2: #636366;
  --text3: #AEAEB2;
  --border: rgba(60,60,67,0.12);
  --border-2: rgba(60,60,67,0.18);

  --red: #FF3B30;
  --green: #34C759;
  --yellow: #FFCC00;
  --orange: #FF9500;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --r-xl: 28px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.16);
  --shadow-brand: 0 8px 24px rgba(31,138,62,0.32);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== APP RESET (mobile-first, no horizontal overflow) ===== */
*, *::before, *::after {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
  min-width: 0;          /* prevents flex/grid items from overflowing */
}

html, body {
  margin: 0; padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;     /* HARD STOP for horizontal scroll — like a real app */
  overscroll-behavior-x: none;
  -webkit-text-size-adjust: 100%;
}

html.app-html {
  overscroll-behavior-y: none;
  height: 100%;
}

body.app-body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', system-ui, 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga";
  letter-spacing: -0.01em;
  overscroll-behavior-y: contain;
  position: relative;
}

/* Media never overflows */
img, video, iframe, svg, canvas {
  max-width: 100%;
  height: auto;
  display: block;
}
video, iframe { height: auto; }

/* Long words/URLs wrap instead of stretching */
p, h1, h2, h3, h4, h5, h6, span, a, div, label, button {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* Pre/code stay scrollable inside their container */
pre, code, table { max-width: 100%; overflow-x: auto; }

/* Form controls fill their container, never overflow */
input, textarea, select, button {
  font-family: inherit;
  max-width: 100%;
  box-sizing: border-box;
}
textarea { resize: vertical; }

/* ===== SPLASH SCREEN ===== */
#app-splash {
  position: fixed;
  inset: 0;
  background: var(--brand-grad);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  pointer-events: none;
  opacity: 1;
  transition: opacity .35s ease, visibility 0s linear .35s;
  visibility: visible;
}
#app-splash.hide {
  opacity: 0;
  visibility: hidden;
}
#app-splash .splash-logo {
  width: 110px; height: 110px;
  background: #fff;
  border-radius: 28px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: splashPop .55s var(--ease-spring);
  overflow: hidden;
  padding: 8px;
}
#app-splash .splash-logo img { width: 100%; height: 100%; object-fit: contain; }
#app-splash .splash-name {
  color: #fff; font-size: 22px; font-weight: 700;
  letter-spacing: 0.02em;
  animation: splashFadeUp .5s ease .15s both;
}
#app-splash .splash-tag {
  color: rgba(255,255,255,0.85); font-size: 13px;
  animation: splashFadeUp .5s ease .25s both;
}
#app-splash .splash-spin {
  margin-top: 28px;
  width: 26px; height: 26px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes splashPop {
  0% { transform: scale(0.5); opacity: 0; }
  60% { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes splashFadeUp {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== PAGE TRANSITIONS ===== */
#app-page {
  animation: pageEnter .32s var(--ease-out);
  transform-origin: center;
  will-change: transform, opacity;
}
@keyframes pageEnter {
  0% { opacity: 0; transform: translateX(24px); }
  100% { opacity: 1; transform: translateX(0); }
}
body.app-leave-fwd #app-page { animation: pageLeaveFwd .28s var(--ease-out) forwards; }
body.app-leave-back #app-page { animation: pageLeaveBack .28s var(--ease-out) forwards; }
@keyframes pageLeaveFwd {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(-30px); }
}
@keyframes pageLeaveBack {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(30px); }
}

/* Cross-document View Transitions (Chromium 126+) — automatic for same-origin nav */
@view-transition { navigation: auto; }

@supports (view-transition-name: root) {
  ::view-transition-old(root) {
    animation: 220ms var(--ease-out) both vt-fade-out;
  }
  ::view-transition-new(root) {
    animation: 280ms var(--ease-out) both vt-fade-in;
  }
}
@keyframes vt-fade-out {
  to { opacity: 0; transform: translateX(-20px); }
}
@keyframes vt-fade-in {
  from { opacity: 0; transform: translateX(28px); }
}
@keyframes vt-slide-in-back {
  from { opacity: 0; transform: translateX(-28px); }
}
@keyframes vt-slide-out-back {
  to { opacity: 0; transform: translateX(20px); }
}

/* ===== APP SCREENS (full-screen layouts like login) ===== */
.app-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--card);
}
.app-screen-hero {
  background: var(--brand-grad);
  color: #fff;
  padding: calc(var(--safe-top) + 56px) 24px 44px;
  position: relative;
  overflow: hidden;
  text-align: center;
}
.app-screen-hero .hero-logo {
  width: 76px; height: 76px;
  background: #fff;
  border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 22px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  padding: 8px;
  animation: heroLogoIn .5s var(--ease-spring);
}
.app-screen-hero .hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.app-screen-hero h1 {
  font-size: 28px; font-weight: 800;
  letter-spacing: -0.025em; margin-bottom: 8px;
  animation: heroTextIn .45s var(--ease-out) .1s both;
}
.app-screen-hero p {
  font-size: 14.5px; color: rgba(255,255,255,0.92);
  line-height: 1.5;
  max-width: 320px; margin: 0 auto;
  animation: heroTextIn .45s var(--ease-out) .2s both;
}
@keyframes heroLogoIn {
  0% { transform: scale(0.6); opacity: 0; }
  60% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes heroTextIn {
  0% { opacity: 0; transform: translateY(10px); }
  100% { opacity: 1; transform: translateY(0); }
}

.app-screen-body {
  flex: 1;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  margin-top: -28px;
  padding: 28px 22px calc(28px + var(--safe-bottom));
  position: relative;
  z-index: 2;
  animation: bodyIn .5s var(--ease-out) .15s both;
}
@keyframes bodyIn {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

.app-screen-back {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  left: 14px;
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 12px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  cursor: pointer;
  z-index: 10;
  transition: transform .15s var(--ease-out), background .15s;
}
.app-screen-back:active { transform: scale(0.88); background: rgba(255,255,255,0.28); }

/* ===== FORMS — native style ===== */
.app-form { display: flex; flex-direction: column; gap: 12px; }

.app-input-wrap {
  position: relative;
  background: var(--bg);
  border-radius: var(--r);
  border: 1.5px solid transparent;
  transition: border-color .18s var(--ease-out), background .18s, box-shadow .18s;
  min-height: 56px;
}
.app-input-wrap:focus-within {
  background: var(--card);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31,138,62,0.10);
}
.app-input-wrap.has-error {
  border-color: var(--red);
  background: #fff5f5;
}
.app-input-wrap.with-prefix .app-input { padding-left: 48px; }
.app-input-wrap.with-prefix .app-input-label { left: 48px; }

.app-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 22px 14px 8px;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
  border-radius: var(--r);
  letter-spacing: -0.005em;
  line-height: 1.3;
}
.app-input::placeholder { color: transparent; }
/* Floating label */
.app-input-label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  font-size: 15px;
  pointer-events: none;
  transition: top .18s var(--ease-out), font-size .18s var(--ease-out), color .18s, transform .18s var(--ease-out);
  font-weight: 500;
  background: transparent;
  padding: 0;
}
.app-input:focus ~ .app-input-label,
.app-input:not(:placeholder-shown) ~ .app-input-label {
  top: 9px;
  transform: translateY(0);
  font-size: 11px;
  color: var(--brand);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.app-input-wrap.has-error .app-input-label { color: var(--red); }

/* Input prefix icon (left) */
.app-input-prefix {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 19px;
  pointer-events: none;
  transition: color .18s;
  z-index: 1;
}
.app-input-wrap:focus-within .app-input-prefix { color: var(--brand); }

/* Input action icon (right, like password show/hide) */
.app-input-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text2);
  font-size: 18px;
  background: none;
  border: none;
  cursor: pointer;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, transform .1s, background .15s;
}
.app-input-icon:active { transform: translateY(-50%) scale(0.88); background: rgba(0,0,0,0.04); }
.app-input-wrap:focus-within .app-input-icon { color: var(--brand); }

.app-input-help {
  font-size: 12px;
  color: var(--text2);
  padding: 6px 16px 0;
  line-height: 1.4;
}
.app-input-error {
  font-size: 12.5px;
  color: var(--red);
  padding: 6px 16px 0;
  line-height: 1.4;
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}

/* ===== BUTTONS ===== */
.app-btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  height: 54px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform .12s var(--ease-out), box-shadow .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  letter-spacing: -0.01em;
  position: relative;
  overflow: hidden;
}
.app-btn:active { transform: scale(0.97); }
.app-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.app-btn-primary { background: var(--brand-grad); box-shadow: var(--shadow-brand); }
.app-btn-primary:active { box-shadow: 0 4px 12px rgba(31,138,62,0.25); }
.app-btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.app-btn-secondary:active { background: var(--border); }
.app-btn-ghost { background: transparent; color: var(--brand); }
.app-btn-ghost:active { background: var(--brand-soft); }

.app-btn-loading { color: transparent !important; pointer-events: none; }
.app-btn-loading::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border: 2.5px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* Social buttons */
.app-btn-social {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 14.5px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s;
  cursor: pointer;
  letter-spacing: -0.01em;
}
.app-btn-social:active { transform: scale(0.97); background: var(--bg); border-color: var(--text3); }
.app-btn-social img, .app-btn-social svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ===== DIVIDER WITH TEXT ===== */
.app-divider {
  display: flex; align-items: center; gap: 14px;
  margin: 24px 0 18px;
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.app-divider::before, .app-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--border);
}

/* ===== ALERTS / TOAST ===== */
.app-alert {
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 14px;
  display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
  animation: alertIn .25s var(--ease-spring);
}
.app-alert i { font-size: 18px; flex-shrink: 0; line-height: 1.3; }
.app-alert-error { background: #fff0ef; color: #c2251c; border: 1px solid #ffd5d2; }
.app-alert-success { background: #ecfaf0; color: #15692e; border: 1px solid #c8efd3; }
.app-alert-info { background: #e8f4ff; color: #004a99; border: 1px solid #cfe4ff; }
@keyframes alertIn {
  0% { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Toast (floating notification) */
.app-toast-stack {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 12px; right: 12px;
  z-index: 100000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.app-toast {
  background: rgba(28,28,30,0.92);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn .35s var(--ease-spring);
  pointer-events: auto;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}
.app-toast.bye { animation: toastOut .25s var(--ease-out) forwards; }
.app-toast i { font-size: 18px; }
.app-toast.success i { color: var(--green); }
.app-toast.error i { color: var(--red); }
.app-toast.info i { color: #4dabf7; }
@keyframes toastIn {
  0% { opacity: 0; transform: translateY(-100%) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-100%) scale(0.9); }
}

/* ===== PULL TO REFRESH ===== */
#ptr {
  position: fixed;
  top: calc(var(--safe-top) + 6px);
  left: 0; right: 0;
  display: flex; justify-content: center;
  pointer-events: none;
  z-index: 99;
  transform: translateY(-60px);
  transition: transform .3s var(--ease-out);
}
#ptr.show { transform: translateY(0); }
#ptr .ptr-pill {
  background: rgba(255,255,255,0.95);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-radius: 999px;
  padding: 8px 16px 8px 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
}
#ptr .ptr-spin {
  width: 18px; height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}

/* ===== BOTTOM SHEET ===== */
.app-sheet-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.app-sheet-bg.show { opacity: 1; pointer-events: auto; }

.app-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--card);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  z-index: 10000;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform .35s var(--ease-out);
  max-height: 85vh;
  overflow-y: auto;
}
.app-sheet.show { transform: translateY(0); }
.app-sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 0 auto 16px;
}

/* ===== LINK STYLES ===== */
.app-link {
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  transition: opacity .12s;
}
.app-link:active { opacity: 0.6; }

/* ===== UTILITY ===== */
.app-flex { display: flex; }
.app-flex-col { display: flex; flex-direction: column; }
.app-grow { flex: 1; }
.app-center { display: flex; align-items: center; justify-content: center; }
.app-text-center { text-align: center; }
.app-text-muted { color: var(--text2); }
.app-mt-4 { margin-top: 16px; } .app-mt-6 { margin-top: 24px; }
.app-mb-4 { margin-bottom: 16px; }

/* ============================================
   APP HOME — full native home screen
   ============================================ */

body.app-home {
  background: var(--bg);
  padding-bottom: calc(72px + var(--safe-bottom));
}
body.app-home .uzum-header,
body.app-home .uzum-main { all: unset; }

/* ===== Greeting top bar (frosted, sticky) ===== */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(242,242,247,0.85);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  padding: calc(var(--safe-top) + 8px) 16px 8px;
  display: flex; align-items: center; gap: 12px;
}
.app-topbar-logo {
  width: 36px; height: 36px;
  background: var(--card);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 4px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}
.app-topbar-logo img { width: 100%; height: 100%; object-fit: contain; }
.app-topbar-greet { flex: 1; min-width: 0; }
.app-topbar-greet .greet-hi {
  font-size: 12px; color: var(--text2); font-weight: 500;
}
.app-topbar-greet .greet-name {
  font-size: 16px; font-weight: 700; color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.app-topbar-actions { display: flex; gap: 6px; }
.app-icon-btn {
  width: 40px; height: 40px;
  background: var(--card);
  border-radius: 12px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--text);
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease-out);
  text-decoration: none;
}
.app-icon-btn:active { transform: scale(0.92); }
.app-icon-btn .dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--card);
}

/* ===== Search bar (separate row, prominent) ===== */
.app-search-wrap {
  padding: 6px 16px 12px;
}
.app-search {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: 14px;
  padding: 0 14px;
  height: 46px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid transparent;
  transition: all .15s var(--ease-out);
}
.app-search:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(31,138,62,0.08);
}
.app-search i { color: var(--brand); font-size: 18px; }
.app-search input {
  flex: 1; border: none; background: none;
  font-size: 15px; outline: none;
  font-family: inherit; color: var(--text);
  height: 100%;
}
.app-search input::placeholder { color: var(--text3); }

/* ===== Section headings ===== */
.app-section { margin: 18px 0; }
.app-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding: 0 16px;
}
.app-section-head h2 {
  font-size: 18px; font-weight: 700;
  letter-spacing: -0.02em; color: var(--text);
}
.app-section-head a {
  font-size: 13px; color: var(--brand);
  font-weight: 600;
  display: flex; align-items: center; gap: 2px;
  padding: 6px 8px; border-radius: 8px;
  transition: background .12s;
}
.app-section-head a:active { background: var(--brand-soft); }

/* ===== Category tiles (visual grid 4x) ===== */
.app-cats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 16px;
}
.app-cat {
  display: flex; flex-direction: column;
  align-items: center; gap: 6px;
  text-decoration: none;
  transition: transform .12s var(--ease-out);
}
.app-cat:active { transform: scale(0.95); }
.app-cat-icon {
  width: 56px; height: 56px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.app-cat-name {
  font-size: 11.5px; color: var(--text);
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
/* Category color variants */
.app-cat-1 .app-cat-icon { background: linear-gradient(135deg,#ff6b9d,#c93b73); }
.app-cat-2 .app-cat-icon { background: linear-gradient(135deg,#22c55e,#1f8a3e); }
.app-cat-3 .app-cat-icon { background: linear-gradient(135deg,#f59e0b,#d97706); }
.app-cat-4 .app-cat-icon { background: linear-gradient(135deg,#a855f7,#7c3aed); }
.app-cat-5 .app-cat-icon { background: linear-gradient(135deg,#06b6d4,#0891b2); }
.app-cat-6 .app-cat-icon { background: linear-gradient(135deg,#64748b,#334155); }

/* ===== Stories row (Instagram style, padded) ===== */
.app-stories {
  display: flex; gap: 14px;
  overflow-x: auto; padding: 4px 16px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-stories::-webkit-scrollbar { display: none; }

/* ===== Product grid (proper cards with shadows) ===== */
.app-products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 16px;
}
@media (min-width: 540px) { .app-products { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .app-products { grid-template-columns: repeat(4, 1fr); } }
.app-product {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform .12s var(--ease-out);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.app-product:active { transform: scale(0.97); }
.app-product-img {
  position: relative;
  width: 100%; padding-top: 100%;
  background: var(--bg);
}
.app-product-img img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
}
.app-product-fav {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: none; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .1s, color .15s;
  z-index: 2;
}
.app-product-fav:active { transform: scale(0.85); }
.app-product-fav.added { color: var(--red); }
.app-product-info {
  padding: 10px 12px 12px;
}
.app-product-price {
  font-size: 16px; font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 3px;
}
.app-product-price .currency {
  font-size: 11px; color: var(--text2); font-weight: 500;
  margin-left: 2px;
}
.app-product-title {
  font-size: 13px; color: var(--text);
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: 4px;
  min-height: 36px;
}
.app-product-seller {
  font-size: 11px; color: var(--text2);
  font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.app-product-seller i { font-size: 10px; color: var(--brand); }

/* ===== Reels row v2 ===== */
.app-reels-row {
  display: flex; gap: 10px;
  overflow-x: auto; padding: 0 16px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.app-reels-row::-webkit-scrollbar { display: none; }
.app-reel {
  flex-shrink: 0;
  width: 130px; height: 200px;
  border-radius: var(--r);
  overflow: hidden;
  position: relative;
  background: #000;
  display: block;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
  transition: transform .12s var(--ease-out);
}
.app-reel:active { transform: scale(0.96); }
.app-reel img {
  width: 100%; height: 100%; object-fit: cover;
}
.app-reel-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 30px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
}
.app-reel-views {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
}
.app-reel-views i { font-size: 13px; }
.app-reel-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.25);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
}

/* ===== Hero banner (large feature card) ===== */
.app-hero-banner {
  margin: 4px 16px 18px;
  border-radius: var(--r-lg);
  background: var(--brand-grad);
  color: #fff;
  padding: 22px 22px 24px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-brand);
}
.app-hero-banner::before {
  content: ''; position: absolute;
  top: -40px; right: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  border-radius: 50%;
}
.app-hero-banner h3 {
  font-size: 20px; font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  position: relative;
}
.app-hero-banner p {
  font-size: 13px; opacity: 0.92;
  margin-bottom: 14px;
  position: relative;
}
.app-hero-banner-btn {
  background: #fff; color: var(--brand);
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  position: relative;
  transition: transform .12s;
}
.app-hero-banner-btn:active { transform: scale(0.95); }

/* ===== List item (for cabinet menus, etc.) ===== */
.app-list {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  margin: 0 16px;
}
.app-list + .app-list { margin-top: 12px; }
.app-list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
  cursor: pointer;
}
.app-list-item:last-child { border-bottom: none; }
.app-list-item:active { background: var(--bg); }
.app-list-item-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}
.app-list-item-text { flex: 1; min-width: 0; }
.app-list-item-title { font-size: 15px; font-weight: 600; color: var(--text); }
.app-list-item-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.app-list-item-arrow { color: var(--text3); font-size: 17px; }
.app-list-item-badge {
  background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
  min-width: 20px; text-align: center;
}

/* ===== Profile card ===== */
.app-profile-card {
  margin: 16px;
  background: var(--card);
  border-radius: var(--r);
  padding: 18px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.app-profile-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
}
.app-profile-info { flex: 1; min-width: 0; }
.app-profile-name {
  font-size: 17px; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.app-profile-username {
  font-size: 13px; color: var(--text2);
  margin-top: 2px;
}
.app-profile-edit {
  background: var(--brand-soft);
  color: var(--brand);
  border: none;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

/* ===== Page header (back + title for inner screens) ===== */
.app-page-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  padding: calc(var(--safe-top) + 8px) 12px 8px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 0.5px solid var(--border);
}
.app-page-header h1 {
  flex: 1;
  font-size: 17px; font-weight: 700;
  text-align: center;
  letter-spacing: -0.01em;
}
.app-page-header .app-icon-btn {
  background: transparent;
  box-shadow: none;
}

/* ===== Empty state (improved) ===== */
.app-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text2);
}
.app-empty-icon {
  width: 80px; height: 80px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  margin: 0 auto 16px;
}
.app-empty h3 {
  font-size: 17px; font-weight: 700;
  color: var(--text); margin-bottom: 6px;
}
.app-empty p {
  font-size: 14px;
}

/* ===== Skeleton loaders ===== */
@keyframes skel {
  0% { background-position: -300px 0; }
  100% { background-position: 300px 0; }
}
.app-skel {
  background: linear-gradient(90deg, #ececec 0px, #f7f7f7 150px, #ececec 300px);
  background-size: 600px 100%;
  animation: skel 1.3s infinite linear;
  border-radius: 8px;
}

/* Hide bottom-nav on full-screen pages (login/register) */
body.app-screen-only .bottom-nav { display: none !important; }

/* ===== STORIES VIEWER (overlay — must be hidden by default) ===== */
.stories-viewer {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.95);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.stories-viewer.active { display: flex; }
.sv-container {
  position: relative;
  width: 100%; max-width: 420px;
  height: 100%; max-height: 100vh;
  background: #000;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.sv-progress-bars {
  display: flex; gap: 3px;
  padding: calc(var(--safe-top) + 8px) 8px 0;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
}
.sv-progress-seg {
  flex: 1; height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
}
.sv-progress-fill {
  height: 100%; background: #fff; width: 0%; border-radius: 2px;
  transition: width .1s linear;
}
.sv-header {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 24px) 14px 12px;
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}
.sv-header img {
  width: 36px; height: 36px;
  border-radius: 50%; object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.4);
}
.sv-header .sv-channel-name {
  color: #fff; font-size: 14px; font-weight: 600; flex: 1;
}
.sv-header .sv-time {
  color: rgba(255,255,255,0.75); font-size: 11.5px;
}
.sv-header .sv-close {
  color: #fff; background: rgba(255,255,255,0.15);
  border: none; font-size: 22px;
  cursor: pointer; padding: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform .1s;
}
.sv-header .sv-close:active { transform: scale(0.88); }
.sv-media {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.sv-media img, .sv-media video {
  width: 100%; height: 100%; object-fit: contain;
}
.sv-tap-prev, .sv-tap-next {
  position: absolute; top: 0; bottom: 0;
  z-index: 5; cursor: pointer;
}
.sv-tap-prev { left: 0; width: 40%; }
.sv-tap-next { right: 0; width: 60%; }

/* ===== STORIES BAR (homepage) — refined ===== */
.stories-bar {
  display: flex; gap: 14px;
  overflow-x: auto;
  padding: 6px 16px 10px;
  scrollbar-width: none;
  margin: 4px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.stories-bar::-webkit-scrollbar { display: none; }
.story-circle {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; cursor: pointer; flex-shrink: 0;
  text-decoration: none; color: inherit;
  transition: transform .12s var(--ease-out);
  width: 64px;
}
.story-circle:active { transform: scale(0.94); }
.story-avatar-ring {
  width: 64px; height: 64px;
  border-radius: 50%; padding: 2.5px;
  background: conic-gradient(from 200deg, #34C759, #1f8a3e, #FFCC00, #FF8A00, #FF3B30, #34C759);
  position: relative;
  box-sizing: border-box;
}
.story-avatar-ring img {
  width: 100%; height: 100%;
  border-radius: 50%; object-fit: cover;
  border: 2.5px solid var(--bg);
  background: var(--bg);
  display: block;
}
.story-add .story-avatar-ring {
  background: var(--bg);
  border: 2px dashed var(--border-2);
  padding: 0;
}
.story-add .story-avatar-ring img {
  border: none;
}
.story-add-icon {
  position: absolute; bottom: -2px; right: -2px;
  width: 22px; height: 22px;
  background: var(--brand); color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border: 3px solid var(--bg);
  line-height: 1;
}
.story-name {
  font-size: 11px; color: var(--text);
  font-weight: 500;
  max-width: 64px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  text-align: center;
}
.story-add { text-decoration: none; color: inherit; }
