/* ============================================================
   BizDemo — Shared Styles
   Clean & minimal. Easy to customize per brand.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:    #1A1A1A;
  --accent2:   #4A90D9;
  --bg:        #F8F8F7;
  --surface:   #FFFFFF;
  --border:    #E8E8E5;
  --text:      #1A1A1A;
  --muted:     #6B6B68;
  --hint:      #ADADAA;
  --success:   #1D8A5E;
  --danger:    #C84B2F;
  --warn:      #9B6000;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  transition: all .15s; cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { opacity: .88; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { color: var(--danger); border-color: #f5cdc5; }
.btn.danger:hover { background: #fdf3f1; }
.btn.success { background: var(--success); color: #fff; border-color: var(--success); }
.btn.success:hover { opacity: .88; }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 500;
}
.badge.green  { background: #e8f5ec; color: #1a5c3a; }
.badge.red    { background: #fdf3f1; color: #a83d24; }
.badge.amber  { background: #fef8ec; color: #9b6000; }
.badge.blue   { background: #eef3fc; color: #1e4fa8; }
.badge.gray   { background: #f1f1ef; color: #6b6b68; }
.badge.purple { background: #f3eeff; color: #5b21b6; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 12px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px;
  background: var(--surface); color: var(--text);
  transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(74,144,217,.1);
}

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--muted); padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--border);
  letter-spacing: .04em; text-transform: uppercase;
}
td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafaf9; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; flex-direction: column;
  padding: 0 0 20px;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .brand-name {
  font-size: 17px; font-weight: 600; color: #fff;
  letter-spacing: -.02em;
}
.sidebar-brand .brand-sub {
  font-size: 11px; color: rgba(255,255,255,.4); margin-top: 2px;
}

.sidebar nav { flex: 1; padding: 10px 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; margin-bottom: 2px;
  font-size: 13px; font-weight: 500;
  color: rgba(255,255,255,.5);
  cursor: pointer; transition: all .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-item i { font-size: 16px; flex-shrink: 0; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-info {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; margin-bottom: 4px;
}
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.user-name { font-size: 12px; font-weight: 500; color: #fff; }
.user-email { font-size: 11px; color: rgba(255,255,255,.4); }

.main-content {
  flex: 1; padding: 28px 32px;
  overflow-x: hidden; min-width: 0;
}

/* ---- Pages ---- */
.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- Metrics ---- */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.metric-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.metric-label {
  font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
}
.metric-value { font-size: 22px; font-weight: 600; }

/* ---- Search bar ---- */
.search-wrap {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.search-wrap input {
  max-width: 260px; border: none; padding: 6px 0;
  background: transparent; outline: none; font-size: 13px;
}

/* ---- Modal ---- */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.35); z-index: 1000;
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  border: 1px solid var(--border); padding: 24px;
  width: 500px; max-width: 100%;
  box-shadow: var(--shadow-md);
  animation: fadeUp .2s ease;
}
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-footer {
  display: flex; justify-content: flex-end;
  gap: 8px; margin-top: 20px;
}

/* ---- POS ---- */
.pos-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; height: calc(100vh - 140px); }
.pos-items { overflow-y: auto; }
.pos-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.pos-item-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px;
  cursor: pointer; transition: all .15s; text-align: center;
}
.pos-item-card:hover { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(74,144,217,.1); }
.pos-item-card.out { opacity: .45; cursor: not-allowed; }
.pos-item-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.pos-item-price { font-size: 15px; font-weight: 600; color: var(--accent2); }
.pos-item-stock { font-size: 11px; color: var(--hint); margin-top: 2px; }

.pos-cart {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  overflow: hidden;
}
.pos-cart-header { padding: 16px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-name { flex: 1; font-weight: 500; }
.cart-qty {
  display: flex; align-items: center; gap: 6px;
}
.cart-qty button {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cart-item-price { font-weight: 500; min-width: 60px; text-align: right; }
.pos-cart-footer { padding: 16px; border-top: 1px solid var(--border); }
.pos-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 600; margin-bottom: 12px; }

/* ---- Utilities ---- */
.empty { text-align: center; color: var(--hint); padding: 48px 0; font-size: 13px; }
.text-red { color: var(--danger); }
.text-green { color: var(--success); }
.text-muted { color: var(--muted); }
.fw-500 { font-weight: 500; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-6 { gap: 6px; }
.mt-16 { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.fade-in { animation: fadeIn .25s ease; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ---- Login page ---- */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: var(--bg); padding: 16px;
}
.login-box {
  width: 100%; max-width: 400px;
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo .logo-icon {
  font-size: 36px; margin-bottom: 8px;
}
.login-logo h1 {
  font-size: 22px; font-weight: 600; letter-spacing: -.02em;
}
.login-logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.login-card { padding: 28px; }
.login-card h2 { font-size: 17px; font-weight: 600; margin-bottom: 20px; }
.login-error {
  background: #fdf3f1; color: var(--danger);
  border: 1px solid #f5cdc5; border-radius: 8px;
  padding: 8px 12px; font-size: 13px; margin-bottom: 14px;
  display: none;
}
.login-error.show { display: block; }
.login-footer {
  text-align: center; margin-top: 16px;
  font-size: 13px; color: var(--muted);
}
.login-footer a { color: var(--accent2); font-weight: 500; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -220px;
    top: 0;
    height: 100vh;
    z-index: 2000;
    transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1999;
  }
  .sidebar-overlay.open { display: block; }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--accent);
    color: #fff;
    padding: 10px 16px;
    height: 52px;
  }
  .mobile-header-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
  }
  .mobile-menu-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
  }

  .main-content { padding: 16px; }
  .pos-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* Mobile header hidden on desktop */
.mobile-header { display: none; }
