/*-----------------------------------*\
  RICEBILL — MOBILE NAV STYLES
  m-style.css v1.0

  Uses the app's existing design tokens
  (--nav-bg, --nav-text-active, --nav-border, etc.)
  so theme changes cascade automatically.
\*-----------------------------------*/

/* ─── Ease curves ─── */
:root {
  --mob-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --mob-ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   BOTTOM NAV SHELL
   Overrides the old .mobile-bottom-nav definition.
   ============================================================ */
.mobile-bottom-nav {
  display: none;                       /* hidden on desktop */
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  height: 72px;
  background: var(--nav-bg);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border-top: 1px solid var(--nav-border);
  border-radius: 20px 20px 0 0;
  padding: 0 4px calc(env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 0 rgba(255,255,255,0.06) inset, 0 -8px 32px rgba(0,0,0,0.22);
  z-index: 9999;
  overflow: visible;
  /* Flex layout for the 5 items */
  align-items: center;
  justify-content: space-around;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px) + 16px) !important;
  }
}

/* Inner top-highlight line */
.mobile-bottom-nav::before {
  content: '';
  position: absolute;
  top: 0; left: 12%; width: 76%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  pointer-events: none;
}

/* ============================================================
   SLIDING PILL INDICATOR
   ============================================================ */
.mob-pill {
  position: absolute;
  top: 8px;
  height: 32px;
  border-radius: 99px;
  background: rgba(var(--color-primary-fixed-rgb), 0.15);
  border: 1px solid rgba(var(--color-primary-fixed-rgb), 0.12);
  transition: left 0.35s var(--mob-ease-spring), width 0.35s var(--mob-ease-spring), opacity 0.2s;
  pointer-events: none;
  opacity: 0;
}
.mob-pill.visible { opacity: 1; }

/* ============================================================
   NAV ITEMS
   ============================================================ */
.mob-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border: none;
  background: none;
  cursor: pointer;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.mob-nav-item:active { transform: scale(0.88); }

.mob-nav-icon {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}

.mob-nav-icon .material-symbols-rounded {
  font-size: 22px;
  color: var(--nav-text);
  font-variation-settings: 'FILL' 0, 'wght' 300;
  transition: color 0.25s, font-variation-settings 0.25s var(--mob-ease-spring);
}

.mob-nav-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--nav-text);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: color 0.25s, font-weight 0.2s;
  white-space: nowrap;
}

/* Active state */
.mob-nav-item.active .mob-nav-icon .material-symbols-rounded {
  color: var(--nav-text-active);
  font-variation-settings: 'FILL' 1, 'wght' 600;
}
.mob-nav-item.active .mob-nav-label {
  color: var(--nav-text-active);
  font-weight: 800;
}

/* Badge (notification dot) */
.mob-nav-badge {
  position: absolute;
  top: -3px; right: -5px;
  min-width: 14px; height: 14px;
  background: var(--color-error);
  border-radius: 99px;
  font-size: 8px;
  font-weight: 800;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 1.5px solid transparent;
}

/* ============================================================
   CENTER FAB SLOT
   ============================================================ */
.mob-nav-center {
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mob-fab {
  width: 50px; height: 50px;
  border-radius: 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  display: flex; align-items: center; justify-content: center;
  border: none;
  cursor: pointer;
  transform: translateY(-10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.30), 0 1px 4px rgba(0,0,0,0.15);
  transition: transform 0.25s var(--mob-ease-spring), box-shadow 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.mob-fab:active {
  transform: translateY(-10px) scale(0.88);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.mob-fab .material-symbols-rounded {
  font-size: 24px;
  font-variation-settings: 'FILL' 1, 'wght' 700;
}

/* ============================================================
   MORE DRAWER
   ============================================================ */
.mob-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s;
}
.mob-drawer-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.mob-drawer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(32px) saturate(220%);
  -webkit-backdrop-filter: blur(32px) saturate(220%);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--nav-border);
  padding: 0 0 calc(80px + env(safe-area-inset-bottom, 0px));
  z-index: 10002;
  transform: translateY(100%);
  transition: transform 0.38s var(--mob-ease-out);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.32);
}
.mob-drawer.open {
  transform: translateY(0);
}

.mob-drawer-handle {
  width: 36px; height: 4px;
  background: rgba(var(--color-primary-fixed-rgb), 0.25);
  border-radius: 99px;
  margin: 12px auto 0;
}

.mob-drawer-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--nav-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 20px 10px;
  opacity: 0.7;
}

.mob-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 14px 8px;
}

