/* =====================================================
   PREMIUM POS SYSTEM STYLES
   Industrial-Grade Pharmacy Point of Sale
   ===================================================== */

/* POS Container */
.pos-kasir-premium {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
}

/* POS Header - Optimized */
.pos-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  gap: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pos-toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.pos-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Search Section */
.pos-search-container {
  flex: 1;
  max-width: 500px;
}

.pos-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 4px;
  transition: all var(--transition-base);
}

.pos-search-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.pos-barcode-icon {
  color: var(--primary);
  margin: 0 12px;
  font-size: 18px;
}

.pos-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 8px;
  font-size: 15px;
  font-weight: 500;
  background: transparent;
}

.pos-search-input::placeholder {
  color: var(--text-muted);
}

.pos-scan-btn {
  background: var(--primary);
  color: var(--text-inverse);
  border: none;
  padding: 10px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-base);
  margin-right: 4px;
}

.pos-scan-btn:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

/* Quantity Section */
.pos-qty-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-qty-input {
  width: 80px;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  transition: all var(--transition-base);
}

.pos-qty-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.pos-add-item-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-inverse);
  border: none;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-md);
}

.pos-add-item-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.pos-add-item-btn:active {
  transform: translateY(0);
}

/* Action Buttons */
.pos-action-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--line);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-action-btn:hover {
  background: var(--surface-soft);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pos-action-btn.pos-danger {
  color: var(--danger);
  border-color: var(--danger-border);
}

.pos-action-btn.pos-danger:hover {
  background: var(--danger-soft);
}

/* Main Content Layout */
.pos-main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Cart Section */
.pos-cart-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.pos-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
}

.pos-cart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.pos-cart-stats {
  display: flex;
  align-items: center;
  gap: 16px;
}

.pos-item-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 12px;
  background: var(--surface);
  border-radius: var(--radius-xs);
}

.pos-cart-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* Cart Table */
.pos-cart-table-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 24px;
}

.pos-cart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pos-cart-table th {
  background: var(--surface-soft);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.pos-cart-row {
  border-bottom: 1px solid var(--line-soft);
  transition: background var(--transition-base);
}

.pos-cart-row:hover {
  background: var(--surface-soft);
}

.pos-cart-row td {
  padding: 16px;
  vertical-align: middle;
}

.pos-cart-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
}

/* Item Info */
.pos-item-name {
  font-weight: 600;
}

.pos-item-info strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.pos-item-info small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Quantity Controls */
.pos-qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-soft);
  border-radius: var(--radius);
  padding: 4px;
}

.pos-qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pos-qty-btn:hover {
  background: var(--primary);
  color: var(--text-inverse);
  transform: scale(1.1);
}

.pos-qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
}

.pos-item-price,
.pos-item-discount,
.pos-item-total {
  font-weight: 600;
  text-align: right;
}

.pos-item-total {
  color: var(--primary);
  font-size: 15px;
}

/* Delete Button */
.pos-row-delete {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pos-row-delete:hover {
  background: var(--danger-soft);
  transform: scale(1.1);
}

/* Payment Section */
.pos-payment-section {
  width: 400px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Cards - Optimized */
.pos-info-card,
.pos-discount-card,
.pos-summary-card,
.pos-payment-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--line);
  will-change: transform;
}

.pos-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Fields */
.pos-info-grid,
.pos-discount-grid {
  display: grid;
  gap: 12px;
}

.pos-info-grid {
  grid-template-columns: 1fr 1fr;
}

.pos-discount-grid {
  grid-template-columns: 1fr 1fr;
}

.pos-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pos-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pos-input,
.pos-select {
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  transition: all var(--transition-base);
}

.pos-input:focus,
.pos-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}

.pos-discount-field {
  position: relative;
}

/* Summary */
.pos-summary-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
}

.pos-summary-row.pos-total-row {
  border-top: 2px solid var(--line);
  padding-top: 12px;
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}

/* Payment Methods */
.pos-payment-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.pos-payment-btn {
  background: var(--surface);
  border: 2px solid var(--line);
  padding: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.pos-payment-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.pos-payment-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.pos-payment-btn i {
  font-size: 18px;
}

/* Payment Details */
.pos-payment-details {
  margin-bottom: 16px;
}

.pos-hidden {
  display: none !important;
}

/* Kembalian */
.pos-kembalian {
  background: var(--primary-soft);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 12px;
}

.pos-kembalian-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
}

/* Action Buttons */
.pos-action-buttons {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.pos-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pos-btn.pos-btn-secondary {
  background: var(--surface);
  color: var(--text-muted);
  border: 2px solid var(--line);
}

.pos-btn.pos-btn-secondary:hover {
  background: var(--surface-soft);
  color: var(--text);
  transform: translateY(-1px);
}

.pos-btn.pos-btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
}

.pos-btn.pos-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Receipt Modal - Optimized */
.receipt-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: none;
}

.receipt-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
}

.receipt-modal-content {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.receipt-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.receipt-modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.receipt-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
}

.receipt-modal-close:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.receipt-modal-body {
  padding: 20px;
  max-height: 60vh;
  overflow-y: auto;
}

.receipt-modal-actions {
  display: flex;
  gap: 12px;
  padding: 20px;
  border-top: 1px solid var(--line);
}

/* Receipt Preview */
.receipt-preview {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
}

.receipt-header {
  text-align: center;
  margin-bottom: 20px;
}

.receipt-header h2 {
  margin: 0 0 4px 0;
  font-size: 20px;
  font-weight: 700;
}

.receipt-header p {
  margin: 0 0 4px 0;
  font-size: 14px;
}

.receipt-header small {
  color: var(--text-muted);
}

.receipt-items {
  margin-bottom: 20px;
}

.receipt-item {
  margin-bottom: 8px;
}

.receipt-item-name {
  font-weight: 600;
  margin-bottom: 2px;
}

.receipt-item-details {
  font-size: 11px;
  color: var(--text-muted);
}

.receipt-summary {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.receipt-row.receipt-total {
  border-top: 1px dashed var(--line);
  padding-top: 8px;
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
}

.receipt-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--text-muted);
}

.receipt-footer p {
  margin: 2px 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .pos-payment-section {
    width: 350px;
  }
  
  .pos-payment-methods {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .pos-main-content {
    flex-direction: column;
  }
  
  .pos-cart-section {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  
  .pos-payment-section {
    width: 100%;
  }
  
  .pos-info-grid {
    grid-template-columns: 1fr;
  }
  
  .pos-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .pos-toolbar-left {
    flex-direction: column;
    gap: 12px;
  }
  
  .pos-search-container {
    max-width: none;
  }
}

/* Print Styles */
@media print {
  .pos-header,
  .pos-payment-section,
  .receipt-modal-header,
  .receipt-modal-actions {
    display: none !important;
  }
  
  .receipt-modal-content {
    box-shadow: none;
    max-width: 300px;
    margin: 0 auto;
  }
  
  .receipt-preview {
    font-size: 10px;
  }
}
