/* ============================================================
   DANZFLO — Product Specifications (Merch)
   ============================================================ */

.specs-page {
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 0% 0%, rgba(37, 99, 235, 0.06), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(236, 72, 153, 0.05), transparent 50%),
    var(--bg, #f8fafc);
}

.specs-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, #000 0%, transparent 70%);
}

.specs-page > * {
  position: relative;
  z-index: 1;
}

/* ---- Header ---- */
.specs-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.specs-page-badge {
  display: inline-flex;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #db2777;
  background: rgba(236, 72, 153, 0.1);
  border: 1px solid rgba(236, 72, 153, 0.18);
  border-radius: 9999px;
}

.specs-page-title {
  margin-top: 0.625rem;
  font-size: clamp(1.375rem, 2.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.specs-page-subtitle {
  margin-top: 0.375rem;
  font-size: 0.875rem;
  color: var(--muted, #64748b);
}

.specs-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.125rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.specs-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
}

/* ---- Panel ---- */
.specs-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-lg, 1rem);
  box-shadow:
    0 4px 24px rgba(15, 23, 42, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  overflow: hidden;
}

.specs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.9));
}

.specs-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

.specs-search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

.specs-search-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.875rem 0 2.5rem;
  font-size: 0.875rem;
  color: var(--text, #0f172a);
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.specs-search-input:focus {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.specs-count {
  font-size: 0.8125rem;
  color: var(--muted, #64748b);
}

/* ---- Table ---- */
.specs-table-wrap {
  padding: 1rem;
}

.specs-table-inner {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.875rem;
}

.specs-table {
  width: 100%;
  min-width: 780px;
  border-collapse: separate;
  border-spacing: 0;
}

.specs-table th {
  padding: 1rem 1.125rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted, #64748b);
  background: rgba(241, 245, 249, 0.95);
  border-bottom: 1px solid var(--border, #e2e8f0);
  white-space: nowrap;
}

.specs-table th.text-center { text-align: center; }
.specs-table th.text-right { text-align: right; }
.specs-table td.text-center { text-align: center; }

.specs-table thead tr:first-child th:first-child {
  border-top-left-radius: calc(0.875rem - 1px);
}

.specs-table thead tr:first-child th:last-child {
  border-top-right-radius: calc(0.875rem - 1px);
}

.specs-table td {
  padding: 1rem 1.125rem;
  font-size: 0.875rem;
  color: var(--text, #0f172a);
  border-bottom: 1px solid rgba(226, 232, 240, 0.85);
  vertical-align: middle;
}

.specs-table tbody tr:last-child td {
  border-bottom: none;
}

.specs-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.025);
}

.specs-row.hidden-by-search {
  display: none;
}

.specs-name {
  font-weight: 600;
  white-space: nowrap;
}

.specs-type-badge {
  display: inline-flex;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
}

.specs-attrs-cell {
  max-width: 420px;
  font-size: 0.8125rem;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.specs-filter-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: #fff;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 9999px;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.specs-filter-yes svg {
  width: 0.9375rem;
  height: 0.9375rem;
}

.specs-filter-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  color: #94a3b8;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 9999px;
}

.specs-filter-no svg {
  width: 0.875rem;
  height: 0.875rem;
}

.specs-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.specs-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.specs-action-btn svg {
  width: 1rem;
  height: 1rem;
}

.specs-action-btn--delete {
  color: #ef4444;
}

.specs-action-btn--delete:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.35);
}

.specs-action-btn--edit {
  color: #2563eb;
}

.specs-action-btn--edit:hover {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.35);
}

/* ---- Modal base ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
  overflow: hidden;
  animation: specs-modal-in 0.25s ease;
}

@keyframes specs-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.specs-modal {
  max-width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 1.35rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  line-height: 1;
  color: #94a3b8;
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text, #0f172a);
  background: #f1f5f9;
}

.modal-body,
.specs-modal-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}

.form-group {
  margin-bottom: 1.125rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text, #0f172a);
}

.form-input {
  width: 100%;
  height: 2.625rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  color: var(--text, #0f172a);
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.625rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.form-input:hover {
  background: #fff;
}

.form-input:focus {
  background: #fff;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.125rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 0.625rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.modal-btn--text {
  color: var(--text, #0f172a);
  background: transparent;
}

.modal-btn--text:hover {
  background: #e2e8f0;
}

.modal-btn--dark {
  color: #fff;
  background: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.modal-btn--dark:hover {
  background: #1e293b;
}

.modal-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.modal-btn--primary:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* ---- Checkbox ---- */
.specs-check {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  cursor: pointer;
  user-select: none;
}

