/* diKasirin Design System & Styling */
:root {
  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-light: #d1fae5;
  --emerald-text: #065f46;
  --purple-bg: #f3e8ff;
  --purple-text: #6b21a8;
  --blue-bg: #e0f2fe;
  --blue-text: #0369a1;
  --amber-bg: #fef3c7;
  --amber-text: #92400e;
  --rose-bg: #ffe4e6;
  --rose-text: #9f1239;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

body.theme-dark {
  --bg-primary: #090d16;
  --bg-secondary: #0f172a;
  --bg-card: #131b2e;
  --bg-sidebar: #0b1120;
  --border-color: #1e293b;
  --border-light: #172033;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-light: #064e3b;
  --emerald-text: #a7f3d0;
  --purple-bg: #3b0764;
  --purple-text: #e9d5ff;
  --blue-bg: #082f49;
  --blue-text: #bae6fd;
  --amber-bg: #451a03;
  --amber-text: #fde68a;
  --rose-bg: #4c0519;
  --rose-text: #fecdd3;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  font-size: 14px;
}

/* APP SHELL */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.outlet-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.outlet-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background-color: #0f172a;
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}

.outlet-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.outlet-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
}

.outlet-role {
  font-size: 12px;
  color: var(--text-secondary);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 12px 10px 4px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background-color: var(--border-light);
  color: var(--text-primary);
}

.nav-link.active {
  background-color: var(--border-light);
  color: var(--text-primary);
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-text {
  flex: 1;
}

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

.app-download-card {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  padding: 12px;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.adc-title {
  font-weight: 700;
  font-size: 12px;
}

.adc-desc {
  font-size: 11px;
  margin: 4px 0 8px;
  opacity: 0.9;
  line-height: 1.3;
}

.btn-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.btn-logout:hover {
  color: #ef4444;
  background-color: var(--border-light);
}

/* MAIN WRAPPER */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* TOPBAR */
.topbar {
  height: 56px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}

.btn-command-palette {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-command-palette kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 11px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-wa-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-wa-link:hover {
  color: var(--emerald-dark);
}

.btn-icon {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.up-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #3b82f6;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.up-name {
  font-weight: 600;
  font-size: 13px;
}

/* TRIAL BANNER */
.trial-banner {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

body.theme-dark .trial-banner {
  background: #0f172a;
}

.tb-sub {
  margin-left: 12px;
  color: var(--text-muted);
}

.tb-link {
  color: var(--emerald);
  text-decoration: none;
  font-weight: 600;
}

/* CONTENT VIEW */
.content-view {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* BADGES */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.badge-pill {
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 10px;
}

.badge-gray {
  background-color: var(--border-light);
  color: var(--text-secondary);
}

.badge-emerald {
  background-color: var(--emerald-light);
  color: var(--emerald-text);
}

.badge-purple {
  background-color: var(--purple-bg);
  color: var(--purple-text);
}

.badge-blue {
  background-color: var(--blue-bg);
  color: var(--blue-text);
}

.badge-amber {
  background-color: var(--amber-bg);
  color: var(--amber-text);
}

.badge-rose {
  background-color: var(--rose-bg);
  color: var(--rose-text);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background-color: var(--emerald);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--emerald-dark);
}

.btn-secondary {
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--border-light);
}

.btn-outline-white {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.4);
  color: white;
}

.btn-outline-white:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.w-full {
  width: 100%;
}

/* DASHBOARD VIEW */
.page-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.attention-banner {
  background-color: var(--amber-bg);
  border: 1px solid #fde68a;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.ab-title {
  font-weight: 700;
  color: var(--amber-text);
  font-size: 14px;
}

.ab-desc {
  font-size: 12px;
  color: var(--amber-text);
  margin-top: 2px;
}

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

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 6px 0;
}

.stat-footer {
  font-size: 11px;
  color: var(--text-muted);
}

.dashboard-sections {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* CHART SIMULATION */
.bar-chart-container {
  display: flex;
  align-items: flex-end;
  height: 180px;
  gap: 14px;
  padding-top: 20px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.bar-fill {
  width: 100%;
  background-color: var(--emerald);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.bar-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.bar-amount {
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

/* TABLES */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.data-table tr:hover {
  background-color: var(--bg-secondary);
}

/* POS SCREEN STYLES */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - 120px);
}

.pos-catalog {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.pos-search-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
}

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.cat-pill {
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cat-pill.active {
  background: #0f172a;
  color: white;
  border-color: #0f172a;
}

body.theme-dark .cat-pill.active {
  background: var(--emerald);
  color: black;
  border-color: var(--emerald);
}

.products-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  padding-right: 4px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s;
}

.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--emerald);
}

.prod-category {
  font-size: 10px;
  font-weight: 600;
  color: var(--emerald-dark);
  text-transform: uppercase;
}

.prod-name {
  font-weight: 600;
  font-size: 13px;
  margin: 6px 0;
  line-height: 1.3;
}

.prod-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.prod-stock {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* POS CART PANEL */
.pos-cart-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

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

.cart-title {
  font-weight: 700;
  font-size: 14px;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.ci-info {
  flex: 1;
}

.ci-name {
  font-weight: 600;
  font-size: 13px;
}

.ci-price {
  font-size: 12px;
  color: var(--text-secondary);
}

.ci-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-qty {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.ci-qty {
  font-weight: 600;
  font-size: 13px;
  min-width: 20px;
  text-align: center;
}

.cart-summary {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.summary-row.total {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 10px 0 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.pos-pay-btn {
  background: var(--emerald);
  color: white;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-pay-btn:hover {
  background: var(--emerald-dark);
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.btn-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
}

/* FORMS */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
}

/* TOAST */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* PRINT AREA (Hidden on screen) */
.receipt-print-area {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  .receipt-print-area, .receipt-print-area * {
    visibility: visible;
  }
  .receipt-print-area {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    line-height: 1.3;
    padding: 10px;
    color: black;
  }
}
