/* ============================================================
   MAHALAK MODULE STYLES
   Consolidated inline CSS from all module .js files
   ============================================================ */

/* ============================================================
   SHARED MODULE PATTERNS
   ============================================================ */

/* Tab styles (used by inventory, branches, purchases, etc.) */
.module-tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: inherit;
}
.module-tab:hover { color: var(--color-text); }
.module-tab.active {
  color: var(--color-gold-dark);
  border-bottom-color: var(--color-gold);
}

/* Status badges (used across all modules) */
.module-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-0_5) var(--space-2_5);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  line-height: var(--leading-tight);
  white-space: nowrap;
}
.module-badge.active { background: var(--color-success-bg); color: var(--color-success-text); }
.module-badge.inactive { background: var(--color-neutral-100); color: var(--color-neutral-600); }
.module-badge.warning { background: var(--color-warning-bg); color: var(--color-warning-text); }
.module-badge.new { background: var(--color-info-bg); color: var(--color-info-text); }
.module-badge.confirmed { background: var(--color-success-bg); color: var(--color-success-text); }
.module-badge.completed { background: var(--color-neutral-100); color: var(--color-neutral-600); }
.module-badge.cancelled { background: var(--color-error-bg); color: var(--color-error-text); }

/* Movement type badges (inventory, branches) */
.module-movement-type {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.module-movement-type.sale { background: var(--color-info-bg); color: var(--color-info-text); }
.module-movement-type.adjustment { background: var(--color-warning-bg); color: var(--color-warning-text); }
.module-movement-type.in { background: var(--color-success-bg); color: var(--color-success-text); }
.module-movement-type.out { background: var(--color-error-bg); color: var(--color-error-text); }
.module-movement-type.return { background: var(--color-info-bg); color: var(--color-info-text); }
.module-movement-type.transfer { background: var(--color-warning-bg); color: var(--color-warning-text); }

/* ============================================================
   POS MODULE
   ============================================================ */

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-4);
  height: calc(100vh - var(--topbar-height) - var(--space-12));
  min-height: 500px;
}

.pos-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pos-search-box {
  position: relative;
}

.pos-search-box .input {
  padding-inline-end: var(--space-10);
  padding-inline-start: var(--space-10);
}

.pos-search-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-start: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

.pos-scan-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  inset-inline-end: var(--space-3);
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--text-lg);
  opacity: 0.7;
  padding: 2px;
  transition: opacity var(--transition-fast);
}

.pos-scan-btn:hover {
  opacity: 1;
}

.pos-products-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
  padding: var(--space-2);
}

.pos-product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  user-select: none;
}

.pos-product-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.pos-product-card:active {
  transform: translateY(0);
}

.pos-product-card.out-of-stock {
  opacity: 0.5;
  pointer-events: none;
}

.pos-product-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.3;
}

.pos-product-price {
  font-weight: var(--weight-bold);
  color: var(--color-gold-dark);
  font-size: var(--text-md);
}

.pos-product-sku {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.pos-product-stock {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pos-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-12);
  color: var(--color-text-muted);
}

.pos-right {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.pos-cart-title {
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
}

.pos-cart-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
}

.pos-cart-empty {
  text-align: center;
  padding: var(--space-12) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-border-light);
  animation: cart-item-in 0.15s ease;
}

@keyframes cart-item-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.pos-cart-item-info {
  flex: 1;
  min-width: 0;
}

.pos-cart-item-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-cart-item-price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.pos-cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.pos-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--color-border);
  background: var(--color-surface-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  transition: background var(--transition-fast);
}

.pos-qty-btn:hover {
  background: var(--color-surface-hover);
}

.pos-qty-value {
  width: 32px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.pos-cart-item-total {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  min-width: 50px;
  text-align: center;
}

.pos-cart-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  line-height: 1;
  transition: color var(--transition-fast);
}

.pos-cart-remove:hover {
  color: var(--color-error);
}

.pos-cart-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pos-cart-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.pos-cart-summary-row.total {
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--color-gold-dark);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.pos-discount-input {
  width: 80px;
  text-align: center;
}

.pos-checkout-row {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pos-checkout-row .btn {
  flex: 1;
}

.pos-shift-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.pos-payment-modal {
  max-width: 420px;
}

.pos-payment-amounts {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pos-payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.pos-payment-method-btn {
  padding: var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  transition: all var(--transition-fast);
  text-align: center;
}

.pos-payment-method-btn:hover {
  border-color: var(--color-gold);
}

.pos-payment-method-btn.selected {
  border-color: var(--color-gold);
  background: var(--color-gold-light);
  color: var(--color-gold-dark);
}

.pos-customer-select {
  margin-bottom: var(--space-3);
}

/* ============================================================
   INVENTORY MODULE
   ============================================================ */

.inv-stock-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.inv-stock-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-sm);
}

.inv-stock-card.low-stock {
  border-color: var(--color-warning-border);
  background: var(--color-warning-bg);
}

.inv-stock-card.out-of-stock {
  border-color: var(--color-error-border);
  background: var(--color-error-bg);
}

.inv-stock-info { flex: 1; min-width: 0; }

.inv-stock-name {
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-stock-sku {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.inv-stock-qty {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  min-width: 60px;
  text-align: center;
}

.inv-stock-qty.low { color: var(--color-warning); }
.inv-stock-qty.empty { color: var(--color-error); }

.inv-stock-actions { display: flex; gap: var(--space-1); }

.inv-movement-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
}

.inv-movement-row:hover { background: var(--color-surface-hover); }

.inv-filter-row {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface-secondary);
  border-radius: var(--radius-md);
}

