// =========================================
// PRODUCTS — Index
// =========================================

.pre {
  white-space: pre-line;
}

// =========================================
// PRODUCTS — Import (segmented control extra)
// =========================================

.import-seg .btn {
  min-width: 160px;
}

// =========================================
// PRODUCTS — Form (shared Add/Edit)
// =========================================

.product-form-page {
  .scan-icon {
    width: 43px;
    height: 34px;
    margin-right: 8px;
    cursor: pointer;
  }

  .form-section {
    margin-bottom: 2rem;
  }

  .section-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
  }

  .section-icon {
    font-size: 1.5rem;
    color: #667eea;
    margin-right: 0.75rem;
    width: 28px;
    text-align: center;
  }

  .section-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.3px;
  }

  .section-card {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;

    &:hover {
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    }
  }

  .form-control-modern {
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    padding: 0.625rem 0.875rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;

    &:focus {
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
  }

  .form-control-file {
    display: block;
    padding: 0.5rem 0;
    border-radius: 8px;
    cursor: pointer;
  }

  .image-upload-wrapper {
    background: #fafafa;
    padding: 1rem;
    border-radius: 8px;
    border: 2px dashed #d0d0d0;
    transition: all 0.2s ease;

    &:hover {
      border-color: #667eea;
      background: #f5f7ff;
    }
  }

  .modern-input-group {
    display: flex;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1.5px solid #e0e0e0;
  }

  .btn-icon-scan,
  .btn-icon-gen {
    background: #f5f5f5;
    border: none;
    padding: 0.625rem 0.875rem;
    color: #667eea;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
      background: #667eea;
      color: white;
    }
  }

  .table-modern {
    margin-bottom: 0;

    thead {
      background: #f8f9fa;
      border-bottom: 2px solid #e0e0e0;

      th {
        font-weight: 600;
        color: #333;
        padding: 1rem 0.875rem;
        text-transform: uppercase;
        font-size: 0.8rem;
        letter-spacing: 0.5px;
      }
    }

    tbody tr {
      border-bottom: 1px solid #f0f0f0;
      transition: background-color 0.2s ease;

      &:hover {
        background-color: #f9f9f9;
      }
    }

    td {
      padding: 1rem 0.875rem;
      vertical-align: middle;
    }
  }

  .variant-input-group {
    background: #f5f7ff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e0e8ff;
  }

  .combo-search {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
  }

  .autocomplete {
    position: relative;
  }

  .autocomplete-input {
    width: 100%;
    padding: 0.625rem 2.875rem;
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    font-size: 0.95rem;

    &:focus {
      outline: none;
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
  }

  .autocomplete-result-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .autocomplete-result {
    padding: 0.75rem 3rem;
    cursor: pointer;
    transition: background-color 0.15s ease;

    &:hover {
      background-color: #f5f7ff;
      color: #667eea;
    }
  }

  .badge-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
  }

  .badge-primary-light {
    background-color: #e0e8ff;
    color: #667eea;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-block;
    width: fit-content;
  }

  .combo-total {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
  }

  .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .total-label {
    font-weight: 600;
    color: #333;
    font-size: 1rem;
  }

  .total-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
  }

  .options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
  }

  .form-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .spinner-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
  }

  .sticky-sidebar {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
  }

  .summary-card,
  .help-card {
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .summary-title,
  .help-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
  }

  .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5f5f5;

    &:last-child {
      border-bottom: none;
    }
  }

  .summary-label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .summary-value {
    font-size: 1rem;
    font-weight: 700;
    color: #667eea;
  }

  .category-input-group,
  .brand-input-group,
  .unit-input-group {
    display: flex;
    align-items: stretch;

    .v-select {
      flex: 1 1 auto;
      min-width: 0;

      .vs__dropdown-toggle {
        border-top-right-radius: 0;
        border-bottom-right-radius: 0;
        height: 100%;
      }

      .vs__dropdown-toggle .vs__selected-options {
        height: 100%;
      }
    }
  }

  .category-add-btn,
  .brand-add-btn,
  .unit-add-btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    white-space: nowrap;
  }

  @media (max-width: 768px) {
    .sticky-sidebar {
      position: relative;
      top: 0;
    }

    .options-grid {
      grid-template-columns: 1fr;
    }
  }
}

// =========================================
// PRODUCTS — Shared utility classes
// =========================================

.product-qr-scanner {
  width: 100%;
  height: calc(100vh - 56px);
}

.product-th-action {
  width: 50px;
}

.product-th-img {
  width: 60px;
}

.product-category-icon {
  font-size: 22px;
}

// =========================================
// PRODUCTS — Barcode Page
// =========================================

