/* ====================== EMPTY STATE ====================== */

.services-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 2rem;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  color: #cbd5e1;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.empty-state-text {
  color: #94a3b8;
  margin-bottom: 1.5rem;
}

/* ====================== SERVICE TIME FILTER ====================== */

.service-time-filter-container {
  border-radius: 12px;
  padding: 2px 6px;
  margin: 5px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
}

.service-time-filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* Compact select-like filter */
.service-filter-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.service-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.15s;
}

.service-filter-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(var(--mkt-primary-raw), 0.08);
}

.service-filter-pill {
  padding: 6px 10px;
  border-radius: 9999px;
  background: rgba(var(--mkt-primary-raw), 0.08);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
}

.service-filter-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: grid;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  grid-auto-rows: min-content;
  gap: 6px;
}

.service-filter-list.hidden {
  display: none;
}

.service-filter-item {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.service-filter-item.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.service-filter-item:hover {
  background: var(--table-row-bg);
  border-color: var(--border);
}

.service-filter-chevron {
  transition: transform 0.2s ease;
}
.service-filter-select.open .service-filter-chevron {
  transform: rotate(180deg);
}

/* hide the old button grid on small view to keep compact UI */
@media (max-width: 768px) {
  .service-time-filter-buttons {
    display: none;
  }
  .service-filter-list {
    left: 0;
    right: auto;
  }
}

.service-time-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.service-time-filter-btn:hover {
  background: var(--table-row-bg);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--mkt-primary-raw), 0.2);
}

.service-time-filter-btn.active {
  background: linear-gradient(135deg, var(--primary) 0%, rgba(var(--mkt-primary-raw), 0.8) 100%);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(var(--mkt-primary-raw), 0.3);
}

.service-time-filter-btn i {
  font-size: 16px;
}

.service-custom-date-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.service-custom-date-container.hidden {
  display: none;
}

.service-date-input {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: all 0.2s;
  min-width: 140px;
}

.service-date-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--mkt-primary-raw), 0.1);
}

.date-separator {
  color: var(--muted);
  font-weight: 500;
  font-size: 16px;
}

.apply-service-date-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.apply-service-date-btn:hover {
  background: rgba(var(--mkt-primary-raw), 0.9);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--mkt-primary-raw), 0.3);
}

/* Responsive cho mobile */
@media (max-width: 768px) {
  .service-time-filter-buttons {
    justify-content: center;
  }

  .service-time-filter-btn {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 8px 12px;
  }

  .service-custom-date-container {
    flex-direction: column;
    align-items: stretch;
  }

  .service-date-input {
    width: 100%;
  }

  .date-separator {
    text-align: center;
  }

  .apply-service-date-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ====================== INVOICE TABS ====================== */

.invoice-tabs-container {
  background-color: var(--surface);
  border-bottom: 1px solid var(--border);
  margin: 5px 10px;
  width: auto;
  overflow-x: auto;
}

.invoice-tabs {
  display: flex;
  overflow-x: auto;
  padding: 4px;
  font-weight: 700;
}

.invoice-tab {
  display: flex;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  background-color: var(--table-row-bg);
  border-radius: 6px;
  margin: 4px;
  color: var(--text);
  font-size: medium;
  transition: background-color 0.2s;
}

.invoice-tab:hover {
  background-color: var(--border);
}

.invoice-tab.active {
  background-color: rgba(var(--mkt-primary-raw), 0.1);
  color: var(--primary);
}

.close-tab-btn {
  margin-left: 8px;
  color: #9ca3af;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
}

.close-tab-btn:hover {
  color: #4b5563;
}

#addInvoiceTab {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background-color: rgba(var(--mkt-primary-raw), 0.1);
  color: var(--primary);
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

#addInvoiceTab:hover {
  background-color: rgba(var(--mkt-primary-raw), 0.2);
}

/* ====================== INVOICE CONTENT ====================== */

