@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --accent: #38BDF8;
  --login-bg: #EFF6FF;
  --dashboard-bg: #F8FAFC;
  --surface: #FFFFFF;
  --sidebar-bg: #FFFFFF;
  --sidebar-text: #475569;
  --sidebar-hover: #F1F5F9;
  --sidebar-active-bg: #DBEAFE;
  --sidebar-active-text: #2563EB;
  --header-bg: #FFFFFF;
  --heading: #172554;
  --text: #475569;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #F43F5E;
  --info: #2563EB;
}

body {
  font-family: 'Nunito', -webkit-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--dashboard-bg);
  margin: 0;
  color: var(--text);
}

/* FIX RUANG ADMIN LAYOUT */
#wrapper {
  display: flex;
}
#wrapper #content-wrapper {
  width: auto !important;
  min-width: 0;
  margin-left: 14rem;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--dashboard-bg) !important;
  transition: margin-left .3s ease;
}
#wrapper #content-wrapper #content {
  flex: 1 0 auto;
}
.sticky-footer {
  margin-top: auto;
}

/* SIDEBAR */
.sidebar {
  background-color: var(--sidebar-bg) !important;
  position: fixed !important;
  top: 0;
  left: 0;
  bottom: 0;
  width: 14rem;
  overflow-y: auto;
  z-index: 1040;
  border-right: 1px solid var(--border);
  transition: width .3s ease;
}
.sidebar .sidebar-brand {
  background-color: var(--sidebar-bg) !important;
  border-bottom: 1px solid var(--border);
}
.sidebar .nav-item .nav-link {
  color: var(--sidebar-text) !important;
}
.sidebar .nav-item .nav-link i {
  color: var(--text-muted) !important;
}
.sidebar .nav-item .nav-link:hover {
  color: var(--sidebar-active-text) !important;
  background-color: var(--sidebar-hover) !important;
}
.sidebar .nav-item.active .nav-link {
  color: var(--sidebar-active-text) !important;
  background-color: var(--sidebar-active-bg) !important;
  font-weight: 700;
  border-left: 4px solid var(--sidebar-active-text);
}
.sidebar .nav-item.active .nav-link i {
  color: var(--sidebar-active-text) !important;
}
.sidebar .sidebar-heading {
  color: var(--text-muted) !important;
}
.sidebar hr.sidebar-divider {
  border-top: 1px solid var(--border);
}
.sidebar .version {
  color: var(--text-muted);
}
.sidebar-light .nav-item .nav-link { color: var(--sidebar-text) !important; }
.sidebar-light .nav-item .nav-link i { color: var(--text-muted) !important; }
.sidebar-light .nav-item .nav-link:active,
.sidebar-light .nav-item .nav-link:focus,
.sidebar-light .nav-item .nav-link:hover { color: var(--sidebar-active-text) !important; background-color: var(--sidebar-hover) !important; }
.sidebar-light .nav-item.active .nav-link { color: var(--sidebar-active-text) !important; background-color: var(--sidebar-active-bg) !important; }
.sidebar-light .nav-item.active .nav-link i { color: var(--sidebar-active-text) !important; }
.sidebar-light #sidebarToggle { background-color: var(--border); }
.sidebar-light #sidebarToggle::after { color: var(--text-muted); }

/* DESKTOP SIDEBAR COLLAPSED */
@media (min-width: 768px) {
  .sidebar.toggled {
    width: 5rem !important;
    overflow: hidden;
  }
  #wrapper.sidebar-collapsed #content-wrapper {
    margin-left: 5rem;
  }
  .sidebar.toggled .sidebar-brand-text,
  .sidebar.toggled .nav-link span,
  .sidebar.toggled .sidebar-heading,
  .sidebar.toggled .version {
    display: none;
  }
  .sidebar.toggled .nav-link {
    text-align: center;
    padding: .6rem 0;
  }
  .sidebar.toggled .nav-link i {
    margin: 0;
    font-size: 1.1rem;
  }
  .sidebar.toggled .sidebar-brand {
    justify-content: center;
  }
  .sidebar.toggled .sidebar-brand-icon {
    margin: 0 !important;
  }
  .sidebar.toggled .nav-item.active .nav-link {
    border-left: none;
    border-bottom: 3px solid var(--sidebar-active-text);
  }
}

