/* ============================================================
   TOOTH ORDERING CHART — Shopify Theme Asset
   File: assets/tooth-chart.css
   ============================================================ */

:root {
  --tc-primary: #24356d;
  --tc-primary-light: #eceef5;
  --tc-primary-dark: #1a2850;
  --tc-accent: #ec6323;
  --tc-accent-light: #fef0e8;
  --tc-bg: #f8fafc;
  --tc-white: #ffffff;
  --tc-border: #e2e8f0;
  --tc-border-dark: #cbd5e1;
  --tc-text: #1e293b;
  --tc-text-muted: #64748b;
  --tc-text-light: #94a3b8;
  --tc-cell-empty: #f1f5f9;
  --tc-cell-hover: #eceef5;
  --tc-cell-selected: #ec6323;
  --tc-shadow: 0 4px 24px rgba(0,0,0,0.10);
  --tc-shadow-sm: 0 1px 4px rgba(0,0,0,0.07);
  --tc-radius: 10px;
  --tc-radius-sm: 6px;
}

/* ── Overlay & Modal ── */
#tc-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(3px);
  z-index: 9998;
  align-items: center;
  justify-content: center;
}
#tc-overlay.active { display: flex; }

#tc-modal {
  background: var(--tc-white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 95vw;
  max-width: 1100px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: tcSlideIn 0.22s cubic-bezier(.4,0,.2,1);
}
@keyframes tcSlideIn {
  from { opacity:0; transform:translateY(24px) scale(.97); }
  to   { opacity:1; transform:translateY(0) scale(1); }
}

/* ── Modal Header ── */
.tc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--tc-border);
  background: var(--tc-white);
  flex-shrink: 0;
}
.tc-modal-header h2 {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--tc-text);
  margin: 0;
}
.tc-modal-price-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.tc-crown-label {
  font-size: 0.85rem;
  color: var(--tc-text-muted);
  font-family: 'DM Sans', sans-serif;
}
.tc-total-price {
  font-family: 'DM Sans', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--tc-primary);
}
.tc-close-btn {
  background: var(--tc-cell-empty);
  border: none;
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
  font-size: 1.1rem;
  color: var(--tc-text-muted);
}
.tc-close-btn:hover { background: #fee2e2; color: #dc2626; }

/* ── Modal Body (left image + right chart) ── */
.tc-modal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left Panel */
.tc-left-panel {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--tc-border);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--tc-bg);
}
.tc-product-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--tc-radius);
  border: 1px solid var(--tc-border);
  background: #fff;
}
.tc-product-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--tc-text);
  line-height: 1.4;
}
.tc-report-link {
  font-size: 0.78rem;
  color: var(--tc-primary);
  text-decoration: none;
  font-family: 'DM Sans', sans-serif;
}
.tc-report-link:hover { text-decoration: underline; }

/* Right Panel */
.tc-right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Tabs + Search Bar ── */
.tc-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--tc-border);
  background: var(--tc-white);
  flex-shrink: 0;
  gap: 12px;
}
.tc-tabs {
  display: flex;
  gap: 0;
}
.tc-tab {
  padding: 13px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tc-text-muted);
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2.5px solid transparent;
  transition: color .15s, border-color .15s;
}
.tc-tab.active {
  color: var(--tc-primary);
  border-bottom-color: var(--tc-primary);
}
.tc-tab:hover:not(.active) { color: var(--tc-text); }

.tc-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--tc-bg);
  border: 1px solid var(--tc-border);
  border-radius: 8px;
  padding: 6px 12px;
  min-width: 200px;
}
.tc-search-wrap input {
  border: none;
  background: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.84rem;
  color: var(--tc-text);
  outline: none;
  width: 100%;
}
.tc-search-wrap input::placeholder { color: var(--tc-text-light); }
.tc-search-icon { color: var(--tc-text-light); font-size: 0.9rem; }

/* ── Chart Section Label ── */
.tc-section-label {
  padding: 10px 20px 6px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--tc-text);
  flex-shrink: 0;
}

/* ── Chart Scroll Area ── */
.tc-chart-scroll {
  flex: 1;
  overflow: auto;
  padding: 0 12px 16px;
}

/* ── Grid Table ── */
.tc-grid-table {
  border-collapse: separate;
  border-spacing: 3px;
  min-width: 700px;
  width: 100%;
}

/* Header row (shades) */
.tc-grid-table thead th {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--tc-text-muted);
  text-align: center;
  padding: 6px 4px;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--tc-white);
  z-index: 2;
}
.tc-grid-table thead th.tc-corner {
  min-width: 42px;
  vertical-align: middle;
  text-align: center;
  padding: 4px 3px;
  position: sticky;
  top: 0;
  background: var(--tc-white);
  z-index: 3;
}
.tc-mould-axis {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--tc-text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tc-shade-spanning {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--tc-text-muted);
  letter-spacing: 0.5px;
  text-align: center;
  padding: 4px 0 2px !important;
  position: sticky;
  top: 0;
  background: var(--tc-white);
  z-index: 2;
  border-bottom: none !important;
}
.tc-shade-header {
  background: var(--tc-bg);
  border-radius: 4px;
  padding: 5px 8px !important;
}

