/* ============================================================
   PAKHANJURE ONE - Base Stylesheet (v4.0 - App Shell Layout)
   ============================================================
   Reset + Variables + Layout + Typography + Responsive
   ============================================================ */

/* ============================================================
   1. CSS VARIABLES (Design Tokens)
   ============================================================ */
:root {
  --bg-canvas: #050811;
  --bg-page: #0a0f1d;
  --bg-card: #121929;
  --bg-input: #1c2638;
  --bg-hover: #1e293b;

  --brand-orange: #ff7a00;
  --brand-orange-hover: #e56e00;
  --brand-orange-light: rgba(255, 122, 0, 0.15);
  --brand-blue: #2563eb;
  --brand-blue-light: rgba(37, 99, 235, 0.15);

  --text-primary: #ffffff;
  --text-secondary: #cbd5e1;
  --text-muted: #8e9bb0;
  --text-placeholder: #55657d;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #ff7a00;
  --warning-bg: rgba(255, 122, 0, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #2563eb;
  --info-bg: rgba(37, 99, 235, 0.15);

  --border-light: #223049;
  --border-dark: #1c2638;
  --border-focus: #ff7a00;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --radius-frame: 28px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;

  --text-xs: 10px;
  --text-sm: 12px;
  --text-base: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 18px;
  --text-2xl: 22px;
  --text-3xl: 28px;

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-brand: 0 10px 24px rgba(255, 122, 0, 0.35);

  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  --z-nav: 1000;
  --z-modal: 9999;
  --z-toast: 999999;
  --z-loader: 999998;

  --app-max-width: 100%;
  --app-content-max-width: 1200px;
  --nav-height: 64px;
}

/* ============================================================
   2. RESET
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

* {
  -webkit-tap-highlight-color: transparent !important;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important;
}

html {
  -webkit-tap-highlight-color: transparent !important;
  scroll-behavior: smooth;
}

/* ============================================================
   3. GLOBAL RESET — BODY SCROLL BAND (APP SHELL)
   ============================================================ */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden !important;   /* Body scroll band */
  background-color: var(--bg-canvas);
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: none;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: var(--text-md);
  font-weight: var(--fw-normal);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent !important;

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

  -webkit-user-select: auto !important;
  user-select: auto !important;
  -webkit-touch-callout: default !important;
  touch-action: pan-y;
}

/* ============================================================
   4. TYPOGRAPHY RESET
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: 1.3;
  color: var(--text-primary);
}

p { line-height: 1.5; }

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

img {
  max-width: 100%;
  width: 100%;
  display: block;
  object-fit: cover;
}

/* ============================================================
   5. SCROLLBAR (Custom)
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: var(--radius-pill); }
::-webkit-scrollbar-thumb:hover { background: var(--text-placeholder); }

::selection { background: var(--brand-orange); color: #ffffff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand-orange); outline-offset: 2px; }

/* ============================================================
   6. APP FRAME LAYOUT — FIXED HEIGHT (App Shell)
   ============================================================ */
.mobile-app-frame,
.auth-frame,
.partner-frame,
.rider-frame,
.admin-frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto !important;
  padding: 0 !important;
  background-color: var(--bg-page);

  /* FIX: Body ke andar fixed height */
  height: 100vh !important;
  max-height: 100vh !important;

  display: flex;
  flex-direction: column;

  /* FIX: Frame ke andar scroll nahi hoga, child karega */
  overflow: hidden !important;

  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

/* ============================================================
   7. SCROLLABLE AREAS — MAIN SCROLL FIX
   ============================================================ */
.customer-scroll-view,
.profile-scroll-view,
.cart-scroll-view,
.offers-scroll-view,
.track-scroll-view,
.menu-scrollable-content,
.success-container,
.admin-scroll-view,
.partner-scroll-view,
.rider-scroll-view {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  background-color: var(--bg-page);
  color: var(--text-primary);
  width: 100%;
  padding-bottom: 80px;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  box-sizing: border-box;
}

/* Header aur Bottom Nav ko fix rakhein */
.rider-top-nav,
.top-brand-bar,
.home-header,
.partner-header,
.admin-header,
.cart-header-bar,
.track-header-bar,
.filter-header-bar,
.app-nav-dock {
  flex-shrink: 0 !important;
}

/* ============================================================
   8. AUTH BODY CONTAINER (Registration Page)
   ============================================================ */
.auth-body-container {
  margin: 0 !important;
  padding-top: 20px !important;
  padding-bottom: 40px !important;
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y !important;
  box-sizing: border-box;
}

/* ============================================================
   9. SPLASH WRAPPER (Splash Page)
   ============================================================ */
.splash-wrapper {
  flex: 1 1 0% !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 20px;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: space-between;

  color: #ffffff;
}

/* ============================================================
   10. RESPONSIVE BREAKPOINTS
   ============================================================ */

