/* assets/css/app.css */
/* ─────────────────────────────────────────────────────────────────────── */

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

:root {
  --bg: #0a0b0f; --surface: #13151c; --surface2: #1c1f2a; --surface3: #242836;
  --border: #2a2e3d; --border2: #363b50;
  --text: #e8eaf2; --text2: #8b90a8; --text3: #565b74;
  --accent: #6c63ff; --accent2: #8b85ff; --accent-soft: rgba(108,99,255,.12);
  --green: #22d3a0; --green-soft: rgba(34,211,160,.12);
  --red: #ff5b7a;   --red-soft: rgba(255,91,122,.12);
  --orange: #ff9d3d; --orange-soft: rgba(255,157,61,.12);
  --yellow: #ffd060;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,.4); --shadow-lg: 0 8px 48px rgba(0,0,0,.6);
}

body { background:var(--bg); color:var(--text); font-family:'DM Sans',sans-serif; font-size:14px; line-height:1.5; overflow:hidden; }
h1,h2,h3,h4,h5 { font-family:'Syne',sans-serif; font-weight:700; }

/* ── APP SHELL ── */
.app { display:flex; height:100vh; width:100vw; }

/* ── SIDEBAR ── */
.sidebar { width:240px; min-width:240px; background:var(--surface); border-right:1px solid var(--border); display:flex; flex-direction:column; transition:width .3s; overflow:hidden; z-index:100; }
.sidebar.collapsed { width:64px; min-width:64px; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .logo-text, .sidebar.collapsed .nav-badge, .sidebar.collapsed .user-info, .sidebar.collapsed .nav-section-label { display:none; }

.sidebar-logo { padding:16px; display:flex; align-items:center; gap:10px; border-bottom:1px solid var(--border); min-height:64px; }
.logo-icon { width:36px; height:36px; background:var(--accent); border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:18px; flex-shrink:0; box-shadow:0 0 20px rgba(108,99,255,.4); }
.logo-text { font-family:'Syne',sans-serif; font-size:15px; font-weight:800; color:var(--text); white-space:nowrap; }
.logo-text span { color:var(--accent2); }

.sidebar-nav { flex:1; padding:12px 8px; display:flex; flex-direction:column; gap:2px; overflow-y:auto; overflow-x:hidden; }
.nav-section-label { font-family:'Syne',sans-serif; font-size:10px; font-weight:600; letter-spacing:.12em; color:var(--text3); padding:8px 8px 4px; text-transform:uppercase; white-space:nowrap; }
.nav-item { display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:var(--radius-sm); cursor:pointer; transition:all .2s; color:var(--text2); white-space:nowrap; font-size:13.5px; font-weight:500; }
.nav-item:hover { background:var(--surface2); color:var(--text); }
.nav-item.active { background:var(--accent-soft); color:var(--accent2); }
.nav-icon { font-size:17px; flex-shrink:0; width:20px; text-align:center; }
.nav-badge { margin-left:auto; background:var(--red); color:#fff; border-radius:20px; font-size:10px; font-weight:700; padding:1px 6px; flex-shrink:0; }

.sidebar-footer { padding:12px 8px; border-top:1px solid var(--border); display:flex; align-items:center; gap:10px; cursor:pointer; border-radius:var(--radius-sm); margin:8px; transition:background .2s; }
.sidebar-footer:hover { background:var(--surface2); }
.avatar { width:32px; height:32px; border-radius:50%; background:linear-gradient(135deg,var(--accent),var(--green)); display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700; flex-shrink:0; color:#fff; }
.user-name { font-size:13px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role { font-size:11px; color:var(--text3); }

/* ── MAIN ── */
.main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.topbar { height:64px; border-bottom:1px solid var(--border); display:flex; align-items:center; padding:0 24px; gap:16px; background:var(--surface); }
.topbar-title { font-family:'Syne',sans-serif; font-size:18px; font-weight:700; flex:1; }
.topbar-subtitle { font-size:12px; color:var(--text3); font-weight:400; font-family:'DM Sans'; margin-top:1px; }
.content { flex:1; overflow-y:auto; padding:24px; }

/* ── CARDS ── */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; transition:border-color .2s; }
.card:hover { border-color:var(--border2); }

.stat-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:20px; display:flex; flex-direction:column; gap:12px; position:relative; overflow:hidden; }
.stat-card::before { content:''; position:absolute; top:0; left:0; right:0; height:2px; }
.stat-card.accent::before { background:linear-gradient(90deg,var(--accent),var(--accent2)); }
.stat-card.green::before  { background:linear-gradient(90deg,var(--green),#1aff9c); }
.stat-card.red::before    { background:linear-gradient(90deg,var(--red),#ff8fa3); }
.stat-card.orange::before { background:linear-gradient(90deg,var(--orange),#ffc46b); }
.stat-label { font-size:12px; color:var(--text2); font-weight:500; letter-spacing:.03em; }
.stat-value { font-family:'Syne',sans-serif; font-size:28px; font-weight:800; color:var(--text); line-height:1; }
.stat-sub   { font-size:11px; color:var(--text3); }
.stat-icon  { position:absolute; right:16px; top:16px; font-size:32px; opacity:.15; }

/* ── BUTTONS ── */
.btn { display:inline-flex; align-items:center; gap:6px; padding:8px 16px; border-radius:var(--radius-sm); font-family:'DM Sans'; font-size:13px; font-weight:600; cursor:pointer; border:none; transition:all .2s; white-space:nowrap; }
.btn:disabled { opacity:.6; cursor:not-allowed; }
.btn-primary   { background:var(--accent); color:#fff; }
.btn-primary:hover:not(:disabled) { background:var(--accent2); box-shadow:0 0 20px rgba(108,99,255,.4); }
.btn-secondary { background:var(--surface2); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:var(--surface3); border-color:var(--border2); }
.btn-danger    { background:var(--red-soft); color:var(--red); border:1px solid rgba(255,91,122,.25); }
.btn-danger:hover { background:var(--red); color:#fff; }
.btn-ghost     { background:transparent; color:var(--text2); padding:6px 10px; }
.btn-ghost:hover { background:var(--surface2); color:var(--text); }
.btn-sm   { padding:5px 10px; font-size:12px; }
.btn-icon { padding:7px; }

/* ── FORMS ── */
.form-group  { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.form-label  { font-size:12px; font-weight:600; color:var(--text2); letter-spacing:.04em; }
.form-input, .form-select, .form-textarea { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); color:var(--text); font-family:'DM Sans'; font-size:13.5px; padding:9px 12px; outline:none; transition:border-color .2s,box-shadow .2s; width:100%; }
.form-input:focus,.form-select:focus,.form-textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.form-input::placeholder,.form-textarea::placeholder { color:var(--text3); }
.form-select option { background:var(--surface2); }
.form-textarea { resize:vertical; min-height:80px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }

/* ── TABLE ── */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { text-align:left; font-size:11px; font-weight:600; letter-spacing:.08em; color:var(--text3); text-transform:uppercase; padding:10px 12px; border-bottom:1px solid var(--border); }
td { padding:12px; border-bottom:1px solid var(--border); color:var(--text); font-size:13.5px; vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--surface2); }

/* ── BADGES ── */
.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:20px; font-size:11px; font-weight:600; }
.badge-green  { background:var(--green-soft);  color:var(--green); }
.badge-red    { background:var(--red-soft);    color:var(--red); }
.badge-orange { background:var(--orange-soft); color:var(--orange); }
.badge-accent { background:var(--accent-soft); color:var(--accent2); }
.badge-gray   { background:var(--surface3);    color:var(--text2); }

/* ── MODAL ── */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.7); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; z-index:1000; animation:fadeIn .2s ease; }
.modal { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; width:90%; max-width:560px; max-height:90vh; overflow-y:auto; box-shadow:var(--shadow-lg); animation:slideUp .25s ease; }
.modal-wide { max-width:680px; }
.modal-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; }
.modal-title { font-family:'Syne',sans-serif; font-size:17px; font-weight:700; }
.modal-close { background:var(--surface2); border:none; color:var(--text2); width:30px; height:30px; border-radius:8px; cursor:pointer; font-size:16px; display:flex; align-items:center; justify-content:center; transition:all .2s; }
.modal-close:hover { background:var(--surface3); color:var(--text); }

@keyframes fadeIn  { from { opacity:0 } to { opacity:1 } }
@keyframes slideUp { from { transform:translateY(16px); opacity:0 } to { transform:translateY(0); opacity:1 } }

/* ── TOAST ── */
.toast { background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 16px; font-size:13.5px; font-weight:500; color:var(--text); box-shadow:var(--shadow); opacity:0; transform:translateX(20px); transition:all .35s; pointer-events:none; }
.toast.show { opacity:1; transform:translateX(0); }
.toast-err { border-color:rgba(255,91,122,.4); background:var(--red-soft); color:var(--red); }

/* ── MISC ── */
.toolbar { display:flex; gap:10px; align-items:center; margin-bottom:20px; flex-wrap:wrap; }
.toolbar-right { margin-left:auto; display:flex; gap:10px; }
.search-bar { position:relative; }
.search-bar input { padding-left:36px; }
.search-icon { position:absolute; left:10px; top:50%; transform:translateY(-50%); color:var(--text3); pointer-events:none; }
.section-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.section-title { font-family:'Syne',sans-serif; font-size:15px; font-weight:700; }
.two-col  { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.grid-3   { display:grid; grid-template-columns:repeat(3,1fr); gap:16px; }
.product-img { width:40px; height:40px; border-radius:8px; background:var(--surface3); display:flex; align-items:center; justify-content:center; font-size:20px; flex-shrink:0; }
.cat-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.stock-bar-wrap { display:flex; align-items:center; gap:8px; min-width:100px; }
.stock-bar-bg   { flex:1; height:4px; background:var(--surface3); border-radius:2px; overflow:hidden; }
.stock-bar-fill { height:100%; border-radius:2px; transition:width .4s; }
.chart-bar-wrap { display:flex; align-items:flex-end; gap:8px; height:120px; padding:8px 0; }
.alert-item { display:flex; align-items:center; gap:12px; padding:12px; background:var(--surface2); border:1px solid var(--border); border-radius:var(--radius-sm); border-left:3px solid var(--orange); }
.activity-item { display:flex; align-items:flex-start; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.activity-item:last-child { border-bottom:none; }
.activity-dot  { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.activity-text { font-size:13px; color:var(--text); }
.activity-time { font-size:11px; color:var(--text3); }
.empty-state { text-align:center; padding:48px 24px; color:var(--text3); }
.empty-icon  { font-size:48px; margin-bottom:12px; opacity:.5; }
.empty-text  { font-size:14px; margin-bottom:6px; color:var(--text2); }
.qr-container { display:flex; flex-direction:column; align-items:center; gap:16px; }
.qr-box { width:200px; height:200px; background:#fff; border-radius:12px; display:flex; align-items:center; justify-content:center; padding:12px; }

/* ── LOGIN ── */
#login-screen { min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--bg); position:relative; overflow:hidden; }
.login-bg  { position:absolute; inset:0; pointer-events:none; overflow:hidden; }
.login-orb { position:absolute; border-radius:50%; filter:blur(80px); opacity:.15; }
.login-card { background:var(--surface); border:1px solid var(--border); border-radius:20px; padding:40px; width:380px; box-shadow:var(--shadow-lg); position:relative; z-index:1; }
.login-logo { display:flex; align-items:center; gap:12px; margin-bottom:32px; }
.login-title { font-family:'Syne',sans-serif; font-size:22px; font-weight:800; color:var(--text); }
.login-error { background:var(--red-soft); border:1px solid rgba(255,91,122,.3); border-radius:var(--radius-sm); padding:10px 12px; font-size:13px; color:var(--red); margin-bottom:16px; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border2); border-radius:3px; }
::-webkit-scrollbar-thumb:hover { background:var(--text3); }

/* ── RESPONSIVE ── */
@media (max-width:1100px) { .stat-grid { grid-template-columns:repeat(2,1fr); } }
@media (max-width:900px)  { .two-col,.grid-3 { grid-template-columns:1fr; } }
@media (max-width:640px)  { .form-row { grid-template-columns:1fr; } .content { padding:16px; } }
