/* ================================================================
   StockMaster Pro — UI V2 "WOW" (Glass SaaS)
   - Layout: sidebar + topbar + page shell
   - Design system: spacing, glass layers, buttons, cards, tables, forms
   - View switches: grid/list/compact (CSS-driven, no JS logic changes)
   - Density toggle: comfortable/compact (tables/cards)
   - Micro-interactions: subtle but premium
   NOTE: UI-only overrides (no business logic).
   ================================================================ */

:root{
  --bg-0:#061018;
  --bg-1:#071826;
  --bg-grad-1: rgba(0, 220, 255, .14);
  --bg-grad-2: rgba(0, 255, 170, .10);

  --glass-bg: rgba(255,255,255,.10);
  --glass-bg-2: rgba(255,255,255,.07);
  --glass-stroke: rgba(255,255,255,.16);
  --glass-stroke-2: rgba(255,255,255,.10);

  --text-0: rgba(255,255,255,.92);
  --text-1: rgba(255,255,255,.78);
  --text-2: rgba(255,255,255,.60);

  --accent: #00C2FF;
  --accent-2:#00FFB2;
  --danger:#ff3b5c;
  --warn:#ffb020;
  --ok:#1ee6a1;

  --shadow-0: 0 10px 35px rgba(0,0,0,.25);
  --shadow-1: 0 20px 60px rgba(0,0,0,.30);
  --glow-a: 0 0 0 1px rgba(0,194,255,.25), 0 0 30px rgba(0,194,255,.16);
  --glow-b: 0 0 0 1px rgba(0,255,178,.20), 0 0 30px rgba(0,255,178,.12);

  --r-1: 14px;
  --r-2: 18px;
  --r-3: 22px;

  --s-1: 8px;
  --s-2: 12px;
  --s-3: 16px;
  --s-4: 20px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 40px;

  --t-fast: .18s;
  --t: .22s;
  --t-slow: .34s;
}

html, body{ background: radial-gradient(1200px 900px at 20% 10%, var(--bg-grad-1), transparent 55%),
                         radial-gradient(900px 700px at 80% 20%, var(--bg-grad-2), transparent 55%),
                         linear-gradient(180deg, var(--bg-1), var(--bg-0));
            color: var(--text-0); }

/* soft noise overlay (subtle) */
body::before{
  content:"";
  position: fixed; inset:0;
  pointer-events:none;
  opacity:.05;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ================================================================
   NEW APP SHELL
   ================================================================ */
.sm-app{
  display:grid;
  grid-template-columns: 276px 1fr;
  min-height:100vh;
}

.sm-sidebar{
  position: sticky;
  top:0;
  height:100vh;
  padding: var(--s-4);
  background: rgba(255,255,255,.06);
  border-right: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sm-sidebar .brand{
  display:flex; align-items:center; gap:10px;
  padding: 12px 14px;
  border-radius: var(--r-2);
  background: rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow-0), var(--glow-a);
}

.sm-sidebar .brand .logo{
  width:34px; height:34px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(0,194,255,.9), rgba(0,255,178,.65));
  box-shadow: 0 10px 24px rgba(0,194,255,.14);
}

.sm-sidebar .brand .meta{
  line-height:1.1;
}
.sm-sidebar .brand .meta .name{ font-weight:800; letter-spacing:.2px; }
.sm-sidebar .brand .meta .sub{ font-size:.78rem; color:var(--text-2); }

.sm-nav{
  margin-top: var(--s-4);
  display:flex; flex-direction:column;
  gap: 6px;
  overflow:auto;
  max-height: calc(100vh - 150px);
  padding-right: 6px;
}

.sm-nav a{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text-1);
  text-decoration:none;
  border:1px solid transparent;
  transition: transform var(--t) ease, background var(--t) ease, border-color var(--t) ease, box-shadow var(--t) ease;
}

.sm-nav a .ico{
  width:32px; height:32px;
  border-radius: 12px;
  display:grid; place-items:center;
  background: rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.10);
}

.sm-nav a:hover{
  transform: translateY(-1px);
  background: rgba(255,255,255,.08);
  border-color: rgba(0,194,255,.25);
  box-shadow: var(--glow-a);
}
.sm-nav a.active{
  color: var(--text-0);
  background: linear-gradient(135deg, rgba(0,194,255,.14), rgba(0,255,178,.10));
  border-color: rgba(0,194,255,.32);
  box-shadow: var(--shadow-0), var(--glow-a);
}

.sm-main{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.sm-topbar{
  position: sticky;
  top:0;
  z-index: 40;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 12px 18px;
  margin: 14px 14px 0 14px;
  border-radius: var(--r-3);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow-0), var(--glow-a);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sm-topbar .left{ display:flex; align-items:center; gap:10px; min-width:0; }
.sm-topbar .right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }

.sm-topbar .page-title{
  font-weight: 900;
  letter-spacing: .2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sm-chip{
  display:inline-flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.10);
  color: var(--text-1);
  font-size: .86rem;
}

.sm-btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color: var(--text-0);
  text-decoration:none;
  cursor:pointer;
  transition: transform var(--t) ease, box-shadow var(--t) ease, background var(--t) ease, border-color var(--t) ease;
}
.sm-btn:hover{ transform: translateY(-1px); box-shadow: var(--shadow-0), var(--glow-a); border-color: rgba(0,194,255,.32); }
.sm-btn:active{ transform: translateY(0px) scale(.99); }

