/* ==========================================================================
   ສອງອ້າຍນ້ອງ — Unified Master Design System (Zero Frameworks)
   Consolidated Stylesheet: Core Tokens + Storefront + POS Glassmorphism
   ========================================================================== */

/* ==========================================================================
   ສອງອ້າຍນ້ອງ POS & Store — Native Enterprise Design System
   Pure Vanilla CSS (Zero Frameworks, Zero Vite Bundling)
   ========================================================================== */

@font-face {
  font-family: 'Phetsarath OT';
  src: url('/assets/fonts/PhetsarathOT.ttf') format('truetype'),
       url('/src/assets/fonts/PhetsarathOT.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Phetsarath OT';
  src: url('/assets/fonts/PhetsarathOT-Bold.ttf') format('truetype'),
       url('/src/assets/fonts/PhetsarathOT-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

:root {
  /* POS Dark Glassmorphism Tokens */
  --bg-main: #07090e;
  --bg-card: #0f121d;
  --bg-card-hover: #151a29;
  --gold-primary: #d4af37;
  --gold-dark: #b59228;
  --gold-glow: rgba(212, 175, 55, 0.15);
  --text-primary: #f0f3f8;
  --text-secondary: #8c97a8;
  --border-color: #1a1f30;
  --border-gold: rgba(212, 175, 55, 0.2);

  /* Online Shop Light Tokens */
  --shop-brand: #7c3aed;
  --shop-brand-lt: rgba(124, 58, 237, 0.1);
  --shop-bg: #faf8f5;
  --shop-card: #ffffff;
  --shop-text: #1a1a2e;
  --shop-muted: #6b7280;
  --shop-border: rgba(0, 0, 0, 0.08);

  /* Global Functional Tokens */
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --info: #2563eb;
  --font-lao: 'Phetsarath OT', sans-serif;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: var(--font-lao);
  background-color: var(--shop-bg);
  color: var(--shop-text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.pos-theme {
  background-color: var(--bg-main);
  color: var(--text-primary);
}

a {
  text-decoration: none;
  color: inherit;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  outline: none;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 99px;
}
body.pos-theme ::-webkit-scrollbar-thumb {
  background: var(--border-gold);
}

/* Utility Containers */
.container-full {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.center-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}


/* ==========================================================================
   SECTION 2: CUSTOMER ONLINE STOREFRONT STYLES
   ========================================================================== */

/* ==========================================================================
   ສອງອ້າຍນ້ອງ — Customer Online Storefront Styles
   Pure Vanilla CSS (Zero Frameworks)
   ========================================================================== */

.store-wrapper {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--shop-bg);
  padding-bottom: 90px;
  position: relative;
  box-sizing: border-box;
}

/* 1. Header */
.store-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid var(--shop-border);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.store-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.store-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--shop-brand);
  flex-shrink: 0;
}

.store-title {
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--shop-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.store-subtitle {
  font-size: 0.65rem;
  color: var(--shop-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2. Banner & Wheel Promo */
.store-promo-banner {
  margin: 12px 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #173F35 0%, #245849 100%);
  border: 1.5px solid #C6A66B;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(23, 63, 53, 0.2);
  cursor: pointer;
}

/* 3. Search and Categories */
.store-search-box {
  margin: 0 14px 12px;
  position: relative;
}

.store-search-input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border-radius: 20px;
  border: 1.5px solid var(--shop-border);
  background: #ffffff;
  font-size: 0.85rem;
}

.store-cat-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 14px 14px;
  scrollbar-width: none;
}
.store-cat-scroller::-webkit-scrollbar {
  display: none;
}

.store-cat-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--shop-border);
  background: #ffffff;
  color: var(--shop-muted);
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.store-cat-pill.active {
  background: var(--shop-brand);
  border-color: var(--shop-brand);
  color: #ffffff;
}

/* 4. Products Grid */
.store-products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 14px;
}

.store-product-card {
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--shop-border);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.store-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.store-product-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f3f4f6;
  position: relative;
  overflow: hidden;
}

.store-product-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-product-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.store-product-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--shop-text);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.store-product-price {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--shop-brand);
}

