
/* =========================================
   CORPORATE GIFT CATALOGUE
   Main visual styling
========================================= */

:root {
  --background: #f7f8fa;
  --surface: #ffffff;
  --text: #202936;
  --muted: #788392;
  --border: #e5e9ef;
  --accent: #263e5c;
  --accent-light: #edf2f7;
  --hover: #f8fafc;
  --success: #247a52;
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* MAIN PAGE */

.catalogue-container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 36px 30px;
}

/* PAGE HEADER */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.8px;
  margin-bottom: 9px;
}

.page-header h1 {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.8px;
  color: #182536;
  margin-bottom: 7px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
}

/* TABLE SECTION */

.table-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(25, 40, 60, 0.035);
}

/* TABLE TOOLBAR */

.table-toolbar {
  min-height: 52px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

#record-count {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.table-hint {
  font-size: 12px;
  color: var(--muted);
}

/* TABLE WRAPPER */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: #cbd2dc #f3f5f8;
}

/* TABLE */

#catalogue-table {
  width: 100%;
  min-width: 1650px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

/* COLUMN WIDTHS */

#catalogue-table th:nth-child(1) { width: 190px; }
#catalogue-table th:nth-child(2) { width: 260px; }
#catalogue-table th:nth-child(3) { width: 180px; }
#catalogue-table th:nth-child(4) { width: 145px; }
#catalogue-table th:nth-child(5) { width: 115px; }
#catalogue-table th:nth-child(6) { width: 145px; }
#catalogue-table th:nth-child(7) { width: 115px; }
#catalogue-table th:nth-child(8) { width: 150px; }
#catalogue-table th:nth-child(9) { width: 190px; }
#catalogue-table th:nth-child(10) { width: 115px; }
#catalogue-table th:nth-child(11) { width: 165px; }

/* TABLE HEADINGS */

#catalogue-table thead th {
  background: #f5f7fa;
  color: #536174;
  font-size: 11px;
  font-weight: 700;
  text-align: left;
  padding: 15px 12px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #edf0f4;
  vertical-align: middle;
  line-height: 1.5;
  white-space: normal;
  position: sticky;
  top: 0;
  z-index: 2;
}

#catalogue-table thead th:last-child {
  border-right: none;
}

/* TABLE CELLS */

#catalogue-table tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid #edf0f4;
  border-right: 1px solid #f0f2f5;
  vertical-align: middle;
  color: var(--text);
  font-size: 12px;
  overflow-wrap: anywhere;
}

#catalogue-table tbody td:last-child {
  border-right: none;
}

#catalogue-table tbody tr {
  background: #ffffff;
  transition: background 0.15s ease;
}

#catalogue-table tbody tr:hover {
  background: var(--hover);
}

#catalogue-table tbody tr:last-child td {
  border-bottom: none;
}

/* PRODUCT NAME */

.item-name {
  font-weight: 600;
  color: #26384e;
  line-height: 1.5;
}

/* DESCRIPTION */

.item-description {
  color: #697586;
  line-height: 1.65;
}

/* IMAGE PREVIEW AREA */

.picture-cell {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-height: 65px;
}

.picture-thumbnail {
  width: 49px;
  height: 49px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.picture-thumbnail:hover {
  transform: scale(1.06);
}

.picture-more {
  width: 49px;
  height: 49px;
  border-radius: 6px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* EDITABLE CELLS */

.editable {
  min-height: 35px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  outline: none;
  cursor: text;
  transition: border 0.15s ease, background 0.15s ease;
}

.editable:hover {
  background: #f7f9fc;
  border-color: #e1e6ed;
}

.editable:focus {
  background: #ffffff;
  border-color: #7895b5;
  box-shadow: 0 0 0 2px rgba(64, 108, 157, 0.09);
}

/* INPUTS AND SELECTS */

.cell-input,
.cell-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #ffffff;
  padding: 7px;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  outline: none;
}

.cell-input:focus,
.cell-select:focus {
  border-color: #7895b5;
  box-shadow: 0 0 0 2px rgba(64, 108, 157, 0.09);
}

/* CATEGORY TAGS */

.category-tag {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 5px;
  background: #edf2f7;
  color: #334b67;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.category-checkbox {
  accent-color: #16a34a;
}

.remove-checkbox {
  accent-color: #dc2626;
}

/* CALCULATED VALUES */

.calculated-value {
  font-weight: 600;
  color: #354c67;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cost-value {
  font-weight: 700;
  color: #263e5c;
  white-space: nowrap;
}
.category-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 15px 0;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #334155;
}

