/* ============================================================
   LapFlow — Bootstrap 5 Integrated Design System
   ============================================================ */
:root {
  --navy:        #0d1b2a;
  --navy-2:      #1b2e45;
  --amber:       #f59e0b;
  --amber-dark:  #d97706;
  --teal:        #14b8a6;
  --red:         #ef4444;
  --green:       #22c55e;
  --sidebar-w:   240px;
  --topbar-h:    60px;
  --font-head:   'Inter', sans-serif;
  --font-body:   'Inter', sans-serif;
  --card-radius: 12px;
  --tr:          0.2s ease;
}

/* ── Reset & Base ──────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background: #f0f4f8;
  color: #1e293b;
  min-height: 100vh;
}

/* ── Layout ────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-width: 0;
  transition: margin-left var(--tr);
}
.page-body { padding: 24px 28px 48px; }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 1040;
  overflow-y: auto; overflow-x: hidden;
  transition: transform var(--tr), width var(--tr);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px 16px;
  color: var(--amber);
  font-family: var(--font-head); font-size: 1.35rem; font-weight: 800;
  border-bottom: 1px solid rgba(255,255,255,.07);
  white-space: nowrap; flex-shrink: 0;
}
.sidebar-brand i { font-size: 1.55rem; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section {
  font-size: .62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px;
  color: rgba(255,255,255,.28);
  padding: 14px 20px 5px;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 20px;
  color: rgba(255,255,255,.62);
  text-decoration: none; font-size: .87rem; font-weight: 500;
  transition: all var(--tr);
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 18px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.sidebar-nav .nav-link.active {
  color: var(--amber);
  background: rgba(245,158,11,.1);
  border-left-color: var(--amber);
}
.sidebar-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; overflow: hidden; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--amber); color: var(--navy);
  font-family: var(--font-head); font-weight: 800; font-size: .9rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name  { font-size: .82rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: .68rem; color: rgba(255,255,255,.38); }
.btn-logout { color: rgba(255,255,255,.38); font-size: 1.1rem; text-decoration: none; padding: 4px 6px; border-radius: 6px; transition: color var(--tr); }
.btn-logout:hover { color: var(--red); }

/* Overlay (mobile) */
#sidebarOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1035;
  backdrop-filter: blur(2px);
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: #fff; border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  z-index: 1030;
  transition: left var(--tr);
}
.sidebar-toggle {
  background: none; border: none;
  font-size: 1.3rem; color: #64748b;
  cursor: pointer; padding: 5px 7px; border-radius: 7px; line-height: 1;
  flex-shrink: 0;
  display: none;
}
.sidebar-toggle:hover { background: #f1f5f9; color: var(--navy); }
.topbar-title {
  font-family: var(--font-head); font-weight: 700;
  font-size: 1.05rem; color: var(--navy); flex: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.btn-avatar {
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--navy); color: var(--amber);
  font-family: var(--font-head); font-weight: 800; font-size: .88rem;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--card-radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.card-bordered {
  border-color: #94a3b8;
  box-shadow: 0 18px 45px rgba(15,23,42,.12);
}
.card.table-card {
  border: 2px solid #94a3b8 !important;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(15,23,42,.16);
}
.table-card {
  overflow: hidden;
}
.table-card .table-wrapper {
  padding: 22px;
  border-top: none;
}
.table-card .lf-table {
  border-radius: 0 0 16px 16px;
}
.card-header-custom {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.card-title-custom {
  font-family: var(--font-head); font-weight: 700;
  font-size: .98rem; color: var(--navy);
}

/* ── Stat Cards  */
.stat-card {
  background: #fff; border-radius: var(--card-radius);
  padding: 16px 18px; border: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 12px;
  transition: box-shadow var(--tr), transform var(--tr);
  height: 100%; min-height: 80px; box-sizing: border-box;
  overflow: hidden; word-break: break-word;
}
.stat-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.stat-icon.amber { background: rgba(245,158,11,.12); color: var(--amber); }
.stat-icon.teal  { background: rgba(20,184,166,.12);  color: var(--teal); }
.stat-icon.navy  { background: rgba(13,27,42,.08);    color: var(--navy); }
.stat-icon.green { background: rgba(34,197,94,.12);   color: var(--green); }
.stat-icon.red   { background: rgba(239,68,68,.12);   color: var(--red); }
.stat-label { font-size: .7rem; color: #64748b; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-family: var(--font-head); font-size: 1.55rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
/* Responsive stat cards */
@media (max-width: 479.98px) {
  .stat-card { padding: 12px 11px; gap: 9px; min-height: 70px; }
  .stat-icon  { width: 38px; height: 38px; font-size: 1.05rem; border-radius: 9px; }
  .stat-value { font-size: 1.15rem; }
  .stat-label { font-size: .63rem; }
}

/* ── Badges ────────────────────────────────────────────────── */
.badge-status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-inrepair   { background: #dbeafe; color: #1e40af; }
.badge-completed  { background: #d1fae5; color: #065f46; }
.badge-delivered  { background: #f3f4f6; color: #374151; }
.badge-paid       { background: #d1fae5; color: #065f46; }
.badge-unpaid     { background: #fee2e2; color: #991b1b; }
.badge-partial    { background: #fef3c7; color: #92400e; }
.badge-active     { background: #d1fae5; color: #065f46; }
.badge-inactive   { background: #f3f4f6; color: #6b7280; }
.badge-urgent     { background: #fee2e2; color: #991b1b; }
.badge-high       { background: #fef3c7; color: #92400e; }
.badge-normal     { background: #dbeafe; color: #1e40af; }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lf-table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 600px; }
.lf-table thead th {
  background: #f8fafc; color: #475569;
  font-weight: 700; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .6px;
  padding: 11px 14px; border-bottom: 2px solid #e2e8f0;
  border-right: 1px solid #e2e8f0; white-space: nowrap;
}
.lf-table thead th:last-child { border-right: none; }
.lf-table tbody td { padding: 11px 14px; border-bottom: 1px solid #f1f5f9; border-right: 1px solid #f1f5f9; color: #374151; vertical-align: middle; }
.lf-table tbody td:last-child { border-right: none; }
.lf-table tbody tr:hover { background: #fafcff; }
.lf-table tbody tr:last-child td { border-bottom: none; }

/* ── Forms ─────────────────────────────────────────────────── */
.lf-form-label { font-size: .8rem; font-weight: 600; color: #374151; margin-bottom: 5px; display: block; }
.lf-form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-family: var(--font-body); font-size: .875rem; color: #1e293b;
  background: #fff;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.lf-form-control:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}
.lf-form-control::placeholder { color: #94a3b8; }
textarea.lf-form-control { resize: vertical; }
select.lf-form-control { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-lf {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-family: var(--font-body); font-size: .84rem; font-weight: 600;
  cursor: pointer; border: none;
  transition: all var(--tr); text-decoration: none;
  white-space: nowrap; vertical-align: middle;
}
.btn-lf-primary  { background: var(--amber); color: var(--navy); }
.btn-lf-primary:hover  { background: var(--amber-dark); color: var(--navy); }
.btn-lf-secondary{ background: #f1f5f9; color: #374151; border: 1px solid #e2e8f0; }
.btn-lf-secondary:hover{ background: #e2e8f0; color: #1e293b; }
.btn-lf-danger   { background: var(--red); color: #fff; }
.btn-lf-danger:hover   { background: #dc2626; color: #fff; }
.btn-lf-navy     { background: var(--navy); color: #fff; }
.btn-lf-navy:hover     { background: var(--navy-2); color: #fff; }
.btn-lf-success  { background: var(--green); color: #fff; }
.btn-lf-success:hover  { background: #16a34a; color: #fff; }
.btn-lf-sm  { padding: 5px 11px; font-size: .77rem; }
.btn-lf-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; }

/* ── Page Border Utility ───────────────────────────────────── */
.page-border {
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.05);
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 22px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-family: var(--font-head); font-size: 1.4rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.page-header .breadcrumb { font-size: .76rem; color: #94a3b8; margin-top: 3px; background: none; padding: 0; }

/* ── Alerts ────────────────────────────────────────────────── */
.lf-alert {
  padding: 11px 15px; border-radius: 8px; font-size: .84rem;
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.lf-alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.lf-alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.lf-alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.lf-alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Login ─────────────────────────────────────────────────── */
.login-page { min-height: 100vh; background: var(--navy); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand .logo-icon { width: 56px; height: 56px; background: var(--navy); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; color: var(--amber); font-size: 1.6rem; margin-bottom: 12px; }
.login-brand h1 { font-family: var(--font-head); font-size: 1.8rem; font-weight: 800; color: var(--navy); }
.login-brand p  { font-size: .82rem; color: #64748b; margin-top: 4px; }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: #94a3b8; }
.empty-state i  { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.empty-state p  { font-size: .87rem; }

/* ── Stock / Movement Types ─────────────────────────────────── */
.mv-in   { background: #dcfce7; color: #15803d; padding: 2px 9px; border-radius: 6px; font-size: .71rem; font-weight: 700; }
.mv-out  { background: #fee2e2; color: #b91c1c; padding: 2px 9px; border-radius: 6px; font-size: .71rem; font-weight: 700; }
.mv-adj  { background: #fef3c7; color: #92400e; padding: 2px 9px; border-radius: 6px; font-size: .71rem; font-weight: 700; }
.mv-init { background: #f1f5f9; color: #475569; padding: 2px 9px; border-radius: 6px; font-size: .71rem; font-weight: 700; }
.type-card { transition: border-color .18s, background .18s; }
.type-card:hover { border-color: #94a3b8 !important; }
.sk-line { height: 14px; background: linear-gradient(90deg,#f1f5f9 25%,#e2e8f0 50%,#f1f5f9 75%); background-size: 200% 100%; border-radius: 6px; animation: sk-shimmer 1.4s infinite; }
@keyframes sk-shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }
.lf-swal-toast { font-family: var(--font-body) !important; font-size: .87rem !important; }

/* ── Utility ───────────────────────────────────────────────── */
.text-amber { color: var(--amber); }
.text-navy  { color: var(--navy); }
.fw-head    { font-family: var(--font-head); font-weight: 800; }

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .page-header .btn-lf, #sidebarOverlay { display: none !important; }
  .main-content { margin-left: 0 !important; padding-top: 0 !important; }
  .page-body { padding: 0 !important; }
}

/* ── RESPONSIVE ────────────────────────────────────────────── */

/* Large tablets & below */
@media (max-width: 991.98px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.25); }
  #sidebarOverlay.show { display: block; }
  .main-content { margin-left: 0; }
  .topbar { left: 0; }
  .sidebar-toggle { display: inline-flex; }
}

/* Phones */
@media (max-width: 575.98px) {
  .page-body { padding: 14px 14px 36px; }
  .page-header h1 { font-size: 1.15rem; }
  .stat-value { font-size: 1.25rem; }
  .topbar { padding: 0 14px; }
  .topbar-title { font-size: .92rem; }
  .lf-table { font-size: .78rem; }
  .lf-table thead th { padding: 9px 10px; font-size: .65rem; }
  .lf-table tbody td { padding: 9px 10px; }
  .btn-lf { padding: 7px 12px; font-size: .8rem; }
  .btn-lf-sm { padding: 4px 9px; font-size: .73rem; }
  .card-header-custom { padding: 13px 15px 11px; }
}

/* Dashboard stat grid responsive */
@media (max-width: 767.98px) {
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-header > div:last-child { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
}

/* ── Welcome Banner (Ocean Gradient) ─────────────────────────── */
.lf-welcome-banner {
  background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 35%, #0891b2 65%, #06b6d4 100%);
  border-radius: 16px;
  padding: 28px 32px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(6, 182, 212, 0.25), 0 2px 8px rgba(12, 74, 110, 0.3);
  position: relative;
  overflow: hidden;
}
.lf-welcome-banner::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
  pointer-events: none;
}
.lf-welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 30%;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}
.lf-welcome-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: relative;
  z-index: 1;
}
.lf-welcome-greeting {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}
.lf-welcome-sub {
  font-size: .9rem;
  opacity: .82;
  font-weight: 400;
}
.lf-welcome-meta {
  text-align: right;
  flex-shrink: 0;
}
.lf-welcome-date {
  font-size: .82rem;
  opacity: .75;
  font-weight: 500;
  margin-bottom: 4px;
}
.lf-welcome-today {
  font-size: .88rem;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 4px 12px;
  backdrop-filter: blur(4px);
}
@media (max-width: 575.98px) {
  .lf-welcome-banner  { padding: 20px 18px; }
  .lf-welcome-inner   { flex-direction: column; align-items: flex-start; }
  .lf-welcome-meta    { text-align: left; }
  .lf-welcome-greeting{ font-size: 1.15rem; }
}

/* ── Pagination ──────────────────────────────────────────── */
ul.lf-pagination,
nav ul.lf-pagination {
  list-style: none !important;
  display: flex !important;
  gap: 4px;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: wrap;
}
ul.lf-pagination li,
nav ul.lf-pagination li {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
ul.lf-pagination li::before,
nav ul.lf-pagination li::before {
  content: none !important;
}
ul.lf-pagination li a,
nav ul.lf-pagination li a {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  text-decoration: none !important;
  transition: all .15s;
  line-height: 1;
}
ul.lf-pagination li a:hover,
nav ul.lf-pagination li a:hover {
  background: var(--amber);
  color: #fff !important;
  border-color: var(--amber);
}
ul.lf-pagination li.active a,
nav ul.lf-pagination li.active a {
  background: var(--navy);
  color: #fff !important;
  border-color: var(--navy);
  cursor: default;
}
ul.lf-pagination li.disabled a,
nav ul.lf-pagination li.disabled a {
  color: #cbd5e1 !important;
  background: #f8fafc;
  border-color: #e2e8f0;
  cursor: not-allowed;
  pointer-events: none;
}