/* TOPBAR */
.bg-navbar {
  background-color: var(--header-bg) !important;
  border-bottom: 1px solid var(--border);
}
#wrapper #content-wrapper {
  overflow-x: visible !important;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  width: 100%;
}
.topbar .page-title,
.topbar h5 {
  color: var(--heading) !important;
}
.topbar .nav-link .text-white,
.topbar .nav-link .badge-light {
  color: var(--heading) !important;
  background-color: transparent !important;
}
.topbar #sidebarToggleTop i {
  color: var(--heading) !important;
}

/* CARDS */
.stat-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
  border-left: 4px solid var(--primary);
}

/* Dashboard clickable cards */
.row .card[style*="cursor:pointer"]:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--heading); }
.stat-card .stat-label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.stat-card i { font-size: 1.8rem; opacity: .8; }

.card { border: 1px solid var(--border); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); font-weight: 600; color: var(--heading); }
.table thead th { background: #EFF6FF; color: var(--heading); font-size: .8rem; text-transform: uppercase; border-bottom: none; }
.badge-low { background: #FFF1F2; color: #F43F5E; }

.btn-brand { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-brand:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

/* LOGIN PAGE */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #DBEAFE 0%, #EFF6FF 50%, #F0F9FF 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 100%;
  max-width: 800px;
  display: flex;
  border-radius: 0;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3), 0 8px 30px rgba(37, 99, 235, 0.15);
}
.login-brand {
  width: 35%;
  background: linear-gradient(135deg, #2563EB, #38BDF8);
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}
.login-brand img {
  width: 100%;
  max-width: 200px;
  margin-bottom: 15px;
}
.login-brand h4 {
  font-weight: 700;
  margin-bottom: 10px;
  color: #fff;
}
.login-form {
  width: 65%;
  background: var(--surface);
  padding: 40px;
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}
.login-form .form-control {
  border: 2px solid var(--border);
  border-radius: 0;
  padding: 12px 15px;
  color: var(--heading);
}
.login-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(37,99,235,.25);
}
.login-form .btn-brand {
  width: 100%;
  padding: 12px;
  font-size: 16px;
  background: linear-gradient(135deg, #2563EB, #38BDF8);
  border: none;
}
.login-form .btn-brand:hover {
  background: linear-gradient(135deg, #1D4ED8, #0EA5E9);
}
.login-form label {
  color: var(--heading);
  font-size: 15px;
  font-weight: 700;
}
.login-form h5 {
  font-size: 22px;
  font-weight: 800;
}
.login-form .input-group-text {
  background: var(--dashboard-bg);
  border-color: var(--border);
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .login-card { flex-direction: column; max-width: 95%; }
  .login-brand { width: 100%; padding: 25px 20px; }
  .login-form { width: 100%; padding: 25px; }
  .login-brand img { max-width: 150px; }
}

/* POS SCREEN */
.pos-grid { display: grid; grid-template-columns: 1fr 380px; gap: 18px; align-items: start; }
.product-tile {
  background: var(--surface);
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all .15s;
  text-align: center;
  height: 100%;
}
.product-tile:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,.12); transform: translateY(-2px); }
.product-tile .p-name { font-weight: 600; font-size: .85rem; margin: 6px 0 2px; color: var(--heading); }
.product-tile .p-price { color: var(--primary); font-weight: 700; font-size: .9rem; }
.product-tile .p-stock { font-size: .72rem; color: var(--text-muted); }
.product-icon-box {
  width: 100%; height: 64px;
  background: #EFF6FF;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--primary);
}

.cart-panel { background: var(--surface); border-radius: 12px; padding: 16px; position: sticky; top: 80px; box-shadow: 0 2px 8px rgba(0,0,0,.04); border: 1px solid var(--border); }
.cart-items { max-height: 320px; overflow-y: auto; }
.cart-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.cart-item .ci-name { font-size: .85rem; font-weight: 600; flex: 1; }
.cart-item .ci-price { font-size: .75rem; color: var(--text-muted); }
.qty-input { width: 46px; text-align: center; }

@media (max-width: 991px) {
  .pos-grid { grid-template-columns: 1fr; }
}

/* RESPONSIVE SIDEBAR */
@media (max-width: 767px) {
  .sidebar {
    width: 0 !important;
    overflow: hidden;
    transition: all .3s ease;
  }
  .sidebar.toggled {
    width: 14rem !important;
    position: fixed;
    z-index: 1040;
    top: 0;
    left: 0;
    min-height: 100vh;
  }
  #wrapper #content-wrapper {
    margin-left: 0 !important;
  }
  .topbar {
    left: 0;
  }
  .sidebar .sidebar-brand,
  .sidebar .nav-item,
  .sidebar .sidebar-heading,
  .sidebar hr.sidebar-divider,
  .sidebar .version {
    overflow: visible;
  }
  .sidebar .sidebar-brand .sidebar-brand-text,
  .sidebar .nav-item .nav-link span {
    display: inline;
  }
  .sidebar .sidebar-brand .sidebar-brand-icon i {
    font-size: 1.35rem;
  }
}

