/* Jewelry Management - SBSS Portal Styling */

:root {
  --ink: #0f172a;
  --muted: #64748b;
  --bg: #f5f6fa;
  --card: #fff;
  --line: #e5e7eb;
  --action: #2563eb;
}

/* Layout */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

.jewelry-container,
.jewelry-detail-container,
.sales-container {
  width: 100%;
}

/* Headers */
.jewelry-header,
.sales-header,
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.jewelry-header h1,
.sales-header h1,
.detail-header h1 {
  font-size: 22px;
  margin: 0;
  color: var(--ink);
}

.detail-actions,
.sales-actions {
  display: flex;
  gap: 8px;
}

/* Filters */
.jewelry-filters,
.sales-filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.jewelry-filters input,
.jewelry-filters select,
.sales-filters input,
.sales-filters select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  appearance: none;
  outline: none;
  transition: border-color 0.2s;
}

.jewelry-filters input:focus,
.jewelry-filters select:focus,
.sales-filters input:focus,
.sales-filters select:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

@media (max-width: 768px) {
  .jewelry-filters,
  .sales-filters {
    grid-template-columns: 1fr;
  }
}

/* Stats */
.jewelry-stats,
.sales-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.stat-value {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

@media (max-width: 1024px) {
  .jewelry-stats,
  .sales-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .jewelry-stats,
  .sales-stats {
    grid-template-columns: 1fr;
  }
}

/* Tables */
.jewelry-table,
.sales-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.jewelry-table thead,
.sales-table thead,
.data-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.jewelry-table th,
.sales-table th,
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.jewelry-table td,
.sales-table td,
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.jewelry-table tbody tr:last-child td,
.sales-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: none;
}

.jewelry-table tbody tr:hover,
.sales-table tbody tr:hover {
  background: var(--bg);
}

.jewelry-table .empty,
.jewelry-table .loading,
.sales-table .empty,
.data-table .placeholder {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

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

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

.badge-rented {
  background: #dbeafe;
  color: #0c4a6e;
}

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

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

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

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

/* Buttons */
.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--action);
  color: #fff;
}

.btn-primary:hover {
  background: #1d4ed8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: #0b0d11;
  color: #fff;
  border: 1px solid #1f2937;
}

.btn-secondary:hover {
  background: #1f2937;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

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

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 12px;
  border-radius: 6px;
}

.btn.submit-like-input {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  background: var(--action);
  color: #fff;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn.submit-like-input:hover {
  background: #1d4ed8;
}

.btn.submit-like-input:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  overflow: auto;
}

.modal-content {
  background: var(--card);
  margin: 5% auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.modal-content.modal-lg {
  max-width: 800px;
}

.modal-content h2 {
  font-size: 18px;
  margin: 0 0 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.close {
  color: var(--muted);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.close:hover {
  color: var(--ink);
}

.modal-cancel {
  background: var(--line) !important;
  color: var(--ink) !important;
}

/* Forms */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.form-row.full {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  appearance: none;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--action);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-static {
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
}

/* Detail Views */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.detail-field {
  display: flex;
  flex-direction: column;
}

.detail-field label {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.detail-field > div {
  font-size: 14px;
  color: var(--ink);
  padding: 8px 0;
}

.detail-field.full-width {
  grid-column: 1 / -1;
}

/* Sections */
.detail-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  overflow-x: auto;
}

.detail-section h2 {
  font-size: 18px;
  margin: 0 0 12px;
  color: var(--ink);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

/* Images */
.images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.image-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}

.image-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.image-item .btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 0.3rem 0.6rem;
  font-size: 10px;
}

.image-item:hover .btn {
  opacity: 1;
}

.image-upload {
  display: flex;
  gap: 8px;
  align-items: center;
}

.image-upload input {
  flex: 1;
}

/* Timeline/Events */
.event-item {
  padding: 12px;
  background: var(--bg);
  border-left: 3px solid var(--action);
  margin-bottom: 8px;
  border-radius: 6px;
}

.event-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.event-type {
  font-weight: 600;
  color: var(--ink);
  text-transform: capitalize;
}

/* QBO Section */
.qbo-section {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.qbo-field {
  display: flex;
  flex-direction: column;
}

.qbo-field label {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

.checkbox-group input {
  width: auto;
  margin-right: 8px;
}

.checkbox-group label {
  margin: 0;
  font-weight: normal;
}

/* Responsive */
@media (max-width: 768px) {
  .jewelry-container,
  .jewelry-detail-container,
  .sales-container {
    padding: 0 8px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .detail-actions,
  .sales-actions {
    width: 100%;
  }

  .detail-actions .btn,
  .sales-actions .btn {
    width: 100%;
  }
}

/* Utility */
.hide {
  display: none !important;
}

.clickable {
  cursor: pointer;
  color: var(--action);
  text-decoration: none;
}

.clickable:hover {
  text-decoration: underline;
}

.placeholder {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}