.inv-filter-row .input-group { min-width: 140px; flex: 1; }

.inv-movements-list { max-height: 500px; overflow-y: auto; }

.inv-threshold-input { width: 70px; text-align: center; }

/* ============================================================
   BRANCHES MODULE
   ============================================================ */

.br-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.br-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  background: var(--color-surface);
  transition: all var(--transition-fast);
}

.br-card:hover {
  border-color: var(--color-gold);
  box-shadow: var(--shadow-md);
}

.br-card.inactive {
  opacity: 0.6;
}

.br-card-name {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-1);
}

.br-card-detail {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.br-card-actions {
  margin-top: var(--space-3);
  display: flex;
  gap: var(--space-2);
}

.br-stock-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-height: 500px;
  overflow-y: auto;
}

.br-stock-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
}

.br-stock-row:hover { background: var(--color-surface-hover); }

.br-transfer-form {
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--color-surface-secondary);
  border-radius: var(--radius-lg);
}

.br-transfer-products {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.br-transfer-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.br-transfer-item-info { flex: 1; min-width: 0; }

.br-transfer-item-name {
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.br-transfer-item-qty {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.br-transfer-item-input {
  width: 80px;
  text-align: center;
}

.br-select {
  min-width: 200px;
}

/* ============================================================
   PURCHASES MODULE
   ============================================================ */

.pur-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.pur-btn-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.pur-invoice-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
}

.pur-invoice-item-info { flex: 1; min-width: 0; }
.pur-invoice-item-info .name { font-weight: var(--weight-medium); font-size: var(--text-sm); }
.pur-invoice-item-info .meta { font-size: var(--text-xs); color: var(--color-text-muted); }

/* ============================================================
   STORE ORDERS MODULE
   ============================================================ */

.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  transition: box-shadow var(--transition-fast);
}

.order-card:hover {
  box-shadow: var(--shadow-md);
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.order-customer {
  font-weight: var(--weight-semibold);
  font-size: var(--text-md);
}

.order-time {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.order-items {
  margin-bottom: var(--space-2);
}

.order-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-light);
}

.order-item:last-child {
  border-bottom: none;
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-weight: var(--weight-bold);
  font-size: var(--text-md);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
  color: var(--color-gold-dark);
}

.order-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   BRANCH SWITCHER
   ============================================================ */
#branch-switcher {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.branch-switcher-overlay {
  width: 100%;
  height: 100%;
  background: var(--color-bg, #0a0a1a);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: var(--space-6);
}

.branch-switcher-card {
  width: 100%;
  max-width: 560px;
  background: var(--color-surface, #ffffff);
  border-radius: var(--radius-xl, 20px);
  box-shadow: var(--shadow-xl, 0 25px 50px rgba(0,0,0,0.15));
  overflow: hidden;
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.branch-switcher-header {
  text-align: center;
  padding: var(--space-10, 40px) var(--space-6) var(--space-6);
  background: linear-gradient(135deg, var(--color-gold-50, #fdf8ed), var(--color-gold-100, #f9efd0));
}

.branch-switcher-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--color-gold, #c9a96e);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.branch-switcher-logo::after {
  content: '🏪';
  font-size: 28px;
}

.branch-switcher-title {
  font-size: var(--text-2xl, 24px);
  font-weight: var(--weight-bold, 700);
  color: var(--color-text, #1a1a2e);
  margin-bottom: var(--space-2);
}

.branch-switcher-subtitle {
  font-size: var(--text-sm, 14px);
  color: var(--color-text-muted, #6b7280);
  margin: 0;
}

.branch-switcher-loading {
  text-align: center;
  padding: var(--space-10, 40px);
  color: var(--color-text-muted);
}

.branch-switcher-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-gold, #c9a96e);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto var(--space-3);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.branch-switcher-grid {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.branch-switcher-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1.5px solid var(--color-border, #e5e7eb);
  border-radius: var(--radius-lg, 14px);
  cursor: pointer;
  transition: all var(--transition-fast, 0.2s);
  background: var(--color-surface, #ffffff);
}

.branch-switcher-item:hover {
  border-color: var(--color-gold, #c9a96e);
  background: var(--color-gold-50, #fdf8ed);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
}

.branch-switcher-item:active {
  transform: translateY(0);
}

.branch-switcher-item-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg, 14px);
  background: var(--color-gold-100, #f9efd0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.branch-switcher-item-info {
  flex: 1;
  min-width: 0;
}

.branch-switcher-item-name {
  font-size: var(--text-base, 16px);
  font-weight: var(--weight-semibold, 600);
  color: var(--color-text, #1a1a2e);
  margin-bottom: 2px;
}

.branch-switcher-item-address {
  font-size: var(--text-xs, 12px);
  color: var(--color-text-muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-switcher-item-arrow {
  color: var(--color-text-muted);
  font-size: 18px;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.branch-switcher-item:hover .branch-switcher-item-arrow {
  transform: translateX(4px);
  color: var(--color-gold, #c9a96e);
}

.branch-switcher-empty {
  text-align: center;
  padding: var(--space-10, 40px);
  color: var(--color-text-muted);
}

.branch-switcher-empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-3);
}

.branch-switcher-empty h3 {
  font-size: var(--text-lg, 18px);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.branch-switcher-empty p {
  margin: 0;
}
