/* ============================================================
   BabyPlus POS — mobile-ui.css  (v9.0)
   রেফারেন্স স্ক্রিনশট অনুযায়ী শুধুমাত্র মোবাইল ভিউয়ের নতুন ডিজাইন।

   ⚠️ গুরুত্বপূর্ণ:
   - এই ফাইলটি সম্পূর্ণ "additive" — style.css এর কোনো লাইন মোছা বা
     পরিবর্তন করা হয়নি। এটা style.css এর *পরে* লোড হবে।
   - ৯০০px এর বড় স্ক্রিনে (ডেস্কটপ/ল্যাপটপ) কিছুই বদলায় না।
   - প্রিন্ট (A4 স্টিকার/থার্মাল রিসিট) আচরণে কোনো হাত দেওয়া হয়নি।
   - কোনো ডাটা/জেএস লজিক এখানে নেই — শুধু চেহারা।
   ============================================================ */

/* নতুন এলিমেন্টগুলো ডেস্কটপে সম্পূর্ণ লুকানো থাকবে */
.bp-mheader,
.bp-bottomnav,
.bp-drawer-backdrop { display: none; }

@media (max-width: 900px) {

  /* ---------- বেস ---------- */
  body {
    background: #F2F5FA;
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
  .app-shell { display: block; }
  .main-area { background: transparent; }
  .main-area .container { padding: 14px 13px 24px; }

  /* পুরনো টপ হেডার লুকানো — সার্চ/প্রোফাইল বাটনে চাপলে নিচে খুলবে */
  #appScreen .topheader { display: none; }
  #appScreen .topheader.bp-open {
    display: flex;
    margin-bottom: 14px;
    border-radius: 16px;
  }

  /* ---------- নতুন টপ হেডার ---------- */
  .bp-mheader {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 700;
    background: #fff;
    padding: 10px 12px;
    border-bottom: 1px solid #E8ECF4;
    box-shadow: 0 2px 12px rgba(15, 23, 42, .05);
  }
  .bp-mh-btn {
    flex: none;
    width: 38px; height: 38px;
    border: none; background: transparent;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 11px; color: #1E293B;
  }
  .bp-mh-btn:active { background: #EEF2F9; }
  .bp-mh-btn svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; }

  .bp-mh-brand { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
  .bp-mh-brand img {
    width: 100%; height: 100%; display: block; object-fit: contain;
  }
  .bp-mh-name {
    display: flex; align-items: center; gap: 7px;
    font-family: 'Baloo Da 2', 'Hind Siliguri', sans-serif;
    font-weight: 800; font-size: 21px; line-height: 1.1; color: #2563EB;
    white-space: nowrap;
  }
  .bp-mh-name .bp-pink { color: #EC4899; }
  .bp-mh-name .bp-chip {
    font-family: 'Baloo Da 2', sans-serif;
    font-size: 12px; font-weight: 800; letter-spacing: .5px;
    color: #1E3A8A; background: #fff;
    border: 2px solid #1E3A8A; border-radius: 9px;
    padding: 0 8px; line-height: 20px;
  }
  .bp-mh-tag {
    font-size: 10.5px; font-weight: 700; color: #64748B; margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .bp-mh-tag b { color: #2563EB; font-weight: 700; }

  .bp-mh-icon {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    border: none; background: #F3F5FA; cursor: pointer;
    display: flex; align-items: center; justify-content: center; color: #334155;
  }
  .bp-mh-icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; }
  .bp-mh-avatar {
    flex: none; width: 40px; height: 40px; border-radius: 50%;
    border: none; cursor: pointer; color: #fff;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
  }
  .bp-mh-avatar svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }

  /* ---------- সাইডবার এখন স্লাইড-ইন ড্রয়ার ---------- */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 262px !important;
    height: 100vh; min-height: 100vh;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    padding: 18px 14px 18px !important;
    gap: 0 !important;
    border-radius: 0;
    z-index: 1200;
    overflow-y: auto;
    transform: translateX(-104%);
    transition: transform .26s ease;
  }
  .sidebar.bp-drawer-open { transform: translateX(0); }

  .sidebar-brand { padding: 4px 4px 16px !important; flex: none !important; }
  .sidebar-brand .mark { width: 46px !important; height: 46px !important; border-radius: 14px !important; }
  .sidebar-brand-text .name { font-size: 17.5px !important; }
  .sidebar-brand-text .tagline { font-size: 10.5px !important; }

  .sidebar-nav {
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: hidden !important;
    overflow-y: auto;
    width: 100%; order: 0 !important;
    gap: 4px !important; padding: 0 2px 6px !important;
  }
  .sidebar-nav .tabbtn {
    flex: none !important;
    white-space: normal !important;
    text-align: left; justify-content: flex-start;
    font-size: 13.5px !important;
    padding: 11px 13px !important;
    border-radius: 11px !important;
  }
  .sidebar-nav .tabbtn .icon-svg { width: 18px !important; height: 18px !important; }
  .sidebar-foot { display: block !important; }

  .bp-drawer-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(11, 23, 57, .45);
    z-index: 1100;
    opacity: 0; visibility: hidden;
    transition: opacity .26s ease, visibility .26s ease;
  }
  .bp-drawer-backdrop.bp-show { opacity: 1; visibility: visible; }

  /* ---------- ওয়েলকাম ব্যানার ---------- */
  .welcome-banner {
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
    padding: 16px 16px !important;
    border-radius: 18px;
    background: linear-gradient(120deg, #E3EEFF 0%, #EDF4FF 60%, #F7EDFF 100%);
    border: 1px solid #DBE7FB;
    margin-bottom: 16px;
  }
  .welcome-banner .wtext { flex: 1; min-width: 0; }
  .welcome-banner .wtext h2 { font-size: 18px !important; line-height: 1.35; }
  .welcome-banner .wtext p { font-size: 12.5px !important; line-height: 1.6; }
  .welcome-banner .wmascot {
    display: block !important;
    font-size: 46px !important;
    line-height: 1;
  }
  .welcome-banner .welcome-status { display: none; }

  /* ---------- স্ট্যাট কার্ড: উপরে ২টি, নিচে ৩টি ---------- */
  .stat-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 11px !important;
    margin-bottom: 16px;
  }
  .stat-card {
    grid-column: span 3;
    border-radius: 18px !important;
    padding: 15px 15px 17px !important;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .10);
  }
  .stat-card:nth-child(n+3) {
    grid-column: span 2;
    padding: 13px 12px 15px !important;
  }
  .stat-card .icon-badge {
    width: 36px !important; height: 36px !important;
    border-radius: 50% !important; font-size: 17px !important;
    margin-bottom: 10px !important;
    background: rgba(255, 255, 255, .25);
  }
  .stat-card:nth-child(n+3) .icon-badge { width: 32px !important; height: 32px !important; font-size: 15px !important; }
  .stat-card .lbl { font-size: 12.5px !important; line-height: 1.45; }
  .stat-card:nth-child(n+3) .lbl { font-size: 11.5px !important; }
  .stat-card .val { font-size: 27px !important; margin-top: 6px !important; }
  .stat-card:nth-child(n+3) .val { font-size: 22px !important; }
  .stat-card .sub { font-size: 11px !important; margin-top: 6px !important; line-height: 1.4; }
  .stat-card:nth-child(n+3) .sub { font-size: 10.5px !important; }

  /* কার্ডের নিচে হালকা ওয়েভ লাইন (স্ক্রিনশটের মতো) */
  .stat-card::after {
    content: '';
    position: absolute; left: 0; right: 0; bottom: 0;
    height: 30px; pointer-events: none; opacity: .55;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 20' preserveAspectRatio='none'%3E%3Cpath d='M0 15 C 18 3 32 18 52 9 S 84 2 100 9' fill='none' stroke='%23ffffff' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat bottom center / 100% 100%;
  }

  /* ---------- ড্যাশবোর্ড কার্ড ও চার্ট ---------- */
  .dash-card, .card {
    border-radius: 18px !important;
    padding: 16px 15px !important;
    border: 1px solid #E8ECF4;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
    margin-bottom: 16px !important;
  }
  .dash-card .dash-card-head h2 { font-size: 16px !important; }
  .dash-card .dash-card-head h2 .num {
    width: 30px !important; height: 30px !important;
    border-radius: 10px !important; font-size: 15px !important;
  }
  .dash-card .see-all {
    font-size: 12px !important;
    background: #EFF6FF; color: #2563EB;
    border-radius: 999px; padding: 7px 13px;
  }

  .chartwrap.newchart {
    height: 178px !important;
    gap: 9px !important;
    padding: 10px 2px 0 !important;
    border-bottom: 1px solid #EEF1F7;
    background-image: linear-gradient(#F1F4FA 1px, transparent 1px);
    background-size: 100% 42px;
    background-position: 0 6px;
  }
  .chartwrap.newchart .barcol .bar {
    background: linear-gradient(180deg, #3B82F6, #1D4ED8) !important;
    border-radius: 9px 9px 4px 4px !important;
    max-width: 34px !important;
  }
  .chartwrap.newchart .barcol:last-child .bar {
    background: linear-gradient(180deg, #93C5FD, #3B82F6) !important;
  }
  .chartwrap.newchart .barcol .lbl { font-size: 11.5px !important; color: #64748B !important; }

  /* ---------- সর্বশেষ অর্ডার টেবিল ---------- */
  .recent-table { min-width: 470px; }
  .recent-table th {
    font-size: 11px !important;
    color: #64748B !important;
    background: #F7F9FC;
    padding: 9px 8px !important;
    border-bottom: none !important;
  }
  .recent-table th:first-child { border-radius: 9px 0 0 9px; }
  .recent-table th:last-child { border-radius: 0 9px 9px 0; }
  .recent-table td { font-size: 12.5px !important; padding: 10px 8px !important; }
  .recent-table .recent-prod .ic { width: 30px !important; height: 30px !important; font-size: 15px !important; }
  .recent-table .status { font-size: 10.5px !important; padding: 4px 9px !important; }

  /* ---------- অন্যান্য ট্যাবের টেবিল/ফর্ম ---------- */
  .sales-table th, .sales-table td { padding: 9px 10px !important; }
  .table-responsive { border-radius: 12px; }

  /* ---------- নিচের নেভিগেশন বার ---------- */
  .bp-bottomnav {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 900;
    background: #fff;
    border-top: 1px solid #E8ECF4;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(15, 23, 42, .07);
  }
  .bp-bn-item {
    flex: 1; min-width: 0;
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    font-family: inherit; font-size: 10.5px; font-weight: 700;
    color: #94A3B8; padding: 5px 2px;
  }
  .bp-bn-item svg {
    width: 22px; height: 22px;
    stroke: currentColor; fill: none;
    stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
  }
  .bp-bn-item span {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .bp-bn-item.bp-active { color: #2563EB; }
  .bp-bn-item.bp-active svg { stroke-width: 2.2; }

  /* টোস্ট যেন নিচের নেভিগেশনের নিচে চাপা না পড়ে */
  #toastHost { bottom: calc(88px + env(safe-area-inset-bottom)); }
}

/* খুব ছোট ফোন (≤360px) */
@media (max-width: 360px) {
  .bp-mh-name { font-size: 18.5px; }
  .bp-mh-tag { font-size: 9.5px; }
  .stat-card:nth-child(n+3) .val { font-size: 19px !important; }
  .bp-bn-item { font-size: 9.5px; }
}

/* মোশন কম রাখার সেটিং চালু থাকলে ড্রয়ার সরাসরি খুলবে */
@media (prefers-reduced-motion: reduce) {
  .sidebar, .bp-drawer-backdrop { transition: none !important; }
}

/* প্রিন্টে নতুন কোনো এলিমেন্ট আসবে না */
@media print {
  .bp-mheader, .bp-bottomnav, .bp-drawer-backdrop { display: none !important; }
}

/* ============================================================
   [v9.1] মোবাইলে "সর্বশেষ অর্ডার" — টেবিলের বদলে কার্ড লিস্ট
   (শুধু CSS, app.js-এর renderRecentOrders() অপরিবর্তিত)
   ============================================================ */
@media (max-width: 700px) {

  #tab-dashboard .table-responsive { overflow: visible; }

  #tab-dashboard .recent-table {
    min-width: 0 !important;
    display: block;
    width: 100%;
  }
  #tab-dashboard .recent-table thead { display: none; }
  #tab-dashboard .recent-table tbody { display: block; }

  #tab-dashboard .recent-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 3px 10px;
    padding: 11px 12px;
    margin-bottom: 9px;
    background: #F8FAFC;
    border: 1px solid #EBEFF6;
    border-radius: 14px;
  }
  #tab-dashboard .recent-table tbody tr:last-child { margin-bottom: 0; }

  #tab-dashboard .recent-table td {
    display: block;
    border: none !important;
    padding: 0 !important;
    min-width: 0;
    font-size: 13px;
  }

  /* ১ম সারি: প্রোডাক্ট ← → টাকা */
  #tab-dashboard .recent-table td:nth-child(2) { grid-column: 1; grid-row: 1; }
  #tab-dashboard .recent-table td:nth-child(5) {
    grid-column: 2; grid-row: 1; justify-self: end;
    font-family: 'Baloo Da 2', 'Hind Siliguri', sans-serif;
    font-weight: 800; font-size: 15px; color: #1D4ED8; white-space: nowrap;
  }

  /* ২য় সারি: কাস্টমার ← → স্ট্যাটাস */
  #tab-dashboard .recent-table td:nth-child(3) {
    grid-column: 1; grid-row: 2;
    font-size: 12.5px; font-weight: 700; color: #475569;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #tab-dashboard .recent-table td:nth-child(6) { grid-column: 2; grid-row: 2; justify-self: end; }

  /* ৩য় সারি: অর্ডার আইডি ← → পরিমাণ */
  #tab-dashboard .recent-table td:nth-child(1) {
    grid-column: 1; grid-row: 3;
    font-size: 11px; font-weight: 700; color: #94A3B8;
  }
  #tab-dashboard .recent-table td:nth-child(4) {
    grid-column: 2; grid-row: 3; justify-self: end;
    font-size: 11px; font-weight: 700; color: #94A3B8;
  }
  #tab-dashboard .recent-table td:nth-child(4):not(:empty)::before { content: 'পরিমাণ × '; }

  #tab-dashboard .recent-table .recent-prod {
    gap: 9px;
    font-weight: 700; font-size: 13.5px; color: #1F2937;
  }
  #tab-dashboard .recent-table .recent-prod .ic {
    width: 32px !important; height: 32px !important;
    border-radius: 10px; font-size: 16px !important;
  }
  #tab-dashboard .recent-table .status {
    font-size: 10.5px !important; padding: 4px 10px !important; white-space: nowrap;
  }

  /* অর্ডার না থাকলে খালি বার্তাটা পুরো প্রস্থ জুড়ে থাকবে */
  #tab-dashboard .recent-table td.empty-hint {
    grid-column: 1 / -1; grid-row: 1;
    text-align: center; padding: 14px 6px !important;
  }
}
/* Dashboard reference-style polish for mobile; additive only. */
@media(max-width:900px){
  #tab-dashboard .welcome-banner{background:linear-gradient(120deg,#fff 0%,#fbfdff 68%,#f3f6ff 100%);border-color:#e4eaf4;box-shadow:0 3px 12px rgba(15,23,42,.035)}
  #tab-dashboard .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  #tab-dashboard .grid-2{grid-template-columns:minmax(0,1fr)!important;gap:12px}
  #tab-dashboard .dash-card{margin-bottom:12px}
  #tab-dashboard .table-responsive{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}


/* ============================================================
   [v9.2] মোবাইল টপ হেডার — বড় লোগো, #FEFEFF ব্যাকগ্রাউন্ড, সুন্দর লুক
   (#bpMobileHeader দিয়ে স্পেসিফিসিটি বাড়ানো, তাই অন্য CSS ফাইল এটাকে ওভাররাইড করবে না)
   ============================================================ */
@media (max-width: 900px) {
  #bpMobileHeader.bp-mheader-v2 {
    display: flex; flex-direction: column; align-items: stretch; gap: 10px;
    background: #FEFEFF;
    padding: calc(10px + env(safe-area-inset-top)) 14px 12px;
    border-bottom: 1px solid #EEF1F7;
    box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
  }
  #bpMobileHeader .bp-mh-row1 {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
  }
  #bpMobileHeader .bp-mh-brand {
    display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0;
  }

  /* লোগো: বড়, ব্যাকগ্রাউন্ড হেডারের/ড্যাশবোর্ডের সাথে হুবহু এক (কোনো বক্স, শ্যাডো বা বর্ডার নেই) */
  #bpMobileHeader .bp-mh-logo-box {
    flex: none; width: 58px; height: 58px;
    padding: 0; margin: 0;
    background: #FEFEFF !important;
    border: 0 !important; border-radius: 0; box-shadow: none !important;
    overflow: visible;
    display: flex; align-items: center; justify-content: center;
  }
  #bpMobileHeader .bp-mh-logo-box img {
    width: 100%; height: 100%; display: block;
    object-fit: contain; border-radius: 0; background: transparent;
    mix-blend-mode: multiply; /* ছবির সাদা ব্যাকগ্রাউন্ড মিলিয়ে যায় */
  }

  #bpMobileHeader .bp-mh-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
  #bpMobileHeader .bp-mh-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
  #bpMobileHeader .bp-mh-name {
    flex: none; /* সংকুচিত হয়ে কাটা পড়বে না */
    font-family: 'Baloo Da 2', 'Hind Siliguri', sans-serif;
    font-weight: 800; font-size: 18px; line-height: 1.25; letter-spacing: 0;
    padding: 0 4px 2px 0; /* গ্রেডিয়েন্ট টেক্সটের শেষ অক্ষর কাটা যাওয়া ঠেকায় */
    background: linear-gradient(90deg, #1D4ED8, #7C3AED);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: #1D4ED8;
    overflow: visible;
  }
  #bpMobileHeader .bp-mh-live {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 10.5px; font-weight: 700; color: #059669; flex: none;
    background: #ECFDF5; border: 1px solid #A7F3D0;
    border-radius: 999px; padding: 1px 8px 1px 6px;
  }
  #bpMobileHeader .bp-mh-live i {
    width: 7px; height: 7px; border-radius: 50%; background: #10B981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, .2);
  }
  #bpMobileHeader .bp-mh-sub {
    margin: 0; font-size: 11.5px; font-weight: 600; color: #64748B;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* ডানের বাটনগুলো */
  #bpMobileHeader .bp-mh-actions { flex: none; display: flex; align-items: center; gap: 7px; }
  #bpMobileHeader .bp-mh-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: #FEFEFF; border: 1px solid #E6EAF3; color: #2563EB;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
  }
  #bpMobileHeader .bp-mh-icon-btn:active { background: #EEF2F9; transform: scale(.96); }
  #bpMobileHeader .bp-mh-icon-btn svg,
  #bpMobileHeader .bp-mh-logout svg {
    width: 19px; height: 19px; stroke: currentColor; fill: none;
    stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
  }
  #bpMobileHeader .bp-mh-avatar {
    width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
    font-weight: 800; font-size: 15px; color: #fff;
    background: linear-gradient(135deg, #1E293B, #334155);
    box-shadow: 0 4px 12px rgba(30, 41, 59, .3);
  }

  /* নিচের স্ট্রিপ: তারিখ / Dev / লগআউট */
  #bpMobileHeader .bp-mh-strip { display: flex; align-items: center; gap: 8px; }
  #bpMobileHeader .bp-mh-date,
  #bpMobileHeader .bp-mh-dev {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    font-size: 12.5px; font-weight: 700; border-radius: 12px; padding: 7px 11px;
  }
  #bpMobileHeader .bp-mh-date { background: #FEFEFF; border: 1px solid #E6EAF3; color: #334155; }
  #bpMobileHeader .bp-mh-dev { background: #ECFDF5; border: 1px solid #A7F3D0; color: #047857; }
  #bpMobileHeader .bp-mh-dev i { width: 7px; height: 7px; border-radius: 50%; background: #10B981; }
  #bpMobileHeader .bp-mh-logout {
    margin-left: auto; width: 40px; height: 34px; border-radius: 12px; cursor: pointer;
    background: #FFF1F2; border: 1px solid #FECDD3; color: #E11D48;
    display: flex; align-items: center; justify-content: center;
  }
}

@media (max-width: 380px) {
  #bpMobileHeader .bp-mh-logo-box { width: 50px; height: 50px; border-radius: 14px; }
  #bpMobileHeader .bp-mh-name { font-size: 16.5px; }
  #bpMobileHeader .bp-mh-icon-btn, #bpMobileHeader .bp-mh-avatar { width: 36px; height: 36px; }
  #bpMobileHeader .bp-mh-actions { gap: 5px; }
  #bpMobileHeader .bp-mh-date, #bpMobileHeader .bp-mh-dev { font-size: 11.5px; padding: 6px 9px; }
}
