/* Inventory Page Styles */

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all 0.3s;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-label {
  display: block;
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #1f2937;
  margin: 0;
}

/* Filters Bar */
.filters-bar {
  background: white;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.filter-select {
  padding: 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 180px;
}

.filter-select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-filter-reset {
  padding: 10px 20px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #6b7280;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-filter-reset:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* Table */
.table-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead {
  background: #f9fafb;
  border-bottom: 2px solid #e5e7eb;
}

.data-table th {
  padding: 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: all 0.2s;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.data-table td {
  padding: 16px;
  font-size: 14px;
  color: #4b5563;
  vertical-align: middle;
}

.loading-row {
  text-align: center;
  padding: 40px !important;
  color: #9ca3af;
  font-size: 14px;
}

/* Product Image */
.product-image {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: #f3f4f6;
}

/* Product Info */
.product-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.product-name {
  font-weight: 500;
  color: #1f2937;
}

.product-sku {
  font-size: 12px;
  color: #9ca3af;
  font-family: 'Courier New', monospace;
}

/* Stock Badge */
.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.stock-badge i {
  font-size: 10px;
}

.stock-badge.in-stock {
  background: #d1fae5;
  color: #065f46;
}

.stock-badge.low-stock {
  background: #fef3c7;
  color: #92400e;
}

.stock-badge.out-of-stock {
  background: #fee2e2;
  color: #991b1b;
}

/* Stock Number */
.stock-number {
  font-weight: 600;
  font-size: 16px;
}

.stock-number.high {
  color: #10b981;
}

.stock-number.medium {
  color: #f59e0b;
}

.stock-number.low {
  color: #ef4444;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-action.adjust {
  background: #ede9fe;
  color: #6d28d9;
}

.btn-action.adjust:hover {
  background: #ddd6fe;
}

.btn-action.history {
  background: #dbeafe;
  color: #1e40af;
}

.btn-action.history:hover {
  background: #bfdbfe;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  padding-left: 280px;
}

.modal.active {
  display: flex;
}

.modal-dialog {
  width: 100%;
  max-width: 600px;
  animation: modalSlideIn 0.3s ease-out;
}

.modal-dialog.modal-lg {
  max-width: calc(100vw - 300px);
  width: 850px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.modal-body {
  padding: 24px;
  overflow: auto;
  flex: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 18px;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #1f2937;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 8px;
}

.required {
  color: #ef4444;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:read-only {
  background: #f9fafb;
  color: #6b7280;
}

.form-group textarea {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* Stock Preview */
.stock-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  margin-top: 20px;
}

.preview-item {
  flex: 1;
  text-align: center;
}

.preview-item span {
  display: block;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 4px;
}

.preview-item strong {
  font-size: 24px;
  color: #1f2937;
}

.preview-arrow {
  font-size: 24px;
  color: #9ca3af;
}

.text-primary {
  color: #667eea !important;
}

/* Product Info Display */
.product-info-display {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}

.product-info-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.product-info-header img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: #e2e8f0;
}

.product-info-text h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.product-info-text .product-sku {
  font-size: 13px;
  color: #6b7280;
  font-family: 'Courier New', monospace;
}

/* Section Label */
.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

.section-label i {
  color: #667eea;
}

/* Variant Table */
.variant-table-wrapper {
  display: block;
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 20px;
  max-height: 350px;
  -webkit-overflow-scrolling: touch;
}

.variant-table-wrapper::-webkit-scrollbar {
  height: 12px;
  width: 8px;
}

.variant-table-wrapper::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 6px;
}

.variant-table-wrapper::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 6px;
}

.variant-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #5568d3;
}

.variant-inventory-table {
  border-collapse: collapse;
  font-size: 13px;
  width: max-content;
  min-width: 100%;
}

.variant-inventory-table th,
.variant-inventory-table td {
  padding: 8px 10px;
  text-align: center;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  min-width: 85px;
}