.sm-btn.primary{
  background: linear-gradient(135deg, rgba(0,194,255,.95), rgba(0,255,178,.70));
  border-color: rgba(0,255,178,.35);
  box-shadow: 0 18px 60px rgba(0,194,255,.18);
}
.sm-btn.primary:hover{ box-shadow: 0 18px 70px rgba(0,194,255,.22), var(--glow-b); }

.sm-toggle{
  display:inline-flex;
  border-radius: 999px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
}
.sm-toggle button{
  appearance:none;
  border:none;
  background: transparent;
  color: var(--text-1);
  padding: 9px 10px;
  cursor:pointer;
  transition: background var(--t) ease, color var(--t) ease, transform var(--t) ease;
}
.sm-toggle button:hover{ background: rgba(255,255,255,.06); color: var(--text-0); }
.sm-toggle button.active{
  background: linear-gradient(135deg, rgba(0,194,255,.30), rgba(0,255,178,.20));
  color: var(--text-0);
}

/* content spacing */
.sm-content{
  padding: 16px 14px 80px 14px;
  max-width: 1600px;
  width:100%;
  margin: 0 auto;
}

/* page sections */
.sm-section{
  background: rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.12);
  border-radius: var(--r-3);
  box-shadow: var(--shadow-0);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow:hidden;
}
.sm-section + .sm-section{ margin-top: var(--s-4); }

.sm-section-header{
  padding: 14px 16px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  background: linear-gradient(90deg, rgba(0,194,255,.14), rgba(0,255,178,.08));
  border-bottom:1px solid rgba(255,255,255,.12);
}
.sm-section-header .h{
  font-weight: 800;
}
.sm-section-body{ padding: 14px 16px; }

/* ================================================================
   DENSITY
   ================================================================ */
body.sm-compact .sm-section-body{ padding: 10px 12px; }
body.sm-compact .sm-topbar{ padding: 10px 14px; }
body.sm-compact .sm-btn{ padding: 8px 10px; border-radius: 12px; }

/* ================================================================
   TABLES
   ================================================================ */
.sm-table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow:hidden;
  border-radius: var(--r-2);
}
.sm-table thead th{
  position: sticky;
  top:0;
  z-index:1;
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(255,255,255,.10);
  color: var(--text-2);
  font-size:.72rem;
  letter-spacing:.08em;
  text-transform:uppercase;
  padding: 12px 10px;
}
.sm-table tbody td{
  padding: 12px 10px;
  border-bottom:1px solid rgba(255,255,255,.06);
}
.sm-table tbody tr:hover{
  background: rgba(255,255,255,.05);
}
body.sm-compact .sm-table thead th{ padding: 10px 8px; }
body.sm-compact .sm-table tbody td{ padding: 10px 8px; }

/* ================================================================
   FORMS
   ================================================================ */
.sm-field, .sm-input, .sm-select{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  color: var(--text-0);
  border-radius: 14px;
  padding: 10px 12px;
  transition: box-shadow var(--t) ease, border-color var(--t) ease, background var(--t) ease;
}
.sm-input:focus, .sm-select:focus{
  outline:none;
  border-color: rgba(0,194,255,.40);
  box-shadow: var(--glow-a);
  background: rgba(255,255,255,.08);
}

/* ================================================================
   VIEW SWITCHES
   ================================================================ */
.sm-view-target.view-grid{ display:grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.sm-view-target.view-list{ display:grid; gap: 12px; grid-template-columns: 1fr; }
.sm-view-target.view-compact{ display:grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.sm-view-target.view-list .prod-card{ display:flex; align-items:stretch; gap: 14px; }
.sm-view-target.view-list .prod-card .prod-photo{ width: 110px; min-height: 90px; }
.sm-view-target.view-list .prod-card .prod-main{ flex:1; }
.sm-view-target.view-list .prod-card .prod-footer{ justify-content:flex-end; }

.sm-view-target.view-compact .prod-card{
  padding: 10px 12px;
}
.sm-view-target.view-compact .prod-card .prod-title{ font-size: .95rem; }
.sm-view-target.view-compact .prod-card .prod-meta{ font-size: .78rem; }

/* When a page uses cards that aren't named prod-card, compact still helps spacing */
body.sm-compact .card, body.sm-compact .kpi-card{ border-radius: 16px; }

/* ================================================================
   MOBILE / TABLET
   - Sidebar collapses, keep existing bottom nav
   ================================================================ */
@media (max-width: 1100px){
  .sm-app{ grid-template-columns: 84px 1fr; }
  .sm-sidebar{ padding: 12px; }
  .sm-sidebar .brand .meta{ display:none; }
  .sm-nav a span.lbl{ display:none; }
}

@media (max-width: 860px){
  .sm-app{ grid-template-columns: 1fr; }
  .sm-sidebar{ display:none; }
  .sm-topbar{ margin: 10px 10px 0 10px; }
  .sm-content{ padding: 12px 10px 96px 10px; }
}

/* ================================================================
   WOW micro animation helper
   ================================================================ */
@keyframes smPulseGlow{
  0%{ box-shadow: 0 0 0 0 rgba(0,194,255,.0), 0 0 0 1px rgba(0,194,255,.18); }
  50%{ box-shadow: 0 0 40px rgba(0,194,255,.18), 0 0 0 1px rgba(0,255,178,.20); }
  100%{ box-shadow: 0 0 0 0 rgba(0,194,255,.0), 0 0 0 1px rgba(0,194,255,.18); }
}
.sm-glow-pulse{ animation: smPulseGlow 2.6s ease-in-out infinite; }

/* Movements compact view: hide low-priority columns */
[data-view-target].view-compact .mv-table .col-stock,
[data-view-target].view-compact .mv-table .col-note,
[data-view-target].view-compact .mv-table .col-reason{ display:none; }