.category-guide strong {
  color: #16a34a;
  font-weight: 700;
}
.page-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gift-icon {
  stroke: url(#giftGradient);
  flex-shrink: 0;
}

/* Items marked for removal */
tr.item-marked-for-removal {
  opacity: 0.35;
  background-color: #fee2e2;
  transition: opacity 0.25s ease, background-color 0.25s ease;
}

tr.item-marked-for-removal td {
  color: #9ca3af;
}

tr.item-marked-for-removal .total-cost {
  color: #dc2626;
  font-weight: 700;
}

/* CHECKBOX */

.remove-checkbox {
  width: 17px;
  height: 17px;
  accent-color: #dc2626;
  cursor: pointer;
}

/* TABLE FOOTER */

.table-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 35px;
  padding: 18px 22px;
  background: #f7f9fb;
  border-top: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

#grand-total {
  color: var(--accent);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

/* IMAGE PREVIEW DIALOG */

#image-dialog {
  width: min(850px, 92vw);
  max-height: 90vh;
  margin: auto;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.22);
}

#image-dialog::backdrop {
  background: rgba(15, 24, 38, 0.68);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 22px;
  border-bottom: 1px solid var(--border);
}

.dialog-header h2 {
  font-size: 15px;
  font-weight: 600;
}

#close-dialog {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f0f2f5;
  color: #39485a;
  font-size: 23px;
  cursor: pointer;
}

.preview-content {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 20px;
}

#preview-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#preview-media img,
#preview-media video {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
  border-radius: 5px;
}

#previous-image,
#next-image {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  font-size: 15px;
}

#image-counter {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 0 18px;
}

/* RESPONSIVE DESIGN */

@media (max-width: 768px) {
  .catalogue-container {
    padding: 22px 12px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .subtitle {
    max-width: 300px;
    font-size: 12px;
  }

  .table-toolbar {
    align-items: flex-start;
    gap: 10px;
    flex-direction: column;
  }

  .table-footer {
    padding: 15px;
  }

  .preview-content {
    min-height: 250px;
    padding: 12px;
  }
}
/* Add another gift item row */

.add-item-row td {
  padding: 14px;
  text-align: left;
  background: #ffffff;
}

.add-item-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: none;
  border-radius: 7px;
  background: linear-gradient(
    110deg,
    #ef4444 0%,
    #9333ea 50%,
    #f97316 100%
  );
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.add-item-btn:hover {
  background: linear-gradient(
    110deg,
    #dc2626 0%,
    #7e22ce 50%,
    #ea580c 100%
  );
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(147, 51, 234, 0.2);
}


.editable-field {
  width: 100%;
  min-width: 140px;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #ffffff;
  color: #1f2937;
  font-family: inherit;
  font-size: 13px;
  box-sizing: border-box;
}

.editable-field:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.12);
}

.description-input {
  min-width: 220px;
  min-height: 75px;
  resize: vertical;
  line-height: 1.5;
}

.editable-field {
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  font: inherit;
  color: inherit;
  width: 100%;
  padding: 0;
  margin: 0;
}

.editable-field:focus {
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
}

.add-item-icon {
  font-size: 21px;
  line-height: 1;
  font-weight: 400;
}

/* Remove checkbox and permanent delete button */
.remove-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.delete-item-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff1f2;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-item-btn:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  transform: scale(1.05);
}
.editable-heading {
  font: inherit;
  color: inherit;
  font-weight: inherit;
  font-size: inherit;
  background: transparent;
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  width: auto;
  max-width: 100%;
  min-width: 0;
  cursor: text;
}

.editable-heading:focus {
  outline: none;
  border: none;
  box-shadow: none;
}
.last-heading-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.add-column-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffc917 0%, #ea3370 50%, #9e16f9 100%);
  color: #ffffff;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.2s ease;
}

.add-column-btn:hover {
  background: #4dff35;
  transform: scale(1.1);
}

/* CUSTOM COLUMN SETUP WINDOW */

.column-dialog {
  width: min(440px, 92%);
  border: 1px solid rgba(0, 217, 255, 0.35);
  border-radius: 16px;
  padding: 25px;
  background: #101820;
  color: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.column-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
}

.column-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
}

.column-dialog-header h2 {
  font-size: 21px;
  margin: 0;
}