/* Mould label column */
.tc-mould-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tc-text);
  text-align: center;
  padding: 4px 8px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── Individual Cells ── */
.tc-cell {
  min-width: 72px;
  width: 72px;
  padding: 0;
  vertical-align: top;
  position: relative;
}
.tc-cell-inner {
  border-radius: var(--tc-radius-sm);
  border: 1.5px solid var(--tc-border);
  background: var(--tc-white);
  padding: 5px 5px 4px;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: relative;
}
.tc-cell-inner:hover {
  border-color: var(--tc-primary);
  background: var(--tc-primary-light);
  box-shadow: 0 2px 8px rgba(36,53,109,0.13);
  z-index: 10;
}
.tc-cell-inner.has-qty {
  border-color: var(--tc-cell-selected);
  background: var(--tc-primary-light);
}

.tc-cell-sku {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  color: var(--tc-primary-dark);
  font-weight: 600;
  line-height: 1.2;
}
.tc-cell-qty-input {
  width: 100%;
  border: 1px solid var(--tc-border-dark);
  border-radius: 4px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  padding: 2px 0;
  color: var(--tc-text);
  background: var(--tc-white);
  outline: none;
  transition: border-color .15s;
}
.tc-cell-qty-input:focus { border-color: var(--tc-primary); }
.tc-cell-qty-input.filled {
  background: var(--tc-cell-selected);
  color: #fff;
  border-color: var(--tc-cell-selected);
}

/* Empty cell */
.tc-cell-empty-inner {
  border-radius: var(--tc-radius-sm);
  background: var(--tc-cell-empty);
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tc-cell-empty-dash {
  color: var(--tc-text-light);
  font-size: 1rem;
}

/* ── Tooltip ── */
.tc-tooltip {
  display: none;
  position: fixed;
  z-index: 99999;
  background: var(--tc-white);
  border: 1.5px solid var(--tc-border);
  border-radius: 10px;
  box-shadow: var(--tc-shadow);
  padding: 12px;
  min-width: 180px;
  max-width: 220px;
  pointer-events: none;
}
.tc-tooltip.visible { display: block; }
.tc-tooltip img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 8px;
  border: 1px solid var(--tc-border);
}
.tc-tooltip-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tc-text);
  margin-bottom: 4px;
  line-height: 1.3;
}
.tc-tooltip-row {
  display: flex;
  justify-content: space-between;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.73rem;
  color: var(--tc-text-muted);
  margin-bottom: 2px;
}
.tc-tooltip-row span:last-child {
  font-weight: 700;
  color: var(--tc-text);
}

/* ── Modal Footer ── */
.tc-modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--tc-border);
  background: var(--tc-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}
.tc-selected-summary {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--tc-text-muted);
}
.tc-selected-summary strong {
  color: var(--tc-text);
  font-weight: 700;
}
.tc-footer-actions { display: flex; gap: 10px; }

.tc-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 22px;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.tc-btn:active { transform: scale(.97); }
.tc-btn-outline {
  background: var(--tc-bg);
  color: var(--tc-text);
  border: 1.5px solid var(--tc-border-dark);
}
.tc-btn-outline:hover { background: var(--tc-border); }
.tc-btn-primary {
  background: var(--tc-primary);
  color: #fff;
}
.tc-btn-primary:hover { background: var(--tc-primary-dark); }
.tc-btn-primary:disabled {
  background: var(--tc-text-light);
  cursor: not-allowed;
}

/* ── Trigger Button (on product page) ── */
.tc-trigger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--tc-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  margin-top: 12px;
}
.tc-trigger-btn:hover { background: var(--tc-primary-dark); }

/* ── Loading State ── */
.tc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  flex-direction: column;
  gap: 12px;
}
.tc-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--tc-border);
  border-top-color: var(--tc-primary);
  border-radius: 50%;
  animation: tcSpin .7s linear infinite;
}
@keyframes tcSpin { to { transform: rotate(360deg); } }
.tc-loading-text {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  color: var(--tc-text-muted);
}

/* ── Toast Notification ── */
.tc-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--tc-text);
  color: #fff;
  border-radius: 10px;
  padding: 14px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 99999;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tc-toast.show { opacity: 1; transform: translateY(0); }
.tc-toast.success { background: var(--tc-primary); }
.tc-toast.error { background: #dc2626; }

/* Demo/unlinked cell — shown but can't be ordered */
.tc-cell-inner.demo-cell {
  opacity: 0.65;
  border-style: dashed;
  border-color: var(--tc-border-dark);
}
.tc-cell-inner.demo-cell .tc-cell-sku {
  color: var(--tc-text-muted);
}
.tc-cell-inner.demo-cell:hover {
  border-color: var(--tc-text-muted);
  background: var(--tc-cell-empty);
}
  border-color: var(--tc-accent);
  background: var(--tc-accent-light);
}

/* Responsive */
@media (max-width: 768px) {
  #tc-modal { width: 100vw; max-height: 100dvh; border-radius: 0; }
  .tc-left-panel { display: none; }
  .tc-tabs-bar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .tc-search-wrap { min-width: 100%; }
}