.invoice-content {
  background-color: var(--surface);
  border-radius: 12px;
  margin: 15px 10px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 16px;
}

.invoice-info-section {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.info-invoice {
  padding: 1rem;
  border-width: 1px;
  border-color: var(--border);
  border-radius: 0.375rem;
  color: var(--muted);
}

/* ====================== CUSTOMER SECTION ====================== */

.customer-info-section {
  margin-bottom: 24px;
}

.customer-info-section h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.customer-search-container {
  display: flex;
  flex-direction: column;
}

.customer-search {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 5px;
}

.customer-search input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  width: 300px;
  max-width: 300px;
  outline: none;
  font-size: 16px;
}

.customer-search input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.customer-search button {
  margin-left: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.search-customer-btn {
  background-color: var(--primary);
  color: var(--surface);
}

.search-customer-btn:hover {
  filter: brightness(0.9);
}

.scan-qr-btn {
  background-color: #22c55e;
  color: #fff;
  padding: 8px;
}

.scan-qr-btn:hover {
  background-color: #16a34a;
}

.customer-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.customer-info {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background-color: var(--table-row-bg);
}

.customer-member-info {
  display: flex;
  align-items: center;
}

.customer-info-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
}

.customer-photo-container {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #e5e7eb;
  overflow: hidden;
  margin-right: 12px;
}

.customer-photo {
  width: 100%;
  object-fit: cover;
  transform: translateY(-20%);
}

.customer-details {
  display: flex;
  flex-direction: column;
}

.customer-details h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-right: 8px;
}

.customer-details .text-sm {
  font-size: 14px;
  color: var(--muted);
}

.membership-tag {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 12px;
  font-weight: 500;
}

.vip-tag {
  background-color: #f59e0b;
  color: #ffffff;
}

.normal-tag {
  background-color: #e5e7eb;
  color: #4b5563;
}

.member-tag {
  background-color: #e3fee2;
  color: #289b14;
}

.customer-promo {
  margin-top: 4px;
  font-size: 12px;
  color: var(--primary);
}

.customer-promo i {
  margin-right: 4px;
}

/* ====================== CUSTOMER PHOTOS ====================== */

.customer-photos-section {
  margin-top: 12px;
}

.customer-photos-section h5 {
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  color: var(--text);
  margin-bottom: 20px;
}

.customer-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.customer-photos img {
  max-height: 240px;
  width: 100%;
  margin: auto;
  object-fit: cover;
  border-radius: 6px;
}

.customer-photo-actions {
  margin-top: 8px;
  text-align: center;
  display: flex;
  gap: 5px;
  justify-content: center;
}

.customer-photo-actions button {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  color: #fff;
  transition: background-color 0.2s;
}

.upload-image-btn {
  background-color: #3b82f6;
}

.upload-image-btn:disabled {
  background-color: #9ca3af;
}

.not-image-btn {
  background-color: #ef4444;
}

.not-image-btn:disabled {
  background-color: #9ca3af;
}

.upload-feedback-btn {
  background-color: #6b7280;
}

.upload-feedback-btn:disabled {
  background-color: #9ca3af;
}

.customer-not-image {
  font-size: 14px;
  color: #ef4444;
  text-align: center;
  padding: 12px;
}

/* ====================== MODALS ====================== */

.not-image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.not-image-modal-box {
  background: var(--surface);
  padding: 20px;
  border-radius: 10px;
  max-width: 320px;
  width: 100%;
}

.not-image-modal-title {
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: bold;
}

.not-image-modal-reason-list {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.6;
}

.not-image-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.not-image-modal-button {
  padding: 6px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

.not-image-modal-button-primary {
  background-color: #007bff;
  color: white;
}

.not-image-modal-button-primary:hover {
  background-color: #0056b3;
}

.not-image-modal-button-secondary {
  background-color: #6c757d;
  color: white;
}

.not-image-modal-button-secondary:hover {
  background-color: #5a6268;
}

.image-upload-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
}