/* ===== FULL RESPONSIVE ===== */

/* Sidebar overlay on mobile only */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 1039;
}
@media (min-width: 768px) {
  .sidebar-overlay { display: none !important; }
}
@media (max-width: 767px) {
  .sidebar-overlay.active {
    display: block;
  }
}

/* --- Topbar --- */
@media (max-width: 575px) {
  .topbar h5 { font-size: .95rem !important; }
  .topbar .ml-auto { margin-left: 0 !important; }
  #globalSearch { width: 180px !important; }
  .topbar .small { display: none !important; }
  .topbar .badge { font-size: .6rem; }
}

/* --- Stat Cards --- */
@media (max-width: 1199px) {
  .row .col-xl-3 { flex: 0 0 50%; max-width: 50%; }
}
@media (max-width: 767px) {
  .row .col-xl-3,
  .row .col-md-6 { flex: 0 0 100%; max-width: 100%; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .stat-card i { font-size: 1.4rem; }
}

/* --- Charts --- */
@media (max-width: 991px) {
  .chart-area, .chart-pie { height: 250px !important; }
}
@media (max-width: 575px) {
  .chart-area, .chart-pie { height: 200px !important; }
}

/* --- Tables --- */
@media (max-width: 767px) {
  .table-responsive { font-size: .8rem; }
  .table thead th { font-size: .7rem; padding: 6px 4px; }
  .table td { padding: 6px 4px; font-size: .8rem; }
}

/* --- Page Headings --- */
@media (max-width: 575px) {
  .d-sm-flex { display: block !important; }
  .d-sm-flex .breadcrumb { margin-top: 8px; }
  h4.mb-0 { font-size: 1.1rem; }
}

/* --- POS Grid --- */
@media (max-width: 991px) {
  .pos-grid { grid-template-columns: 1fr; }
  .cart-panel { position: static; }
}

/* --- Login extra small --- */
@media (max-width: 374px) {
  .login-brand { padding: 20px 15px; }
  .login-brand img { max-width: 120px; }
  .login-form { padding: 20px 15px; }
  .login-form .form-control { padding: 10px 12px; font-size: .9rem; }
  .login-form .btn-brand { padding: 10px; font-size: 14px; }
  .login-brand h4 { font-size: 1rem; }
  .login-brand p { font-size: .75rem; }
}

/* --- Footer --- */
@media (max-width: 575px) {
  .sticky-footer .copyright { font-size: .75rem; }
  .sticky-footer .copyright a { font-size: .75rem; }
}

/* --- Dashboard columns --- */
@media (max-width: 991px) {
  .col-lg-8, .col-lg-4, .col-lg-5, .col-lg-7 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* --- Cart items mobile --- */
@media (max-width: 575px) {
  .cart-items { max-height: 250px; }
  .cart-panel { padding: 12px; }
  .pos-grid { gap: 12px; }
  .product-tile { padding: 8px; }
  .product-icon-box { height: 50px; font-size: 1.2rem; }
}

/* ============================================================
   TYPOGRAPHY SYSTEM — NUNITO (global)
   ============================================================ */

/* 1. Global font family */
html,
body,
input,
select,
textarea,
button,
table,
.modal,
.dropdown-menu,
.tooltip {
    font-family: 'Nunito', sans-serif !important;
}

/* 2. Line heights */
body { line-height: 1.5 !important; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { line-height: 1.25; }
.btn, .form-control, .custom-select { line-height: 1.2 !important; }

/* 3. Base body text — Regular 400 */
body { font-size: 15px; font-weight: 400; }

/* 4. Helper / descriptions / muted — 14px Regular */
small, .small, .text-muted { font-size: 14px !important; font-weight: 400; }

/* 5. Main page headings (30px / ExtraBold) */
.d-sm-flex h4.mb-0.text-gray-800,
.topbar h5 {
    font-size: 30px;
    font-weight: 800;
    color: var(--heading);
}

/* 6. Section & card headings (22px / Bold) */
.card-header h6,
.modal-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--heading);
}

/* 7. Sidebar links (16px / SemiBold) */
.sidebar .nav-link span { font-size: 16px; font-weight: 600; }
.sidebar-brand-text { font-size: 18px; font-weight: 800; }
.sidebar .sidebar-heading { font-size: 12px; font-weight: 700; }

/* 8. Form labels (15px / SemiBold), values & placeholders (16px / Regular) */
label { font-size: 15px; font-weight: 600; }
input.form-control, select.form-control, textarea.form-control,
.custom-select, input[type="number"], input[type="text"], input[type="date"],
input[type="email"], input[type="password"] {
    font-size: 16px;
    font-weight: 400;
}
::placeholder { font-weight: 400; opacity: .75; }

/* 9. Tables — headings Bold 14px, content Regular 15px */
.table thead th {
    font-size: 14px !important;
    font-weight: 700 !important;
}
.table td {
    font-size: 15px;
    font-weight: 400;
}

/* 10. Buttons (16px / Bold) + compact variants */
.btn { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.btn-sm { font-size: 14px; font-weight: 700; }
.btn-xs { font-size: 12px; font-weight: 700; }

/* 11. Dashboard KPI values (28px / ExtraBold) */
.stat-card .stat-value,
.card-body .h5.mb-0.font-weight-bold,
.card-body .h4.mb-0.font-weight-bold {
    font-size: 28px !important;
    font-weight: 800 !important;
}

/* 12. Prices and important statistics (18px / Bold) */
.p-price,
.cart-total-row strong,
.receipt-total {
    font-size: 18px;
    font-weight: 700;
}

/* 13. Product names (16px / SemiBold) */
.product-tile .p-name,
.cart-item .ci-name { font-size: 16px; font-weight: 600; }

/* 14. Navigation, dropdowns, badges hierarchy */
.navbar-nav .nav-link, .dropdown-item { font-weight: 600; }
.badge { font-weight: 700; }
.breadcrumb { font-size: 14px; font-weight: 400; }

/* 15. Alerts & validation messages */
.alert { font-size: 15px; font-weight: 400; }
.invalid-feedback, .valid-feedback { font-size: 14px; font-weight: 400; }

/* ---------- MOBILE GUARDS: keep compact, no overflow ---------- */
@media (max-width: 767px) {
    body { font-size: 14px; }
    .table-responsive { font-size: .8rem; }
    .table thead th { font-size: .7rem !important; padding: 6px 4px; }
    .table td { font-size: .8rem; padding: 6px 4px; }
    small, .small, .text-muted { font-size: 13px !important; }
    .btn { font-size: 14px; }
    .btn-sm { font-size: 13px; }
    label { font-size: 14px; }
    input.form-control, select.form-control, textarea.form-control, .custom-select { font-size: 15px; }
    .card-header h6, .modal-title { font-size: 17px; }
    .product-tile .p-name, .cart-item .ci-name { font-size: 14px; }
    .p-price, .cart-total-row strong, .receipt-total { font-size: 16px; }
}
@media (max-width: 575px) {
    .d-sm-flex h4.mb-0.text-gray-800 { font-size: 20px; }
    .stat-card .stat-value,
    .card-body .h5.mb-0.font-weight-bold,
    .card-body .h4.mb-0.font-weight-bold { font-size: 20px !important; }
}

/* ---------- PRINT: receipts & reports stay compact ---------- */
@media print {
    body { font-size: 13px; line-height: 1.4 !important; }
    .table td { font-size: 12px; }
    .table thead th { font-size: 12px !important; }
    .btn, .print-btn { display: none !important; }
}

/* ============================================================
   TOPBAR USER CHIP — icon + role (professional)
   ============================================================ */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 14px 3px 5px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: var(--surface);
  transition: all .15s ease;
}
.user-chip:hover {
  border-color: var(--primary);
  background: #EFF6FF;
}
.user-chip i {
  font-size: 28px;
  line-height: 1;
  color: var(--primary);
}
.user-chip .role-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.2;
  white-space: nowrap;
}
.dropdown-menu .dropdown-header { text-transform: none; }
@media (max-width: 575px) {
  .user-chip { padding: 2px 10px 2px 4px; gap: 6px; }
  .user-chip i { font-size: 24px; }
  .user-chip .role-label { font-size: 12px; }
}