.store-product-stock {
  font-size: 0.72rem;
  color: var(--shop-muted);
  margin-top: 2px;
}

.store-add-btn {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  border: none;
  background: var(--shop-brand);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.2s;
}

.store-add-btn:active {
  opacity: 0.85;
}

/* 5. Bottom Navigation */
.store-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  background: #ffffff;
  border-top: 1px solid var(--shop-border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.store-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--shop-muted);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.store-nav-item.active {
  color: var(--shop-brand);
  font-weight: 800;
}

.store-nav-icon {
  font-size: 1.25rem;
}

.store-badge {
  position: absolute;
  top: -2px;
  right: -6px;
  background: #dc2626;
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  border: 1.5px solid #ffffff;
}


/* ==========================================================================
   SECTION 3: POS & BACK-OFFICE DARK GLASSMORPHISM STYLES
   ========================================================================== */

/* ==========================================================================
   ສອງອ້າຍນ້ອງ POS & Back-Office — Admin Design System (admin.css)
   Pure Vanilla CSS (Zero Frameworks)
   ========================================================================== */

.admin-layout {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-lao);
}

/* Sidebar */
.admin-sidebar {
  width: 240px;
  background: rgba(10, 13, 20, 0.95);
  border-right: 1px solid var(--border-gold);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
  transition: width 0.3s;
}

.admin-sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 16px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.admin-sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-primary);
  object-fit: cover;
}

.admin-sidebar-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--gold-primary);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.admin-nav-item:hover {
  background: rgba(212, 175, 55, 0.08);
  color: var(--text-primary);
  border-color: rgba(212, 175, 55, 0.15);
}

.admin-nav-item.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2) 0%, rgba(181, 146, 40, 0.1) 100%);
  color: var(--gold-primary);
  border-color: var(--border-gold);
  font-weight: 700;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

/* Top Header */
.admin-header {
  height: 60px;
  background: rgba(15, 18, 29, 0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-clock {
  font-size: 0.85rem;
  color: var(--gold-primary);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.admin-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(212, 175, 55, 0.1);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-gold);
  font-size: 0.82rem;
}

.admin-user-badge {
  background: var(--gold-primary);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
}

.admin-body {
  padding: 20px 24px;
  flex: 1;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.kpi-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold-primary);
}

/* Data Table */
.admin-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.admin-table-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.84rem;
}

.admin-table th {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-secondary);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.admin-table tr:hover td {
  background: rgba(212, 175, 55, 0.03);
}

/* Switches for Granular Permissions */
.perm-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}

.perm-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.perm-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .3s;
  border-radius: 20px;
}

.perm-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .perm-slider {
  background-color: #059669;
}

input:checked + .perm-slider:before {
  transform: translateX(18px);
}

/* ==========================================================================
   Responsive Standards (Mobile <= 768px, Tablet <= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .admin-sidebar {
    width: 200px;
    padding: 12px 8px;
  }
  .admin-body {
    padding: 16px;
  }
  .admin-header {
    padding: 0 16px;
  }
}

@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
    min-width: 0;
    width: 100%;
    overflow-x: hidden;
  }

  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-gold);
    padding: 10px 12px;
  }

  .admin-sidebar-header {
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .admin-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    padding-bottom: 6px;
  }

  .admin-nav::-webkit-scrollbar {
    height: 4px;
  }

  .admin-nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.78rem;
    flex-shrink: 0;
  }

  .admin-header {
    height: auto;
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .admin-header > div:last-child {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .admin-clock {
    font-size: 0.78rem;
  }

  .admin-body {
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* POS Split layout responsive folding */
  .admin-body > div[style*="grid-template-columns: 1fr 380px"],
  .pos-responsive-split {
    display: flex !important;
    flex-direction: column !important;
  }

  .pos-responsive-split .admin-table-card {
    height: auto !important;
    min-height: 280px;
  }

  /* Staff matrix responsive folding */
  .admin-body > div > div[style*="grid-template-columns: 280px 1fr"],
  .rbac-responsive-split {
    display: flex !important;
    flex-direction: column !important;
  }

  .admin-table th,
  .admin-table td {
    padding: 10px 12px;
    font-size: 0.78rem;
  }
}

