/* ==================================================================
 * Pixellark Solutions – Sales Partner Portal UI
 * Theme: deep navy + royal blue, rounded surfaces (ref. System
 * Navigator look), mobile-first responsive with floating bottom nav.
 * ================================================================== */

:root {
  /* Brand palette */
  --navy-950: #081226;
  --navy-900: #0a1730;
  --navy-800: #0f2148;
  --navy-700: #143064;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-500: #3b82f6;
  --blue-050: #eaf1fe;

  /* Surfaces & text */
  --bg: #eef1f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #5d6b80;
  --border: #e4e9f1;

  /* Radii — "round edges everywhere" */
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow-card: 0 6px 24px rgba(10, 23, 48, .07);
  --shadow-pop:  0 18px 45px rgba(8, 18, 38, .22);

  /* Bootstrap 5.3 variable overrides — one place themes everything */
  --bs-body-bg: var(--bg);
  --bs-body-color: var(--text);
  --bs-border-color: var(--border);
  --bs-border-radius: 12px;
  --bs-border-radius-sm: var(--r-sm);
  --bs-border-radius-lg: 16px;
  --bs-border-radius-xl: var(--r-lg);
  --bs-link-color: var(--blue-600);
  --bs-link-hover-color: var(--blue-700);
  --bs-focus-ring-color: rgba(37, 99, 235, .22);
  --bs-body-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-size: .95rem;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -.015em; color: var(--text); }
a { color: var(--blue-600); }
:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ *
 * Navbar — deep navy bar, sticky; mobile menu becomes a floating
 * white rounded panel.
 * ------------------------------------------------------------------ */
.main-nav {
  background: linear-gradient(115deg, var(--navy-950) 0%, var(--navy-900) 45%, var(--navy-800) 100%);
  box-shadow: 0 2px 18px rgba(8, 18, 38, .28);
}
.main-nav .container { min-height: 60px; }
.brand-logo { height: 34px; width: auto; margin-right: .4rem; }
.brand-name { font-weight: 800; letter-spacing: .5px; font-size: 1.02rem; }
.brand-accent { color: #6ea8ff; }

.main-nav .nav-link {
  color: #c3cdea;
  font-weight: 600;
  font-size: .92rem;
  border-radius: 10px;
  padding: .5rem .8rem !important;
  transition: background .15s ease, color .15s ease;
}
.main-nav .nav-link .bi { margin-right: .35rem; }
.main-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.main-nav .nav-link.active { color: #fff; background: var(--blue-600); }
.main-nav .nav-link.active:hover { background: var(--blue-700); }

.navbar-toggler { border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px; padding: .35rem .6rem; }
.main-nav .btn { white-space: nowrap; }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(37, 99, 235, .45); }

/* Auth screens (not signed in): navy hero background like the theme */
body.auth-page {
  background:
    radial-gradient(1100px 480px at 50% -120px, rgba(37, 99, 235, .35), transparent 62%),
    linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 55%, var(--navy-800) 100%);
  background-attachment: fixed;
  min-height: 100dvh;
}
body.auth-page .site-footer .muted { color: rgba(195, 205, 234, .55); }
body.auth-page .site-footer { color: rgba(195, 205, 234, .55); }

/* ------------------------------------------------------------------ *
 * Cards & buttons — rounded everywhere
 * ------------------------------------------------------------------ */
.card {
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow .18s ease, transform .18s ease;
}
a.card.text-decoration-none:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(10, 23, 48, .13); }