.image-upload-box {
  background: var(--surface);
  padding: 20px;
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  position: relative;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.image-upload-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
}

.image-upload-input {
  display: block;
  margin-bottom: 15px;
  width: 100%;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 15px;
}

.image-preview-grid img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.image-upload-confirm {
  background-color: #007bff;
  color: white;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}

.image-upload-confirm:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.image-upload-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #666;
}

.new-customer-form {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 8px;
  background-color: var(--table-row-bg);
}

.new-customer-form h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.new-customer-form label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

.new-customer-form input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
  outline: none;
  font-size: 16px;
}

.new-customer-form input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.new-customer-form .save-btn {
  background-color: #2563eb;
  color: #fff;
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.new-customer-form .save-btn:hover {
  background-color: #1d4ed8;
}

/* ====================== SERVICES & PRODUCTS SECTION ====================== */

.services-section {
  margin-bottom: 24px;
}

.services-tabs {
  display: flex;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.services-tab,
.products-tab {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  outline: none;
}

.services-tab {
  background-color: #3b82f6;
  color: #fff;
}

.products-tab {
  background-color: #f3f4f6;
  color: #374151;
}

.services-container {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background-color: var(--section-container);
  min-height: 160px;
}

.service-groups,
.product-groups {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  font-size: medium;
}

.service-list,
.product-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0.5rem;
  overflow-y: auto;
}

.product-item {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  background-color: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.product-item:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-item .text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-item .text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--muted);
}