#close-column-dialog {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
}

#column-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#column-form label {
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
}

#column-form input,
#column-form select,
#column-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #34434d;
  border-radius: 8px;
  background: #192630;
  color: #fff;
  font: inherit;
}

#column-form input:focus,
#column-form select:focus,
#column-form textarea:focus {
  outline: 1px solid #00d9ff;
}

.column-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.column-dialog-actions button {
  padding: 11px 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

#cancel-column {
  background: #293943;
  color: #fff;
}

.save-column-btn {
  background: linear-gradient(135deg, #00d9ff, #9bff35);
  color: #050505;
}

.custom-column-input {
  min-width: 110px;
  width: 100%;
  box-sizing: border-box;
}

#choice-options-container[hidden] {
  display: none;
}

/* =========================================
   EXPANDING CATALOGUE TABLE
========================================= */

/* Allow the table to scroll horizontally */
.table-scroll-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
}

/* Allow the table to grow as columns are added */
#catalogue-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

/* Give every column enough room */
#catalogue-table th,
#catalogue-table td {
  min-width: 150px;
  white-space: normal;
  vertical-align: top;
}

/* Keep description columns readable */
#catalogue-table th:nth-child(2),
#catalogue-table td:nth-child(2) {
  min-width: 250px;
}

/* Keep item names readable */
#catalogue-table th:nth-child(1),
#catalogue-table td:nth-child(1) {
  min-width: 220px;
}

/* Give custom columns a comfortable width */
#catalogue-table th:nth-child(n+12),
#catalogue-table td:nth-child(n+12) {
  min-width: 180px;
}

/* Make custom inputs fill their columns */
#catalogue-table .custom-column-input,
#catalogue-table select {
  width: 100%;
  min-width: 140px;
  box-sizing: border-box;
}

/* Make currency inputs comfortable */
#catalogue-table input[type="number"].custom-column-input {
  min-width: 140px;
}

/* =====================================
   EXPANDABLE CATALOGUE TABLE
===================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  position: relative;
  isolation: isolate;
}

#catalogue-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

#catalogue-table th,
#catalogue-table td {
  min-width: 160px;
  white-space: normal;
}

/* Give the Item Name column enough room */
#catalogue-table th:first-child,
#catalogue-table td:first-child {
  min-width: 240px;
  width: 240px;
}

/* Allow long item names to wrap onto multiple lines */
#catalogue-table .item-name-input {
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* =====================================
   STICKY ITEM NAME COLUMN
===================================== */

/* Keep Item Name visible while scrolling horizontally */

#catalogue-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: #f5f7fa;
  min-width: 240px;
  box-shadow: 5px 0 10px rgba(0, 0, 0, 0.08);
}

#catalogue-table tbody tr:not(.add-item-row) td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #ffffff;
  min-width: 240px;
  box-shadow: 5px 0 10px rgba(0, 0, 0, 0.08);
}

/* Preserve the hover appearance */

#catalogue-table tbody tr:hover td:first-child {
  background: #f8fafc;
}

/* Preserve the removal appearance */

#catalogue-table tbody tr.item-marked-for-removal td:first-child {
  background: #fee2e2;
}

/* =====================================
   CUSTOM CURRENCY INPUT
===================================== */

.custom-currency-cell {
  min-width: 150px;
}

.custom-currency-input {
  width: 100%;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
}
/* PICTURE UPLOAD AND THUMBNAILS */

.picture-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 110px;
}

.picture-thumbnail-wrapper {
  position: relative;
  width: 49px;
  height: 49px;
}

.picture-thumbnail {
  width: 49px;
  height: 49px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ccc;
  cursor: pointer;
}

.picture-thumbnail:hover {
  transform: scale(1.06);
}

.picture-upload-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px dashed #777;
  border-radius: 6px;
  font-size: 24px;
  cursor: pointer;
  color: #555;
  background: #f7f7f7;
}

.picture-upload-btn:hover {
  background: #e8f4ff;
  border-color: #1685d5;
}

.picture-upload-btn:has(input:disabled) {
  opacity: 0.5;
  cursor: wait;
}

.remove-picture-btn {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 19px;
  height: 19px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #d93025;
  color: white;
  font-size: 15px;
  line-height: 19px;
  cursor: pointer;
}

.remove-picture-btn:hover {
  background: #a91e16;
}

#preview-media img {
  max-width: 100%;
  max-height: 65vh;
  object-fit: contain;
}