.mob-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 6px 11px;
  border-radius: 18px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--nav-border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, transform 0.15s var(--mob-ease-spring), border-color 0.15s;
}
.mob-drawer-item:active {
  transform: scale(0.9);
  background: rgba(var(--color-primary-fixed-rgb), 0.12);
  border-color: rgba(var(--color-primary-fixed-rgb), 0.3);
}

.mob-drawer-icon {
  width: 40px; height: 40px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
}
.mob-drawer-icon .material-symbols-rounded {
  font-size: 20px;
  font-variation-settings: 'FILL' 1, 'wght' 500;
}

.mob-drawer-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--nav-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: center;
  line-height: 1.3;
}

/* ============================================================
   DESKTOP HEADER PILL STRIP
   Shown on desktop inline with the page title; hidden on mobile.
   ============================================================ */
.desk-sub-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  flex-wrap: wrap;
}

.desk-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--outline-variant);
  color: var(--on-surface-variant);
  background: var(--surface-container-low);
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.15s var(--mob-ease-spring);
  letter-spacing: 0.2px;
}
.desk-sub-pill .material-symbols-outlined,
.desk-sub-pill .material-symbols-rounded {
  font-size: 14px;
  font-variation-settings: 'FILL' 0, 'wght' 400;
}
.desk-sub-pill:hover {
  background: var(--surface-container);
  border-color: var(--outline);
}
.desk-sub-pill:active { transform: scale(0.94); }
.desk-sub-pill.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
.desk-sub-pill.active .material-symbols-outlined,
.desk-sub-pill.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600;
}

@media (max-width: 1023px) {
  .desk-sub-nav { display: none; }
}

/* ============================================================
   IN-PAGE SUB-NAVIGATION PILLS
   Shown on mobile below the page title; hidden on desktop.
   ============================================================ */
.mob-sub-nav {
  display: none;           /* desktop: hidden — sidebar handles it */
}

@media (max-width: 1023px) {
  /* Show pill strip on mobile */
  .mob-sub-nav {
    display: flex;
    gap: 8px;
    padding: 12px 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .mob-sub-nav::-webkit-scrollbar { display: none; }

  /* Hide ALL module sidebars on mobile — using descendant selectors
     so they work regardless of the module-content wrapper div. */
  #gst-bill      aside:not(.summary-sidebar),
  #customers     aside:not(.summary-sidebar),
  #purchase      aside:not(.summary-sidebar),
  #settlement    aside:not(.summary-sidebar),
  #staff-account aside:not(.summary-sidebar),
  #settings      aside:not(.summary-sidebar),
  #reports       aside:not(.summary-sidebar) {
    display: none !important;
  }
}

.mob-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--outline-variant);
  color: var(--on-surface-variant);
  background: var(--surface-container-low);
  flex-shrink: 0;
  transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.15s var(--mob-ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.mob-sub-pill .material-symbols-rounded {
  font-size: 15px;
  font-variation-settings: 'FILL' 0, 'wght' 400;
}
.mob-sub-pill:active {
  transform: scale(0.93);
}
.mob-sub-pill.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
.mob-sub-pill.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 600;
}

/* ============================================================
   COMPACT IN-CONTENT TOOLBAR
   Single row: segmented filter on left + action chip on right.
   Replaces two stacked mob-sub-pill rows in content sections.
   ============================================================ */
.compact-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

/* Segmented filter: [All][B2B][B2C] joined group */
.filter-seg {
  display: inline-flex;
  border: 1.5px solid var(--outline-variant);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-container-low);
}
.filter-seg-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--on-surface-variant);
  cursor: pointer;
  white-space: nowrap;
  border-right: 1.5px solid var(--outline-variant);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.filter-seg-btn:last-child { border-right: none; }
.filter-seg-btn.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.filter-seg-btn:active { transform: scale(0.94); }

/* Action chip: icon + label, right side of toolbar */
.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--outline-variant);
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s, transform 0.15s var(--mob-ease-spring);
  -webkit-tap-highlight-color: transparent;
}
.action-chip .material-symbols-rounded {
  font-size: 15px;
  font-variation-settings: 'FILL' 0, 'wght' 400;
}
.action-chip:active { transform: scale(0.93); }

/* Only show compact toolbar on mobile; on desktop the sidebar handles navigation */
@media (min-width: 1024px) {
  .compact-toolbar { display: none; }
}

/* ============================================================
   FAB SPEED-DIAL MENU
   ============================================================ */
.mob-fab-wrapper {
  position: relative;
  width: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Backdrop — fades in softly */
.mob-fab-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0,0,0,0.30);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.mob-fab-backdrop.open { opacity: 1; pointer-events: all; }

