/* POS System Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.6;
}

/* Layout */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  background: var(--gray-900);
  color: white;
  padding: 20px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--gray-700);
  margin-bottom: 20px;
}

.sidebar-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.sidebar-header span {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.sidebar-menu {
  list-style: none;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--gray-300);
  text-decoration: none;
  transition: all 0.2s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  background: var(--primary);
  color: white;
}

.sidebar-menu li a svg {
  width: 20px;
  height: 20px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 250px;
  padding: 30px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

/* Cards */
.card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
}

.stat-card .stat-icon.blue {
  background: #dbeafe;
  color: var(--primary);
}
.stat-card .stat-icon.green {
  background: #d1fae5;
  color: var(--success);
}
.stat-card .stat-icon.yellow {
  background: #fef3c7;
  color: var(--warning);
}
.stat-card .stat-icon.red {
  background: #fee2e2;
  color: var(--danger);
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

.stat-card .stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

table th {
  background: var(--gray-50);
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--gray-700);
}

table tbody tr:hover {
  background: var(--gray-50);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.btn-secondary:hover {
  background: var(--gray-300);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--gray-700);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

/* Alerts */
.alert {
  padding: 15px 20px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 0.875rem;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray-500);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 20px;
  border-top: 1px solid var(--gray-200);
}

/* Invoice Styles */
.invoice {
  background: white;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}

.invoice-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.invoice-details {
  text-align: right;
}

.invoice-table {
  margin: 30px 0;
}

.invoice-table th {
  background: var(--gray-900);
  color: white;
}

.invoice-totals {
  display: flex;
  justify-content: flex-end;
}

.invoice-totals table {
  width: 300px;
}

.invoice-totals td {
  padding: 8px 15px;
}

.invoice-totals .grand-total {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gray-100);
}

/* Filters */
.filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filters .form-control {
  width: auto;
  min-width: 150px;
}

/* Low Stock Warning */
.low-stock {
  color: var(--danger);
  font-weight: 600;
}

/* Actions */
.actions {
  display: flex;
  gap: 8px;
}

/* POS Grid */
.pos-container {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 20px;
  height: calc(100vh - 140px);
}

.pos-products {
  background: white;
  border-radius: 8px;
  padding: 20px;
  overflow-y: auto;
}

.pos-cart {
  background: white;
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}

.product-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.product-card .product-name {
  font-weight: 600;
  margin-bottom: 5px;
}

.product-card .product-price {
  color: var(--primary);
  font-weight: 700;
}

.product-card .product-stock {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 20px;
}

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

.cart-item-info h4 {
  font-size: 0.875rem;
  font-weight: 600;
}

.cart-item-info p {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-item-qty button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--gray-300);
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.cart-item-qty span {
  font-weight: 600;
}

.cart-summary {
  border-top: 2px solid var(--gray-200);
  padding-top: 20px;
}

.cart-summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cart-summary-row.total {
  font-size: 1.25rem;
  font-weight: 700;
  padding-top: 10px;
  border-top: 1px solid var(--gray-200);
}

/* Print Styles */
@media print {
  .sidebar,
  .page-header,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
  }

  .invoice {
    box-shadow: none;
    padding: 20px;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .pos-container {
    grid-template-columns: 1fr;
    height: auto;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    padding: 10px 0;
  }

  .sidebar-header h2,
  .sidebar-header span,
  .sidebar-menu li a span {
    display: none;
  }

  .sidebar-menu li a {
    justify-content: center;
    padding: 15px;
  }

  .main-content {
    margin-left: 60px;
    padding: 15px;
  }

  .page-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }
}

/* Added logout menu item styles */
.sidebar-menu .logout-item {
  margin-top: auto;
  border-top: 1px solid var(--gray-700);
  padding-top: 10px;
  margin-top: 20px;
}

.sidebar-menu .logout-item a {
  color: #f87171;
}

.sidebar-menu .logout-item a:hover {
  background: #dc2626;
  color: white;
}