/* ---------- SMALL PHONE (<= 360px) ---------- */
@media (max-width: 360px) {
  :root {
    --text-2xl: 20px;
    --text-3xl: 24px;
  }
}

/* ---------- TABLET / DESKTOP MODE (>= 768px) ---------- */
@media (min-width: 768px) {
  .mobile-app-frame,
  .auth-frame,
  .partner-frame,
  .rider-frame,
  .admin-frame {
    max-width: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .customer-scroll-view,
  .profile-scroll-view,
  .cart-scroll-view,
  .offers-scroll-view,
  .track-scroll-view,
  .menu-scrollable-content,
  .success-container,
  .admin-scroll-view,
  .partner-scroll-view,
  .rider-scroll-view,
  .auth-body-container,
  .splash-wrapper {
    max-width: var(--app-content-max-width);
    width: 100%;
    margin: 0 auto !important;
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
  }

  .home-header,
  .partner-header,
  .rider-header,
  .admin-header,
  .top-brand-bar {
    max-width: var(--app-content-max-width);
    width: 100%;
    margin: 0 auto !important;
    padding-left: 24px;
    padding-right: 24px;
  }

  .app-nav-dock {
    max-width: var(--app-content-max-width);
    width: 100%;
    margin: 0 auto !important;
    left: 0;
    right: 0;
    border-radius: 0;
  }
}

@media (min-width: 1024px) {
  .customer-scroll-view,
  .profile-scroll-view,
  .cart-scroll-view,
  .offers-scroll-view,
  .track-scroll-view,
  .menu-scrollable-content,
  .success-container,
  .admin-scroll-view,
  .partner-scroll-view,
  .rider-scroll-view,
  .auth-body-container {
    padding-left: 32px;
    padding-right: 32px;
  }

  .restaurants-scroll-row {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    overflow-x: visible !important;
  }

  .dishes-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 16px;
  }
}

@media (min-width: 1400px) {
  :root { --app-content-max-width: 1400px; }
  .dishes-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

@media (min-width: 1800px) {
  :root { --app-content-max-width: 1600px; }
}

/* ============================================================
   11. SECTION HEADERS
   ============================================================ */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.section-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.link-see-all {
  font-size: var(--text-base);
  color: var(--brand-orange);
  text-decoration: none;
  font-weight: var(--fw-bold);
  background: transparent;
  border: none;
  cursor: pointer;
}

/* ============================================================
   12. EMPTY STATES
   ============================================================ */
.empty-cart-box,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px;
  margin: auto 0;
}

.empty-cart-icon,
.empty-icon {
  font-size: 52px;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

.empty-cart-box h2,
.empty-state h2 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-cart-box p,
.empty-state p {
  font-size: var(--text-md);
  color: var(--text-muted);
  max-width: 260px;
}

/* ============================================================
   13. BRAND BADGE
   ============================================================ */
.brand-badge {
  background: #ffffff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: var(--fw-extrabold);
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

.badge-p { color: var(--brand-blue); }
.badge-one { color: var(--brand-orange); }

.brand-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.brand-title span { color: var(--brand-orange); }

/* ============================================================
   14. UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--text-primary); }
.text-orange { color: var(--brand-orange); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

.fw-bold { font-weight: var(--fw-bold); }
.fw-extrabold { font-weight: var(--fw-extrabold); }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-pill); }

/* ============================================================
   15. GLOBAL LOADER
   ============================================================ */
#globalLoader {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 17, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loader);
}

#globalLoader.show { display: flex; }

.p1-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--brand-orange-light);
  border-top-color: var(--brand-orange);
  border-radius: 50%;
  animation: p1-spin 0.8s linear infinite;
}

@keyframes p1-spin { to { transform: rotate(360deg); } }

/* ============================================================
   16. SKELETON LOADER
   ============================================================ */
.p1-skeleton,
.skeleton-card {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-input) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: p1-skeleton-anim 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes p1-skeleton-anim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   17. SCROLL PADDING (bottom dock ke liye)
   ============================================================ */
.has-bottom-dock {
  padding-bottom: calc(var(--nav-height) + 20px);
}

/* ============================================================
   18. SCROLLBAR HIDE
   ============================================================ */
.no-scrollbar {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar { display: none; }

/* ============================================================
   19. BUTTON RESET
   ============================================================ */
.btn-reset {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* ============================================================
   20. REDUCE MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   21. LANDSCAPE MODE
   ============================================================ */
@media (max-height: 500px) and (orientation: landscape) {
  .mobile-app-frame,
  .auth-frame,
  .partner-frame,
  .rider-frame,
  .admin-frame {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
  }

  .customer-scroll-view,
  .profile-scroll-view,
  .cart-scroll-view,
  .offers-scroll-view,
  .track-scroll-view,
  .menu-scrollable-content,
  .success-container,
  .admin-scroll-view,
  .partner-scroll-view,
  .rider-scroll-view,
  .auth-body-container,
  .splash-wrapper {
    padding-bottom: 80px;
  }
}