/* Service Group Button Styles */
.service-group-btn-style {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.service-group-btn-active {
  background-color: #3b82f6;
  color: #ffffff;
}

.service-group-btn-inactive {
  background-color: #f3f4f6;
  color: #374151;
}

/* Service List Styles */
.service-list-empty {
  grid-column: span 3;
  text-align: center;
  color: #6b7280;
  padding: 16px;
}

.service-item-style,
.product-item-style {
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
  background-color: var(--bg);
}

.service-item-style:hover,
.product-item-style:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.service-item-added,
.product-item-added {
  opacity: 0.5;
}

.service-item-name,
.product-item-name {
  font-size: 14px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.service-item-price,
.product-item-price {
  font-size: 12px;
  color: var(--muted);
}

/* Hiển thị giá gốc và giá giảm cho dịch vụ */
.service-item-price-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.service-item-original-price {
  font-size: 12px;
  color: var(--muted);
  text-decoration: line-through;
  opacity: 0.7;
}

.service-item-discounted-price {
  font-size: 12px;
  color: #dc2626; /* red-600 */
  font-weight: 600;
}

.service-item-stock,
.product-item-stock {
  font-size: 12px;
  color: var(--muted);
}

.service-item-selected,
.product-item-selected {
  font-size: 12px;
  color: #3b82f6;
  margin-top: 4px;
}

/* Services and Products Tab Styles */
.services-tab-active {
  background-color: #3b82f6;
  color: #ffffff;
}

.services-tab-inactive {
  background-color: #f3f4f6;
  color: #374151;
}

.products-tab-active {
  background-color: #3b82f6;
  color: #ffffff;
}

.products-tab-inactive {
  background-color: #f3f4f6;
  color: #374151;
}

/* Product Group Button Styles */
.product-group-btn-style {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
}

.product-group-btn-active {
  background-color: #3b82f6;
  color: #ffffff;
}

.product-group-btn-inactive {
  background-color: #f3f4f6;
  color: #374151;
}

/* Product List Styles */
.product-list-style {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 8px;
  height: 320px;
  overflow-y: auto;
}

.product-list-empty {
  grid-column: span 3;
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

/* ====================== QUANTITY INPUT ====================== */

.quantity-input-container-style {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.custom-quantity {
  display: flex;
  align-items: center;
}

.quantity-input-style {
  width: 48px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.quantity-input-style:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.qty-btn {
  padding: 4px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background-color: #b5b5b542;
  cursor: pointer;
  font-size: 14px;
}

.qty-btn-decrement {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.qty-btn-increment {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* ====================== STAFF ITEM ====================== */

.staff-item-style {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.staff-item-style:hover {
  background-color: #f9fafb;
}

.staff-item-selected {
  background-color: #eff6ff;
}

.staff-photo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 8px;
}

.staff-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.staff-info {
  display: flex;
  flex-direction: column;
}

.staff-name {
  font-size: 14px;
  font-weight: 500;
}

.staff-role {
  font-size: 12px;
  color: var(--muted);
}

/* ====================== SELECTED SERVICES ====================== */

.selected-services-section {
  margin-bottom: 24px;
}

.selected-services-section h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.selected-services {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  min-height: 80px;
}

.selected-services-empty {
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

.selected-service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.selected-service-item:last-child {
  border-bottom: none;
}

.selected-service-name {
  font-weight: 500;
}

.selected-service-staff {
  font-size: 14px;
  color: var(--muted);
}

.selected-service-quantity {
  font-size: 14px;
  color: var(--muted);
}

.selected-service-quantity-label {
  font-size: 14px;
  color: #4b5563;
}

.selected-service-price {
  font-size: 14px;
  font-weight: 500;
  margin-right: 8px;
}

.selected-service-actions {
  display: flex;
  align-items: center;
}

.edit-service-btn-style {
  color: #3b82f6;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
}

.edit-service-btn-style:hover {
  color: #1d4ed8;
}

.remove-service-btn-style {
  color: #ef4444;
  padding: 4px;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: 8px;
}

.remove-service-btn-style:hover {
  color: #dc2626;
}

/* ====================== PAYMENT SECTION ====================== */

.payment-section {
  margin-bottom: 24px;
}

.payment-section h3 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
}

.payment-container {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px;
}

.payment-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.payment-row span {
  font-size: 16px;
}

.payment-row select,
.payment-row input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 16px;
  outline: none;
  background-color: var(--surface);
}

.payment-row select:focus,
.payment-row input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.payment-row input {
  width: 64px;
}

.payment-divider {
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.payment-total {
  display: flex;
  justify-content: space-between;
  font-size: 18px;
  font-weight: 500;
}

.payment-total-amount {
  color: #22c55e;
}

.payment-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.payment-actions button {
  flex: 1;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
  color: #fff;
  transition: background-color 0.2s;
  position: relative;
}

.create-invoice-btn {
  background-color: #3b82f6;
}

.create-invoice-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.review-invoice-btn {
  background-color: #eab308;
}

.review-invoice-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.pay-invoice-btn {
  background-color: #22c55e;
  cursor: pointer;
}

.pay-invoice-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.disabled-btn {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.disabled-paid-btn {
  cursor: not-allowed;
}

.center-btn {
  margin-left: auto;
  margin-right: auto;
}

.block-btn {
  display: block;
}

.center-btn-block {
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.block-btn-bg {
  display: block;
  margin-left: auto;
  margin-right: auto;
  background-color: #33a35c;
}

.payment-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}

.payment-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.payment-input {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  width: 64px;
  outline: none;
}

.payment-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
  margin-right: 8px;
  vertical-align: middle;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ====================== MODAL ALL TABS ====================== */

.modal-all-tabs {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-all-tabs-content {
  background-color: var(--surface);
  border-radius: 8px;
  padding: 24px;
  width: 95%;
  max-width: 400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Modal header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-all-tabs-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.modal-all-tabs-close {
  background-color: #e5e7eb;
  color: #374151;
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.modal-all-tabs-close:hover {
  background-color: #d1d5db;
}

/* Search input wrapper */
.modal-search-wrapper {
  margin-bottom: 12px;
}

.modal-search-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 16px; /* Min 16px để tránh zoom trên iOS */
  outline: none;
  transition: all 0.2s;
  background-color: var(--surface);
  color: var(--text);
}

.modal-search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-search-input::placeholder {
  color: #9ca3af;
}

/* Invoice list */
.modal-all-tabs-list {
  overflow-y: auto;
  flex: 1;
}

/* Empty state */
.modal-empty-state {
  text-align: center;
  padding: 32px 0;
  color: #6b7280;
}

.modal-empty-state i {
  font-size: 48px;
  margin-bottom: 8px;
  display: block;
}

.modal-empty-state p {
  margin: 0;
  font-size: 14px;
}

.modal-all-tabs-item {
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 0.2s;
  border-radius: 6px;
  margin-bottom: 4px;
}

.modal-all-tabs-item:hover {
  background-color: var(--bg);
}

.modal-all-tabs-item.active {
  background-color: var(--bg);
  border-left: 3px solid #3b82f6;
}

/* Left section - customer info with grid layout */
.modal-invoice-left {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.modal-invoice-status-dot {
  font-size: 8px;
}

.modal-invoice-status-dot.paid {
  color: #22c55e;
}

.modal-invoice-status-dot.pending {
  color: #ef4444;
}

.modal-invoice-customer {
  font-weight: 500;
  direction: rtl;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.modal-invoice-customer.newest {
  color: #3b82f6;
}

.modal-invoice-id {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
  text-align: left;
}

.modal-invoice-badge {
  font-size: 11px;
  background-color: #dbeafe;
  color: #3b82f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 35px;
  text-align: center;
  display: inline-block;
}

.modal-invoice-badge:empty {
  background-color: transparent;
  padding: 0;
}

/* Right section - status badge */
.modal-invoice-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 65px;
  justify-content: flex-end;
}

.modal-invoice-status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
  min-width: 65px;
  display: inline-block;
}

.modal-invoice-status-badge.success {
  background-color: #d1fae5;
  color: #059669;
}

.modal-invoice-status-badge.success i {
  font-size: 14px;
}

.modal-invoice-status-badge.warning {
  background-color: #fee2e2;
  color: #dc2626;
}

/* Modal Pagination */
.modal-pagination {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pagination-btn {
  background-color: #f3f4f6;
  color: #374151;
  border: 1px solid #d1d5db;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 36px;
}

.pagination-btn:hover:not(:disabled) {
  background-color: #e5e7eb;
  border-color: #9ca3af;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: #f9fafb;
}

.pagination-btn i {
  font-size: 14px;
}

.pagination-info {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  flex: 1;
  white-space: nowrap;
}

/* Responsive pagination */
@media (max-width: 480px) {
  .pagination-controls {
    gap: 8px;
  }

  .pagination-btn {
    width: 100%;
  }

  .pagination-info {
    width: 100%;
    order: -1;
  }
}

/* ====================== RESPONSIVE ====================== */

@media (min-width: 640px) {
  .product-list-style {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .product-list-style {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .customer-search {
    align-items: center;
    justify-content: center;
  }

  .customer-search input {
    max-width: none;
    width: 180px;
  }

  .customer-search button {
    margin-left: 0;
  }

  .customer-details h4 {
    font-size: small;
  }

  .service-item-name,
  .product-item-name {
    font-size: small;
  }

  .service-list,
  .product-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .selected-service-name {
    font-size: small;
  }

  .selected-service-staff,
  .selected-service-quantity {
    font-size: x-small;
  }

  #addInvoiceTab,
  .invoice-tab {
    font-size: x-small;
    margin: 2px;
  }

  .modal-all-tabs-item {
    font-size: small;
  }
}

@media (max-width: 640px) {
  .service-list,
  .product-list {
    grid-template-columns: 1fr;
  }

  .customer-photos {
    grid-template-columns: repeat(3, 1fr);
  }

  .customer-photo-actions {
    gap: 3px;
  }

  .customer-photo-actions button {
    padding: 5px 8px;
    font-size: small;
  }

  .payment-actions button {
    width: 100%;
  }
}