.variant-inventory-table th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.variant-inventory-table th:first-child,
.variant-inventory-table td:first-child {
  text-align: center;
  min-width: 70px;
  position: sticky;
  left: 0;
  z-index: 5;
  background: white;
}

.variant-inventory-table th:first-child {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 15;
}

.color-header {
  font-size: 20px;
  display: block;
  margin-bottom: 2px;
}

.color-header + small {
  font-size: 11px;
  opacity: 0.9;
}

.size-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  padding: 0 10px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
}

.variant-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.current-qty {
  font-size: 12px;
  color: #6b7280;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.variant-input {
  width: 70px;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  transition: all 0.2s;
}

.variant-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.variant-input::-webkit-inner-spin-button,
.variant-input::-webkit-outer-spin-button {
  opacity: 1;
}

.row-total,
.col-total {
  font-weight: 600;
  color: #374151;
  background: #f1f5f9;
}

.row-change,
.grand-change {
  font-weight: 600;
  font-size: 13px;
}

.row-change.positive,
.grand-change.positive {
  color: #10b981;
}

.row-change.negative,
.grand-change.negative {
  color: #ef4444;
}

.row-change.neutral,
.grand-change.neutral {
  color: #3b82f6;
}

.total-row td {
  background: #e2e8f0;
  font-weight: 600;
  border-bottom: none;
}

.grand-total {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  color: white !important;
}

/* Stock Summary */
.stock-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  margin-top: 20px;
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.summary-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.summary-item {
  text-align: center;
}

.summary-item span {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.summary-item strong {
  font-size: 28px;
  color: #1f2937;
}

.summary-arrow {
  font-size: 24px;
  color: #9ca3af;
}

.summary-change {
  margin-left: 10px;
}

.change-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
}

.change-badge.positive {
  background: #d1fae5;
  color: #065f46;
}

.change-badge.negative {
  background: #fee2e2;
  color: #991b1b;
}

.change-badge.neutral {
  background: #e0e7ff;
  color: #3730a3;
}

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e7eb;
}

.btn-secondary {
  padding: 10px 20px;
  border: 1px solid #e5e7eb;
  background: white;
  color: #4a5568;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.btn-primary {
  padding: 10px 20px;
  border: none;
  background: #667eea;
  color: white;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Notification Toast */
.notification-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 16px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10000;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease-out;
}

.notification-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-toast.success {
  border-left: 4px solid #48bb78;
}

.notification-toast.success i {
  color: #48bb78;
  font-size: 20px;
}

.notification-toast span {
  font-size: 14px;
  font-weight: 500;
  color: #2d3748;
}

/* History Timeline */
.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.history-date-group {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.history-date-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 2px solid #f3f4f6;
  margin-bottom: 20px;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.history-date-header i {
  color: #667eea;
}

.history-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f9fafb;
  border-radius: 8px;
  transition: all 0.2s;
}

.history-item:hover {
  background: #f3f4f6;
}

.history-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.history-icon.type-in {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.history-icon.type-out {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.history-icon.type-set {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.history-content {
  flex: 1;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.history-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
}

.history-time {
  font-size: 13px;
  color: #9ca3af;
}

.history-details {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.history-type {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.history-type.type-in {
  background: #d1fae5;
  color: #065f46;
}

.history-type.type-out {
  background: #fee2e2;
  color: #991b1b;
}

.history-type.type-set {
  background: #dbeafe;
  color: #1e40af;
}

.history-quantity {
  font-size: 13px;
  color: #6b7280;
}

.history-stock-change {
  font-size: 13px;
  font-weight: 600;
  color: #667eea;
  font-family: 'Courier New', monospace;
}

.history-note {
  margin: 8px 0 0 0;
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-state i {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0 0 8px 0;
}

.empty-state p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .filters-bar {
    flex-direction: column;
  }
  
  .filter-select {
    width: 100%;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .stock-preview {
    flex-direction: column;
  }
  
  .preview-arrow {
    transform: rotate(90deg);
  }
  
  .history-item {
    flex-direction: column;
  }
  
  .history-details {
    flex-direction: column;
    gap: 8px;
  }
}