.specs-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.specs-check-box {
  width: 1.125rem;
  height: 1.125rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 0.3125rem;
  background: #fff;
  position: relative;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.specs-check input:checked + .specs-check-box {
  background: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
}

.specs-check input:checked + .specs-check-box::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.specs-check-text {
  font-size: 0.8125rem;
  color: var(--muted, #64748b);
}

.specs-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  font-size: 0.625rem;
  font-weight: 700;
  color: #fff;
  background: #3b82f6;
  border-radius: 9999px;
  cursor: help;
}

/* ---- Attribute rows ---- */
.specs-attr-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.specs-attr-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.specs-attr-row .form-input {
  flex: 1;
}

.specs-attr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1;
  color: var(--text, #0f172a);
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.specs-attr-btn:hover {
  background: #f1f5f9;
}

.specs-attr-btn--add:hover {
  color: #2563eb;
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.06);
}

.specs-attr-btn--remove:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

/* ---- Categories ---- */
.specs-cat-field {
  position: relative;
  width: 100%;
}

.specs-cat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.specs-cat-tags:empty {
  display: none;
  margin: 0;
}

.specs-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #1e40af;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 0.375rem;
}

.specs-cat-tag button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  padding: 0;
  font-size: 0.875rem;
  line-height: 1;
  color: #64748b;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
}

.specs-cat-tag button:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.specs-cat-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 2.625rem;
  padding: 0 0.875rem;
  font-size: 0.875rem;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.specs-cat-trigger svg {
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
}

.specs-cat-trigger[aria-expanded='true'],
.specs-cat-field.open .specs-cat-trigger {
  color: var(--text, #0f172a);
  background: #fff;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.specs-cat-dropdown {
  position: fixed;
  z-index: 100;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.specs-cat-dropdown[hidden] {
  display: none;
}

.specs-cat-tree {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 0.5rem;
}

.specs-cat-header {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  background: #f8fafc;
  border-radius: 0.5rem;
}

.specs-cat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.5rem;
  border-radius: 0.4375rem;
  cursor: pointer;
}

.specs-cat-item:hover {
  background: #f8fafc;
}

.specs-cat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  padding: 0;
  color: #94a3b8;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  cursor: pointer;
  flex-shrink: 0;
}

.specs-cat-toggle svg {
  width: 0.75rem;
  height: 0.75rem;
  transition: transform 0.15s ease;
}

.specs-cat-item[data-expanded='true'] .specs-cat-toggle svg {
  transform: rotate(90deg);
}

.specs-cat-spacer {
  width: 1.125rem;
  flex-shrink: 0;
}

.specs-cat-item input[type='checkbox'] {
  width: 0.9375rem;
  height: 0.9375rem;
  accent-color: var(--primary, #2563eb);
  cursor: pointer;
}

.specs-cat-item span {
  font-size: 0.8125rem;
  color: var(--text, #0f172a);
}

.specs-cat-children[hidden] {
  display: none;
}

.specs-cat-search-wrap {
  position: relative;
  padding: 0.625rem;
  border-top: 1px solid var(--border, #e2e8f0);
  background: #f8fafc;
}

.specs-cat-search {
  width: 100%;
  height: 2.25rem;
  padding: 0 2.25rem 0 0.75rem;
  font-size: 0.8125rem;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 0.5rem;
  outline: none;
}

.specs-cat-search:focus {
  border-color: var(--primary, #2563eb);
}

.specs-cat-search-icon {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

/* ---- Delete modal ---- */
.modal--delete {
  max-width: 320px;
  text-align: center;
}

.delete-modal-body {
  padding: 2rem 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.delete-modal-icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.delete-modal-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.delete-modal-desc {
  font-size: 0.8125rem;
  color: var(--muted, #64748b);
}

.delete-modal-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem 1.5rem;
}

@media (max-width: 639px) {
  .specs-table-wrap {
    padding: 0.75rem;
  }

  .specs-attrs-cell {
    max-width: 240px;
  }
}
