/* PC4MATIC POS — Main Stylesheet */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4f7ef8;
  --primary-dark: #3b65d4;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --white: #ffffff;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}

body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--dark); background: var(--bg); line-height: 1.6; }

/* ─── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-w);
  height: 100vh; background: #1e2533; overflow-y: auto;
  display: flex; flex-direction: column; z-index: 200;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; }
.brand-icon { width: 40px; height: 40px; background: var(--primary); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.brand-text strong { display: block; color: #fff; font-size: 14px; }
.brand-text span { color: rgba(255,255,255,.45); font-size: 11px; }

.nav-menu { list-style: none; padding: 10px 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: rgba(255,255,255,.7);
  text-decoration: none; border-radius: 0;
  transition: background .15s, color .15s; font-size: 13.5px;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { border-left: 3px solid var(--primary); }
.nav-link svg { flex-shrink: 0; opacity: .75; }
.nav-link:hover svg, .nav-link.active svg { opacity: 1; }
.nav-link.pos-link { background: rgba(79,126,248,.2); color: #93b4fd; font-weight: 600; }
.nav-link.pos-link svg { opacity: 1; }
.nav-link.pos-link:hover { background: rgba(79,126,248,.35); }

/* Sub menus */
.has-sub .sub-menu { list-style: none; display: none; }
.has-sub.open .sub-menu { display: block; }
.has-sub > .nav-parent svg:last-child { margin-left: auto; transition: transform .2s; }
.has-sub.open > .nav-parent svg:last-child { transform: rotate(90deg); }
.sub-menu a { display: block; padding: 7px 16px 7px 44px; color: rgba(255,255,255,.55); font-size: 13px; text-decoration: none; transition: color .15s; }
.sub-menu a:hover { color: #fff; }

/* Sidebar footer */
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); margin-top: auto; }
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; color: rgba(255,255,255,.5);
  text-decoration: none; border-radius: 8px; font-size: 13px;
  transition: background .15s, color .15s;
}
.sidebar-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-logout svg { flex-shrink: 0; }

/* ─── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; position: sticky; top: 0; z-index: 100;
}
.sidebar-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; }
.topbar-title { font-weight: 600; font-size: 16px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-menu { position: relative; }
.user-avatar { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; cursor: pointer; }
.user-dropdown {
  display: none; position: absolute; right: 0; top: 44px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 0;
  min-width: 160px; box-shadow: var(--shadow);
}
.user-menu:hover .user-dropdown { display: block; }
.user-dropdown span { display: block; padding: 6px 16px; font-size: 13px; font-weight: 600; color: var(--dark); }
.user-dropdown a { display: block; padding: 8px 16px; color: var(--muted); text-decoration: none; font-size: 13px; }
.user-dropdown a:hover { background: var(--bg); color: var(--dark); }

.main-content { flex: 1; padding: 20px; }

/* ─── ALERTS ───────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ─── CARDS ────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ─── STAT CARDS ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon { font-size: 24px; }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--muted); }
.stat-card.blue   { border-left: 4px solid var(--primary); }
.stat-card.green  { border-left: 4px solid var(--success); }
.stat-card.red    { border-left: 4px solid var(--danger); }
.stat-card.orange { border-left: 4px solid var(--warning); }
.stat-card.purple { border-left: 4px solid #8b5cf6; }

/* ─── TABLES ───────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { padding: 10px 14px; text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #f9fafb; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f9fafb; }
.table tfoot th, .table tfoot td { font-weight: 700; background: #f3f4f6; border-top: 2px solid var(--border); }
.row-danger { background: #fef2f2 !important; }
.row-warning { background: #fffbf0 !important; }

/* ─── BADGES ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--white);
  color: var(--dark); transition: background .15s, border .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: #f3f4f6; border-color: #e5e7eb; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ─── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--white); color: var(--dark);
  transition: border .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.form-actions { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; }

/* ─── PAGE LAYOUT HELPERS ──────────────────────────────────── */
.page-actions { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btns { display: flex; gap: 8px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-danger { color: var(--danger); }
.muted { color: var(--muted); }
.actions { white-space: nowrap; }

/* ─── PAGINATION ───────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; padding: 12px 16px; }
.pagination a { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; color: var(--dark); font-size: 13px; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── AUTH ─────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e2533 0%, #2d3748 100%); }
.auth-container { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: var(--white); border-radius: 16px; padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.auth-header p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--muted); }

/* ─── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, .page-actions, .form-actions, .btn, .action-btns { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
}

/* ─── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ─── INSTALLER ────────────────────────────────────────────── */
.install-wrap { max-width: 640px; margin: 40px auto; padding: 20px; }
.install-card { background: var(--white); border-radius: 16px; padding: 36px; box-shadow: var(--shadow); }
.install-header { text-align: center; margin-bottom: 28px; }
.install-logo { font-size: 32px; font-weight: 800; color: var(--primary); }
.step-list { display: flex; gap: 0; margin-bottom: 28px; }
.step-item { flex: 1; text-align: center; padding: 8px; font-size: 12px; border-bottom: 3px solid var(--border); }
.step-item.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
.step-item.done { border-bottom-color: var(--success); color: var(--success); }
