/* Demos (Holodeck) page — extends styles.css (tokens + shell already defined there).
   Content styling below is adapted from the Holodeck UI mockup; kept close to the
   original so it stays recognizable, with its own --hd-* palette rather than the
   site's indigo/violet so it's easy to tell apart and re-theme later if wanted. */

:root {
  --hd-brand: #2952e3;
  --hd-brand-dark: #1e3fb8;
  --hd-brand-light: #eef2ff;
  --hd-card: #ffffff;
  --hd-border: #e5e8f0;
  --hd-text: #161b33;
  --hd-muted: #6b7280;
  --hd-muted-2: #9298a8;
  --hd-green: #1fa35a;
  --hd-green-bg: #e8f8ef;
  --hd-red: #dc3b34;
  --hd-red-bg: #fdecec;
  --hd-grey: #8b92a3;
  --hd-grey-bg: #eef0f4;
  --hd-yellow: #c98a00;
  --hd-yellow-bg: #fdf3dc;
  --hd-radius: 10px;
  --hd-shadow: 0 1px 2px rgba(16,24,64,0.04), 0 4px 16px rgba(16,24,64,0.05);
}

.demos-page {
  max-width: 1240px;
  font-family: 'Inter', 'Nunito Sans', system-ui, sans-serif;
  color: var(--hd-text);
}

/* Header (mirrors .cap-header's sizing so both pages share one "shape") */
.hd-header { position: relative; padding-right: 210px; }
.hd-header h1 { font-family: 'Quicksand', sans-serif; font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; color: var(--hd-text); }
.hd-header .hd-subtitle { font-family: 'Quicksand', sans-serif; font-size: 15px; font-weight: 700; margin: 0 0 8px; color: var(--hd-brand); }
.hd-header p { margin: 0 0 24px; color: var(--hd-muted); font-size: 14px; }

/* Purely decorative -- centered on the "Holodecks" title, so it sticks up
   above it rather than extending down toward the toolbar. Position is a
   tuned constant (not a computed center) with a few px of clearance on
   both ends: .content has overflow: hidden and only ~44px of padding
   above the header to work with, and the toolbar row (Claim Holodeck)
   must never be reached from below either -- both were real bugs earlier
   at wide viewports. */
.hd-holodeck-img {
  position: absolute;
  top: -38px;
  /* The source PNG has ~66px of transparent margin baked in on its right
     edge (out of 1024px tall) -- at this display height that's ~9px of
     invisible space, enough to make the visible artwork read as short of
     the buttons/tables' right edge instead of flush with it. */
  right: -9px;
  height: 136px;
  width: auto;
  object-fit: contain;
}

/* Page toolbar: legend + claim action (mirrors .cap-toolbar's layout) */
.hd-page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.hd-actions { display: flex; align-items: center; gap: 10px; }

select.hd-type-select {
  appearance: none; -webkit-appearance: none;
  background: var(--hd-card) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" stroke="%236B7280" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 12px center;
  border: 1px solid var(--hd-border); border-radius: 8px;
  padding: 11px 34px 11px 14px; font-size: 14px; font-weight: 500; color: var(--hd-text);
  cursor: pointer; font-family: inherit;
}