.btn { border-radius: 12px; font-weight: 600; }
.btn-lg { border-radius: 14px; }
.btn-sm { border-radius: 10px; }
.btn-primary { background: var(--blue-600); border-color: var(--blue-600); }
.btn-primary:hover, .btn-primary:focus { background: var(--blue-700); border-color: var(--blue-700); }
.btn-teal {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  border: 0;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .30);
}
.btn-teal:hover, .btn-teal:focus { background: linear-gradient(135deg, var(--blue-700), var(--blue-600)); color: #fff; }
.btn-navy { background: var(--navy-900); border: 1px solid var(--navy-900); color: #fff; }
.btn-navy:hover, .btn-navy:focus { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-outline-secondary { border-color: #cbd5e1; color: #475569; }
.btn-outline-secondary:hover { background: #f1f5f9; border-color: #cbd5e1; color: #334155; }

/* Forms */
.form-control, .form-select { border-radius: 12px; padding: .55rem .85rem; border-color: #dbe2ec; }
.form-control:focus, .form-select:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(37, 99, 235, .15); }
.form-check-input { border-radius: 8px; }
.form-check-input:checked { background-color: var(--blue-600); border-color: var(--blue-600); }
textarea.form-control { border-radius: 14px; }

/* Tables */
.table > :not(caption) > * > * { padding: .8rem .7rem; }
.table thead th {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  background: #f7f9fc;
}
.table tbody td { border-color: #edf1f7; }

/* Badges — soft pills */
.badge { border-radius: 999px; padding: .42em .8em; font-size: .72rem; }
.badge-status-quoted      { background: var(--blue-050); color: var(--blue-700); }
.badge-status-invoiced    { background: #e7f8f1; color: #0a8a5f; }
.badge-status-cancelled   { background: #fdecec; color: #d03030; }
.badge-status-pending     { background: #fef4e0; color: #b45309; }
.badge-status-approved    { background: #e7f8f1; color: #0a8a5f; }
.badge-status-rejected    { background: #fdecec; color: #d03030; }
.badge-status-suspended   { background: #fdecec; color: #d03030; }
.badge-status-incomplete  { background: #eef1f6; color: #5d6b80; }
.badge-status-paid        { background: #e7f8f1; color: #0a8a5f; }
.badge-status-unpaid      { background: #fdecec; color: #d03030; }
.badge-status-partial     { background: #fef4e0; color: #b45309; }
.badge, .badge-status-quoted, .badge-status-invoiced, .badge-status-cancelled,
.badge-status-pending, .badge-status-approved, .badge-status-rejected,
.badge-status-suspended, .badge-status-incomplete, .badge-status-paid,
.badge-status-unpaid, .badge-status-partial { font-weight: 700; }

.alert { border-radius: 14px; border: 0; }
.alert-info { background: var(--blue-050); color: #1e40af; }
.alert-danger { background: #fdecec; color: #b91c1c; }
.alert-success { background: #e7f8f1; color: #06603f; }
.alert-warning { background: #fef4e0; color: #92400e; }

.muted { color: var(--muted); }

/* ------------------------------------------------------------------ *
 * Dashboard stat cards — soft blue icon tiles (theme style)
 * ------------------------------------------------------------------ */
.stat-value { font-size: 1.85rem; font-weight: 800; color: var(--navy-900); overflow-wrap: anywhere; }
.stat-card .muted { font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat-icon {
  font-size: 1.35rem;
  color: var(--blue-600);
  background: var(--blue-050);
  width: 46px; height: 46px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 14px;
  flex: 0 0 auto;
}

/* ------------------------------------------------------------------ *
 * Auth screens
 * ------------------------------------------------------------------ */
.auth-wrap { min-height: calc(100dvh - 170px); display: flex; align-items: center; justify-content: center; padding: 1.5rem 0 3rem; }
.auth-card { max-width: 460px; width: 100%; }
.auth-card .card { padding: 2.4rem 2.2rem; border-radius: 24px; box-shadow: var(--shadow-pop); }
.auth-logo { height: 74px; width: auto; }

/* Google sign-in button (rounded, matches the theme) */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .6rem;
  background: #fff; border: 1px solid #d7dce5; color: #1f2937;
  font-weight: 600; border-radius: 999px; padding: .68rem 1.25rem;
  transition: box-shadow .2s ease, transform .2s ease, background .2s ease;
}
.btn-google:hover, .btn-google:focus { background: #f8fafc; color: #111827; box-shadow: var(--shadow-pop); transform: translateY(-1px); }
.btn-google:active { transform: translateY(0); }
.divider-or { display: flex; align-items: center; gap: .9rem; color: var(--muted); font-size: .85rem; }
.divider-or::before, .divider-or::after { content: ""; flex: 1; height: 1px; background: #dbe1ea; border-radius: 1px; }

/* ------------------------------------------------------------------ *
 * Quotation builder
 * ------------------------------------------------------------------ */
.item-row {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: .75rem;
  margin-bottom: .65rem;
  background: #f8fafc;
}
.quote-summary { font-size: 1.05rem; border: 1px solid var(--border) !important; border-radius: 16px !important; background: #f8fafc !important; }
.quote-summary .grand { font-size: 1.35rem; font-weight: 800; color: var(--navy-900); }

/* Tiny labels shown above builder fields on phones only */
.m-label {
  display: none;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .15rem;
}

/* ------------------------------------------------------------------ *
 * Floating mobile bottom navigation (phones & tablets portrait)
 * ------------------------------------------------------------------ */
.mobile-nav {
  position: fixed;
  left: 10px; right: 10px; bottom: 8px;
  z-index: 1045;
  display: none;
  background: rgba(10, 23, 48, .96);
  border-radius: 20px;
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  color: #8fa0c4;
  text-decoration: none;
  font-size: .62rem;
  font-weight: 600;
  border-radius: 14px;
}
.mobile-nav a .bi { font-size: 1.25rem; line-height: 1; padding: 5px 13px; border-radius: 999px; transition: background .15s ease, color .15s ease; }
.mobile-nav a.active { color: #fff; }
.mobile-nav a.active .bi { background: var(--blue-600); color: #fff; }
.mobile-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 991.98px) {
  .mobile-nav { display: flex; }
  body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  /* Collapsed navbar becomes a white floating rounded panel */
  .navbar-collapse {
    background: #fff;
    border-radius: 18px;
    padding: .7rem;
    margin-top: .8rem;
    box-shadow: var(--shadow-pop);
  }
  .navbar-collapse .nav-link { color: var(--text) !important; }
  .navbar-collapse .nav-link:hover { background: var(--blue-050); color: var(--blue-600) !important; }
  .navbar-collapse .nav-link.active { background: var(--blue-600); color: #fff !important; }
  .navbar-collapse .d-flex { padding: .5rem .5rem .2rem; border-top: 1px solid var(--border); margin-top: .4rem; }
  .navbar-collapse .btn { flex: 1; }
  .navbar-collapse .btn-outline-light { color: var(--navy-900); border-color: #cbd5e1; }
  .navbar-collapse .btn-outline-light:hover { background: #f1f5f9; color: var(--navy-900); }
  .navbar-collapse .btn-light { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
}

/* Phones — compact rhythm, no iOS zoom, comfortable tap targets */
@media (max-width: 767.98px) {
  .m-label { display: block; }
  h2, .h2 { font-size: 1.35rem; }
  .card.p-4, form.card.p-4 { padding: 1.1rem !important; }
  .stat-card { padding: .8rem !important; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .stat-card .stat-value.fs-4 { font-size: 1.1rem !important; }
  .stat-icon { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 11px; }
  .table > :not(caption) > * > * { padding: .65rem .5rem; font-size: .88rem; }
  .auth-card .card { padding: 1.6rem 1.2rem; }
  .btn { min-height: 40px; }
  .btn-sm { min-height: 34px; }
  .item-row .btn-outline-danger { height: 38px; width: 100%; }
  .doc-body { padding: 1.1rem 1.2rem 1rem; }
  .doc-signature .sig-line { width: 170px; }
  .table-responsive { -webkit-overflow-scrolling: touch; }
}

/* ------------------------------------------------------------------ *
 * Printable letterhead documents (quotation / invoice)
 * ------------------------------------------------------------------ */
.doc-page {
  background: #fff;
  max-width: 860px;
  margin: 0 auto;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(10, 23, 48, .12);
}
.doc-body { padding: 1.6rem 3.2rem 1.4rem; }
.doc-head-img { width: 100%; display: block; }
.doc-foot-img { width: 100%; display: block; }
.doc-title-row { border-bottom: 3px solid var(--blue-600); margin-bottom: 1.2rem; }
.doc-title { color: var(--navy-900); font-weight: 800; letter-spacing: 1px; }
.doc-totals td, .doc-totals th { padding: .3rem .5rem; }
.doc-totals td:first-child { white-space: nowrap; }
.doc-signature { margin-top: 2.6rem; }
.doc-signature .sig-line { border-top: 1.5px solid #1b2733; width: 240px; display: inline-block; padding-top: .2rem; font-size: .85rem; }

.site-footer { background: transparent; padding: 1.4rem 0 2rem; }
.site-footer .muted { color: #7c8aa0; }

/* ------------------------------------------------------------------ *
 * Print — keep the letterhead layout pixel-exact
 * ------------------------------------------------------------------ */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff !important; padding-bottom: 0 !important; }
  .main-nav, .site-footer, .mobile-nav, .no-print, .alert, .btn { display: none !important; }
  main.container { padding: 0 !important; margin: 0 !important; max-width: 100% !important; width: 100% !important; }
  .doc-page {
    box-shadow: none !important;
    max-width: 100% !important;
    width: 210mm !important;
    min-height: 297mm;
    page-break-after: always;
    border-radius: 0 !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
  }
  .doc-body { padding: 1.2rem 14mm 1rem; }
  .card { box-shadow: none !important; border-radius: 0 !important; }
  .table-responsive { overflow: visible !important; }
  /* keep letterhead footer pinned to the bottom of the page */
  .doc-footer-slot { margin-top: auto; }
}