/* Menu stack — centered above the FAB */
.mob-fab-menu {
  position: absolute;
  bottom: calc(100% + 20px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
  z-index: 10000;
  width: 192px;
}

/* Card — frosted glass, accent tint via ::before, NO colored border */
.mob-fab-menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 8px;
  border-radius: 18px;
  cursor: pointer;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.86);
  transition: transform 0.32s var(--mob-ease-spring), opacity 0.22s;
  pointer-events: none;
  -webkit-tap-highlight-color: transparent;
  background: var(--nav-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 30px rgba(0,0,0,0.26), 0 2px 8px rgba(0,0,0,0.16),
              inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Subtle per-item color wash inside the card */
.mob-fab-menu-item::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--sd-color, transparent);
  opacity: 0.09;
  pointer-events: none;
}

/* Stagger: Staff (3) rises first, Customers (1) last */
.mob-fab-menu.open .mob-fab-menu-item:nth-child(3) { opacity:1; transform:none; transition-delay:0.02s; pointer-events:all; }
.mob-fab-menu.open .mob-fab-menu-item:nth-child(2) { opacity:1; transform:none; transition-delay:0.07s; pointer-events:all; }
.mob-fab-menu.open .mob-fab-menu-item:nth-child(1) { opacity:1; transform:none; transition-delay:0.12s; pointer-events:all; }

.mob-fab-menu-item:active { transform: scale(0.94) !important; }

/* Circular colored icon */
.mob-fab-menu-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--sd-color, var(--nav-text-active));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 12px rgba(0,0,0,0.28);
  position: relative;
  z-index: 1;
}
.mob-fab-menu-icon .material-symbols-rounded {
  font-size: 19px;
  font-variation-settings: 'FILL' 1, 'wght' 600;
  color: #fff;
}

/* Text */
.mob-fab-menu-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.mob-fab-menu-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--on-surface, #eee);
  white-space: nowrap;
  line-height: 1;
}
.mob-fab-menu-sub {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--sd-color);
  line-height: 1;
}

/* Chevron */
.mob-fab-menu-chevron {
  font-size: 16px;
  flex-shrink: 0;
  color: var(--on-surface-variant, #aaa);
  opacity: 0.35;
  font-variation-settings: 'FILL' 0, 'wght' 300;
  position: relative;
  z-index: 1;
}

/* FAB: icon rotates on open, no ring (avoids the visible halo in closed state) */
.mob-fab .material-symbols-rounded {
  transition: transform 0.32s var(--mob-ease-spring);
}
.mob-fab.fab-open .material-symbols-rounded { transform: rotate(45deg); }
.mob-fab.fab-open {
  box-shadow: 0 8px 28px rgba(0,0,0,0.42), 0 2px 8px rgba(0,0,0,0.22);
}

/* ============================================================
   ANIMATION
   ============================================================ */
@keyframes mob-slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SETTINGS — SUBSCRIPTION BADGE PILL  (shared, desktop + mobile)
   .sub-badge-pill   — base pill, used in both contexts
   .mob-only-badge   — shown only on mobile (≤1023px), lives in header-with-info
   .desk-badge-pill  — shown only on desktop (≥1024px), lives in sidebar card
   ============================================================ */
.sub-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 10px;
  border-radius: 99px;
  background: rgba(var(--color-success-rgb, 34,197,94), 0.10);
  border: 1.5px solid rgba(var(--color-success-rgb, 34,197,94), 0.28);
}

.sub-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success, #22c55e);
  flex-shrink: 0;
  animation: sub-badge-pulse 2.4s ease-in-out infinite;
}

@keyframes sub-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34,197,94, 0.28); }
  50%       { box-shadow: 0 0 0 5px rgba(34,197,94, 0.0);  }
}

.sub-badge-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.55;
  color: var(--on-surface);
}

.sub-badge-plan {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-success, #22c55e);
  letter-spacing: 0.2px;
}

/* Mobile badge — inside header-with-info, pushed to far right */
.mob-only-badge {
  margin-left: auto;   /* pushes it to the right end of header-with-info */
  animation: mob-slide-up 0.3s var(--mob-ease-out) both;
}

/* Desktop badge — fills the sidebar card, hidden on mobile */
.desk-badge-pill {
  width: 100%;
  justify-content: center;
  margin-bottom: 0;
}

/* Show/hide by breakpoint */
@media (max-width: 1023px) {
  .desk-badge-pill { display: none !important; }
}
@media (min-width: 1024px) {
  .mob-only-badge { display: none !important; }
}