.hd-btn {
  border: none; border-radius: 10px; padding: 11px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
  transition: background .12s ease, box-shadow .12s ease, transform .08s ease;
}
.hd-btn:active { transform: scale(0.97); }
.hd-btn-primary { background: var(--hd-brand); color: #fff; box-shadow: 0 1px 2px rgba(41,82,227,0.25); }
.hd-btn-primary:hover { background: var(--hd-brand-dark); }
.hd-btn-secondary { background: var(--hd-card); color: var(--hd-text); border: 1px solid var(--hd-border); }
.hd-btn-secondary:hover { background: #fafbfd; }
.hd-btn:disabled { opacity: .5; cursor: not-allowed; }
.hd-btn:disabled:hover { background: var(--hd-brand); }
.hd-btn:disabled:active { transform: none; }
.hd-btn-danger { background: var(--hd-red); color: #fff; }
.hd-btn-danger:hover { background: #b8302a; }

/* Legend — compact, sits top-right beside the actions */
.hd-legend {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--hd-muted);
}
.hd-legend-item { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.hd-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.hd-dot.available { background: var(--hd-green); box-shadow: 0 0 0 3px var(--hd-green-bg); }
.hd-dot.in_use { background: var(--hd-red); box-shadow: 0 0 0 3px var(--hd-red-bg); }
.hd-dot.maintenance { background: var(--hd-yellow); box-shadow: 0 0 0 3px var(--hd-yellow-bg); }
.hd-dot.broken { background: var(--hd-grey); box-shadow: 0 0 0 3px var(--hd-grey-bg); }

/* Section */
.hd-section { margin-bottom: 34px; }
.hd-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; gap: 10px; }
.hd-section-title { display: flex; align-items: center; gap: 10px; }
.hd-section-title h2 { font-family: 'Quicksand', sans-serif; font-size: 16px; font-weight: 700; margin: 0; }
.hd-count-pill { background: var(--hd-grey-bg); color: var(--hd-muted); font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }

.hd-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hd-search-input {
  border: 1px solid var(--hd-border); border-radius: 8px; padding: 8px 12px 8px 32px;
  font-size: 13.5px; font-family: inherit; width: 200px; color: var(--hd-text);
  background: var(--hd-card) no-repeat 10px center / 14px 14px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="%239298A8" stroke-width="2"><circle cx="11" cy="11" r="7"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>');
}
.hd-search-input:focus { outline: none; border-color: var(--hd-brand); }
select.hd-mini-select {
  appearance: none; -webkit-appearance: none;
  background: var(--hd-card) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path d="M1 1l4 4 4-4" stroke="%236B7280" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"/></svg>') no-repeat right 10px center;
  border: 1px solid var(--hd-border); border-radius: 8px; padding: 8px 28px 8px 11px;
  font-size: 13.5px; font-family: inherit; color: var(--hd-text); cursor: pointer;
}

/* Table */
.hd-card { background: var(--hd-card); border: 1px solid var(--hd-border); border-radius: var(--hd-radius); box-shadow: var(--hd-shadow); overflow-x: auto; }
.hd-card table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 980px; }
.hd-card thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--hd-muted-2); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--hd-border);
  background: #fbfcfe; white-space: nowrap;
}
.hd-card tbody tr { border-bottom: 1px solid var(--hd-border); transition: background .1s; }
.hd-card tbody tr:last-child { border-bottom: none; }
.hd-card tbody tr:hover { background: #fafbff; }
.hd-card td { padding: 12px 16px; vertical-align: middle; color: var(--hd-text); }
.hd-num-chip { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--hd-muted); background: var(--hd-grey-bg); border-radius: 6px; padding: 3px 7px; font-size: 12.5px; }
.hd-owner-sub { display: block; font-size: 10px; font-weight: 600; color: var(--hd-muted); margin-top: 4px; text-align: left; white-space: nowrap; }
.hd-name-cell b { font-weight: 600; font-size: 14px; }
.hd-type-tag { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: var(--hd-brand); background: var(--hd-brand-light); padding: 1px 7px; border-radius: 5px; }
.hd-desc-cell { color: var(--hd-muted); max-width: 260px; }
.hd-meta-cell b { display: block; font-weight: 600; font-size: 13px; }
.hd-meta-cell span { display: block; color: var(--hd-muted); font-size: 12px; margin-top: 1px; }
.hd-status-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.hd-status-cell .hd-dot { width: 9px; height: 9px; }
.hd-status-available { color: var(--hd-green); }
.hd-status-in_use { color: var(--hd-red); }
.hd-status-maintenance { color: var(--hd-yellow); }
.hd-status-broken { color: var(--hd-grey); }
.hd-ttl-cell b { display: block; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.hd-ttl-cell span { display: block; font-size: 11.5px; color: var(--hd-muted); margin-top: 1px; }
.hd-ttl-cell.hd-ttl-ok b { color: var(--hd-text); }
.hd-ttl-cell.hd-ttl-warn b { color: var(--hd-yellow); }
.hd-ttl-cell.hd-ttl-urgent b { color: var(--hd-red); }
.hd-ttl-cell.hd-ttl-paused b { color: var(--hd-muted-2); }
.hd-links-cell { display: flex; flex-direction: column; gap: 5px; }
.hd-link-line { display: flex; flex-direction: column; text-decoration: none; line-height: 1.25; }
.hd-link-line .hd-link-label { font-size: 11px; font-weight: 700; color: var(--hd-muted); text-transform: uppercase; letter-spacing: .03em; }
.hd-link-line .hd-link-url { font-size: 11.5px; color: var(--hd-brand); font-family: 'SFMono-Regular', Consolas, monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.hd-link-line:hover .hd-link-url { text-decoration: underline; }
.hd-row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hd-icon-btn {
  border: 1px solid var(--hd-border); background: var(--hd-card); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; font-weight: 600; color: var(--hd-text); cursor: pointer;
  white-space: nowrap; font-family: inherit; transition: background .12s ease, transform .08s ease;
}
.hd-icon-btn:hover { background: #f3f5f9; }
.hd-icon-btn:active { transform: scale(0.96); }
.hd-empty-my { padding: 28px; text-align: center; color: var(--hd-muted); font-size: 13.5px; }

/* Modal */
.hd-modal-overlay {
  position: fixed; inset: 0; background: rgba(15,20,40,0.45); display: none;
  align-items: center; justify-content: center; z-index: 100;
}
.hd-modal-overlay.open { display: flex; }
.hd-modal { background: var(--hd-card); border-radius: 14px; width: 420px; max-width: 90vw; padding: 26px; box-shadow: 0 20px 60px rgba(10,15,40,0.25); }
.hd-modal h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; font-family: 'Quicksand', sans-serif; }
.hd-modal p.hd-sub { margin: 0 0 18px; color: var(--hd-muted); font-size: 13.5px; }
.hd-field { margin-bottom: 16px; }
.hd-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--hd-muted); margin-bottom: 6px; }
.hd-field input[type="text"], .hd-field textarea {
  width: 100%; border: 1px solid var(--hd-border); border-radius: 8px;
  padding: 10px 12px; font-size: 13.5px; font-family: inherit; color: var(--hd-text); box-sizing: border-box;
}
.hd-field textarea { resize: vertical; min-height: 64px; }
.hd-field input[type="text"]:focus, .hd-field textarea:focus { outline: none; border-color: var(--hd-brand); }
.hd-modal-tag { display: inline-block; font-size: 11.5px; font-weight: 700; color: var(--hd-brand); background: var(--hd-brand-light); padding: 2px 8px; border-radius: 5px; margin-bottom: 10px; }
.hd-modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.hd-checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--hd-text); margin: 16px 0 4px; cursor: pointer; }
.hd-checkbox-row input { width: 16px; height: 16px; accent-color: var(--hd-brand); cursor: pointer; }
.hd-warning-text { color: var(--hd-red); font-weight: 600; background: var(--hd-red-bg); padding: 10px 12px; border-radius: 8px; margin: 0 0 6px; }

.hd-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--hd-text); color: #fff; padding: 12px 20px; border-radius: 9px; font-size: 13.5px;
  font-weight: 500; opacity: 0; transition: all .25s ease; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  display: flex; align-items: center; gap: 10px;
}
.hd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hd-toast .hd-dot { background: var(--hd-green); width: 8px; height: 8px; }

@media (max-width: 720px) {
  .hd-desc-cell { display: none; }
}
