/* =====================================================================
   BORDER SATHI WEBSITE - COMMON LAYOUT (layout.css)
   Har logged-in page par includes/site_header.php isko sabse baad me
   load karta hai. Yahan se sab pages ka:
     - top header
     - sidebar + content ki chaudai / gap
     - background
     - page title bar (.topbar / .pv-header)
   ek jaisa hota hai. Badalna ho to sirf tokens badlein.
   ===================================================================== */
:root{
  --ly-max: 1320px;      /* poore layout ki max chaudai */
  --ly-side: 250px;      /* sidebar */
  --ly-gap: 24px;        /* sidebar aur content ke beech */
  --ly-top: 24px;        /* header ke neeche gap */
  --ly-bottom: 40px;
  --ly-card-gap: 20px;
  --ly-ink: #0f172a;
  --ly-muted: #64748b;
  --ly-line: #e2e8f0;
}

/* ---------- 1. Background: sab pages par ek (halka) ---------- */
html body{
  background:linear-gradient(180deg,#edf3ff 0%,#f8fafc 100%) fixed !important;
  color:var(--ly-ink);
  font-family:"Segoe UI",Inter,system-ui,-apple-system,Roboto,Arial,sans-serif;
  min-height:100vh;
}
html body::before,html body::after{display:none !important}
html body .app-shell{background:transparent !important;min-height:0}

/* ---------- 2. Top header ---------- */
.top-header{position:sticky;top:0;z-index:100;border-bottom:1px solid rgba(229,231,235,.7);background:rgba(255,255,255,.96);backdrop-filter:blur(16px);box-shadow:0 2px 12px rgba(15,23,42,.05)}
.top-header .header-inner{flex-wrap:nowrap;width:min(var(--ly-max),calc(100% - 40px));min-height:68px;margin:0 auto;display:flex;align-items:center;gap:24px}
.top-header .brand{display:flex;align-items:center;gap:10px;min-width:200px;color:inherit;text-decoration:none}
.top-header .brand-mark{width:40px;height:40px;display:flex;align-items:center;justify-content:center;border-radius:12px;background:linear-gradient(135deg,#0066ff,#0052cc);color:#fff;font-size:19px;font-weight:900;box-shadow:0 7px 17px rgba(0,102,255,.2)}
.top-header .brand-text strong,.top-header .brand-text small{display:block}
.top-header .brand-text strong{color:#111827;font-size:1.05rem;letter-spacing:-.2px;line-height:1.25}
.top-header .brand-text small{margin-top:2px;color:#6b7280;font-size:.72rem;letter-spacing:.3px;font-weight:600}
.top-header .main-nav{flex:1;display:flex;align-items:center;gap:4px}
.top-header .nav-link{padding:9px 12px;border-radius:8px;color:#6b7280;font-size:.9rem;font-weight:800;text-decoration:none;transition:.2s}
.top-header .nav-link:hover{color:#fff;background:linear-gradient(135deg,#16a34a 0%,#22c55e 45%,#84cc16 100%)}
.top-header .nav-link.active{color:#0066ff;background:#eff6ff;font-weight:900}
.top-header .header-actions{display:flex;align-items:center;gap:9px}
.top-header .notification-button{position:relative;width:36px;height:36px;border:1.5px solid #e5e7eb;border-radius:10px;background:#fff;cursor:pointer;padding:0}
.top-header .notification-button span{font-size:15px}
.top-header .notification-button b{position:absolute;top:-5px;right:-5px;min-width:16px;height:16px;padding:0 4px;display:flex;align-items:center;justify-content:center;border-radius:10px;background:#dc2626;color:#fff;font-size:9px;font-weight:800}
.top-header .notification-button b[hidden]{display:none}
.top-header .account-chip{display:flex;align-items:center;gap:7px;padding:4px 10px 4px 4px;border:1.5px solid #e5e7eb;border-radius:10px;background:#fff;color:inherit;text-decoration:none}
.top-header .account-avatar{width:29px;height:29px;display:flex;align-items:center;justify-content:center;border-radius:8px;background:#eff6ff;color:#0066ff;font-size:12px;font-weight:900}
.top-header .account-info strong{display:block;max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#111827;font-size:.85rem}
.top-header .logout-link{min-height:34px;padding:0 12px;display:inline-flex;align-items:center;justify-content:center;border:1.5px solid #fee2e2;border-radius:8px;background:#fff;color:#dc2626;font-size:12px;font-weight:700;text-decoration:none}
.top-header .logout-link:hover{background:#dc2626;color:#fff;border-color:#dc2626}

/* ---------- 3. Layout: sidebar + content ---------- */
html body :is(.dashboard-layout,.app-shell){
  width:min(var(--ly-max),calc(100% - 40px)) !important;
  max-width:none !important;
  margin:var(--ly-top) auto var(--ly-bottom) !important;
  padding:0 !important;
  display:grid !important;
  grid-template-columns:var(--ly-side) minmax(0,1fr) !important;
  gap:var(--ly-gap) !important;
  align-items:start !important;
}
html body .dashboard-sidebar{top:calc(68px + var(--ly-top)) !important;max-height:calc(100vh - 68px - 2 * var(--ly-top)) !important}

/* content column: pages ke apne width/margin/padding hata kar ek jaisa */
html body :is(.page-content,.page-container,.pv-page,.customer-chat-content){
  width:100% !important;max-width:none !important;min-width:0;margin:0 !important;padding:0 !important;
  min-height:0 !important;background:transparent !important;
}
html body :is(.page,.page-shell,.wrap,.contact-shell){
  width:100% !important;max-width:none !important;min-width:0;margin:0 !important;padding:0 !important;
  min-height:0 !important;background:transparent !important;
}
html body :is(.page,.page-shell,.wrap) > .content,
html body :is(.page,.page-shell) > main.content{padding:0 !important;margin:0 !important;max-width:none !important}
html body .pv-page::before,html body .pv-page::after{display:none}

/* ---------- 4. Page title bar: sab pages par ek jaisa card ---------- */
html body :is(.topbar,.pv-header){
  position:static !important;top:auto !important;
  height:auto !important;min-height:64px;margin:0 0 var(--ly-card-gap) !important;padding:12px 18px !important;
  display:flex !important;align-items:center;gap:14px;
  background:#fff !important;color:var(--ly-ink) !important;
  border:1px solid var(--ly-line) !important;border-radius:18px !important;
  box-shadow:0 8px 22px rgba(15,23,42,.05) !important;backdrop-filter:none !important;
}
html body :is(.topbar,.pv-header) :is(h1,h2,.brand-title,.page-title,.pv-title,.title,.brand-title-wrap strong){
  margin:0;color:var(--ly-ink) !important;font-size:20px !important;line-height:1.25;font-weight:800 !important;letter-spacing:0 !important;text-align:left;
}
html body :is(.topbar,.pv-header) :is(p,small,span.sub,.pv-subtitle,.brand-subtitle,.subtitle){color:var(--ly-muted) !important}
html body :is(.topbar,.pv-header) :is(.back-btn,.back,.pv-back){
  width:40px;height:40px;flex:0 0 40px;display:inline-grid !important;place-items:center;border-radius:12px;
  background:#f1f5f9 !important;color:#1e293b !important;font-size:22px !important;line-height:1;border:0;text-decoration:none;
}
html body :is(.topbar,.pv-header) :is(.profile-btn,.header-space){
  width:40px;height:40px;flex:0 0 40px;margin-left:auto;border-radius:12px !important;background:#eff6ff !important;color:#0066ff !important;font-size:20px !important;box-shadow:none !important;
}
html body .topbar > :is(.brand-title,.page-title,h1){flex:1 1 auto;min-width:0}
/* sticky bar ke liye bachi hui neeche ki jagah (mobile bottom-nav) ab nahi chahiye */
html body :is(.page,.page-shell){padding-bottom:0 !important}

/* ---------- 5. Cards ke beech ek jaisa gap ---------- */
html body :is(.page,.page-shell,.contact-shell,.wrap) > :is(section,.card,.panel,form,.hero-card){margin-bottom:var(--ly-card-gap)}

/* ---------- 6. Tablet / mobile ---------- */
@media (max-width:980px){
  html body :is(.dashboard-layout,.app-shell){width:calc(100% - 24px) !important;grid-template-columns:minmax(0,1fr) !important;gap:16px !important;margin-top:16px !important}
  .top-header .header-inner{width:calc(100% - 24px);gap:12px;min-height:60px}
  .top-header .main-nav{display:none}
  .top-header .brand{min-width:0;flex:1}
  .top-header .header-actions{display:none}  /* sidebar me Profile / Logout hai */
  html body .dashboard-sidebar{max-height:none !important}
  html body :is(.topbar,.pv-header){padding:10px 14px !important;min-height:56px}
  html body :is(.topbar,.pv-header) :is(h1,h2,.brand-title,.page-title,.pv-title){font-size:18px !important}
}
@media (max-width:520px){
  .top-header .brand-text small{display:none}
}

/* ---------- 7. Pehle dark background par bane elements: halke background par bhi padhne layak ---------- */
html body .profile-card{background:linear-gradient(135deg,#0d2d66,#1d4ed8) !important;color:#fff !important;border-color:transparent !important;backdrop-filter:none}
html body .profile-card *{color:inherit}
html body .logout{background:#fff1f2 !important;border:1px solid #fecdd3 !important;color:#be123c !important}
html body .help-banner{background:#eff6ff !important;border-color:#bfdbfe !important;color:#1e3a8a !important}
html body .help-banner > strong,html body .help-banner span strong{color:#1e3a8a !important}
html body .version{color:var(--ly-muted) !important}
html body :is(.pv-page,.page-content) > :is(h1,h2,p){color:var(--ly-ink)}