.barcode-page {
  .barcode-container {
    padding: 0;
  }

  .config-card,
  .search-card,
  .products-card,
  .preview-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;

    &:hover {
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
      border-color: #d1d5db;
    }
  }

  .config-header,
  .search-header,
  .products-header,
  .preview-header {
    background: #f9fafb;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    border-radius: 8px 8px 0 0;

    h5 {
      color: #1f2937;
      font-weight: 600;
      font-size: 1rem;
      margin: 0;

      i {
        color: #8b5cf6;
        margin-right: 0.5rem;
      }
    }
  }

  .input-with-icon {
    display: flex;
    align-items: stretch;
    position: relative;
  }

  .scan-btn {
    background: #8b5cf6;
    border: 1px solid #7c3aed;
    color: white;
    padding: 0.625rem 1rem;
    border-radius: 6px 0 0 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;

    &:hover {
      background: #7c3aed;
      border-color: #6d28d9;
    }

    &:active {
      transform: scale(0.98);
    }

    i {
      font-size: 1.1rem;
    }
  }

  .modern-input {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid #d1d5db;
    border-left: none;
    border-radius: 0 6px 6px 0;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background: #ffffff;

    &:focus {
      outline: none;
      border-color: #8b5cf6;
      box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    }

    &::placeholder {
      color: #9ca3af;
    }
  }

  .autocomplete {
    position: relative;
  }

  .autocomplete-result-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -1px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .autocomplete-result {
    padding: 0.75rem 3rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9375rem;
    color: #374151;

    &:hover {
      background: #f9fafb;
      color: #1f2937;
    }

    &:last-child {
      border-bottom: none;
    }
  }

  .modern-table {
    margin-bottom: 0;
    border-collapse: separate;
    border-spacing: 0;

    thead th {
      background: #f9fafb;
      border-bottom: 1px solid #e5e7eb;
      font-weight: 600;
      color: #374151;
      padding: 0.875rem 1rem;
      font-size: 0.8125rem;
      text-transform: uppercase;
      letter-spacing: 0.025em;
    }

    tbody tr {
      transition: background-color 0.15s ease;
      border-bottom: 1px solid #f3f4f6;

      &:hover {
        background: #f9fafb;
      }

      &:last-child {
        border-bottom: none;
      }
    }

    tbody tr td.text-center.text-muted {
      padding: 2rem 1rem;
      font-size: 0.9375rem;

      i {
        font-size: 2rem;
        opacity: 0.3;
        margin-bottom: 0.5rem;
        display: block;
      }
    }
  }

  .product-row td {
    padding: 1rem;
    vertical-align: middle;
    font-size: 0.9375rem;
  }

  .product-name {
    font-weight: 500;
    color: #1f2937;
  }

  .product-code {
    color: #6b7280;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
  }

  .quantity-input {
    width: 90px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    font-size: 0.9375rem;

    &:focus {
      border-color: #8b5cf6;
      box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
      outline: none;
    }
  }

  .delete-btn {
    border: 1px solid #fee2e2;
    background: #fef2f2;
    color: #dc2626;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    border-radius: 6px;
    font-size: 0.875rem;

    &:hover {
      background: #fee2e2;
      border-color: #fecaca;
      color: #b91c1c;
    }
  }

  .modern-checkbox {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    transition: all 0.2s ease;

    &:hover {
      background: #f3f4f6;
      border-color: #d1d5db;
    }

    input[type="checkbox"] {
      margin-right: 0.75rem;
      width: 18px;
      height: 18px;
      cursor: pointer;
      accent-color: #8b5cf6;
    }
  }

  .checkbox-label {
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    font-size: 0.9375rem;
    user-select: none;
  }

  .action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .print-btn,
  .print-btn-large {
    background: #8b5cf6;
    border: 1px solid #7c3aed;
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;

    &:hover {
      background: #7c3aed;
      border-color: #6d28d9;
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
    }

    &:active {
      transform: translateY(0);
    }
  }

  .print-btn-large {
    padding: 0.625rem 1.5rem;
    font-size: 0.9375rem;
  }

  .badge {
    padding: 0.375em 0.75em;
    font-weight: 600;
    border-radius: 4px;
    font-size: 0.75rem;
  }

  .badge-primary {
    background: #ede9fe;
    color: #6d28d9;
  }

  .badge-info {
    background: #dbeafe;
    color: #1e40af;
  }

  .barcode-row {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
  }

  .form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }

  .card-body {
    padding: 1.5rem;
  }

  .loading_page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
  }

  .custom-dimensions-input {
    margin-top: 0.5rem;

    .form-control {
      border: 1px solid #d1d5db;
      border-radius: 6px;
      padding: 0.5rem 0.75rem;
      font-size: 0.9375rem;
      transition: all 0.2s ease;

      &:focus {
        border-color: #8b5cf6;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
        outline: none;
      }

      &:disabled {
        background-color: #f9fafb;
        border-color: #e5e7eb;
        color: #6b7280;
        cursor: not-allowed;
      }
    }

    small {
      display: block;
      margin-top: 0.25rem;
      font-size: 0.75rem;
      color: #6b7280;

      &.text-muted i {
        font-size: 0.875rem;
        margin-right: 0.25rem;
      }
    }
  }

  .v-select .vs__dropdown-toggle {
    border-color: #d1d5db;
    border-radius: 6px;
    padding: 0.5rem;

    &:focus-within {
      border-color: #8b5cf6;
      box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    }
  }

  .v-select.vs--open .vs__dropdown-toggle {
    border-color: #8b5cf6;
  }

  @media (max-width: 768px) {
    .action-buttons {
      flex-wrap: wrap;
      gap: 0.5rem;

      button {
        flex: 1;
        min-width: 120px;
      }
    }

    .scan-btn {
      min-width: 44px;
      padding: 0.625rem 0.875rem;
    }

    .products-header,
    .preview-header {
      flex-direction: column;
      align-items: flex-start !important;
      gap: 1rem;

      .d-flex {
        width: 100%;
        justify-content: space-between;
      }
    }
  }
}

// =========================================
// PRODUCTS — Barcode Print Head
// =========================================

.barcode-head-print {
  padding-left: 10px;
  font-weight: bold;
  font-size: 10px;
}
