/* ============================================
   atomies-templates / style.css
   
   Base styles for the shell handles and
   each registered template type.
   
   Import this in any host project. Override
   the custom properties to match your theme.
   ============================================ */

/* ── Theme tokens (override these in your app) ── */
:root {
  --at-bg:          #1a1a20;
  --at-border:      #2a2a32;
  --at-border-sel:  #e84030;
  --at-text:        #e8e6e2;
  --at-text-sec:    #9a98a0;
  --at-text-dim:    #5a5862;
  --at-accent:      #e84030;
  --at-accent-glow: rgba(232, 64, 48, 0.12);
  --at-mono:        'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --at-sans:        'DM Sans', system-ui, sans-serif;
}


/* ══════════════════════════════════════════════
   SHELL HANDLES
   ══════════════════════════════════════════════ */

/* The host app styles the box itself (.shell-selected
   is toggled by shell.js on select/deselect) */
.shell-selected {
  outline: 1.5px solid var(--at-border-sel);
  outline-offset: -1px;
}

/* Resize + rotate handle dots */
.sh {
  position: absolute;
  width: 8px; height: 8px;
  background: var(--at-bg);
  border: 1.5px solid var(--at-accent);
  border-radius: 50%;
  z-index: 20;
  display: none;
  pointer-events: auto;
  transition: transform 0.1s, background 0.1s;
}
.sh:hover { transform: scale(1.4); background: var(--at-accent); }
.shell-selected .sh { display: block; }

.sh-tl { top: -4px; left: -4px; cursor: nw-resize; }
.sh-tr { top: -4px; right: -4px; cursor: ne-resize; }
.sh-bl { bottom: -4px; left: -4px; cursor: sw-resize; }
.sh-br { bottom: -4px; right: -4px; cursor: se-resize; }
.sh-tm { top: -4px; left: 50%; margin-left: -4px; cursor: n-resize; }
.sh-bm { bottom: -4px; left: 50%; margin-left: -4px; cursor: s-resize; }
.sh-ml { top: 50%; left: -4px; margin-top: -4px; cursor: w-resize; }
.sh-mr { top: 50%; right: -4px; margin-top: -4px; cursor: e-resize; }

.sh-rot {
  top: -28px; left: 50%; margin-left: -5px;
  width: 10px; height: 10px;
  cursor: grab;
  background: var(--at-accent);
}
.sh-rot::before {
  content: '';
  position: absolute;
  width: 1px; height: 18px;
  background: var(--at-accent-glow);
  left: 50%; top: 10px;
  transform: translateX(-50%);
}
.sh-rot:hover { background: #ff5040; transform: scale(1.3); }


/* ══════════════════════════════════════════════
   TEMPLATE STYLES
   ══════════════════════════════════════════════ */

/* ── Note ── */
.tpl-note { padding: 10px 12px; font-family: var(--at-sans); }
.tpl-note h3 {
  font-size: 13px; font-weight: 700;
  color: var(--at-text);
  margin: 0 0 6px; line-height: 1.3;
}
.tpl-note p {
  font-size: 11px; color: var(--at-text-sec);
  line-height: 1.6; margin: 0;
}
.tpl-note-tags { margin-top: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.tpl-tag {
  font-family: var(--at-mono);
  font-size: 8px;
  color: var(--at-accent);
  border: 1px solid rgba(232,64,48,0.2);
  border-radius: 2px;
  padding: 1px 6px;
  letter-spacing: 0.5px;
}

/* ── Checklist ── */
.tpl-checklist { padding: 8px 10px; font-family: var(--at-sans); }
.tpl-checklist h3 {
  font-size: 12px; font-weight: 700;
  color: var(--at-text);
  margin: 0 0 8px;
}
.tpl-cl-item {
  display: flex; align-items: flex-start;
  gap: 8px; padding: 4px 0;
  font-size: 11px; color: var(--at-text-sec);
  line-height: 1.3; cursor: pointer;
}
.tpl-cl-box {
  width: 13px; height: 13px;
  border: 1.5px solid var(--at-border);
  border-radius: 3px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
  transition: all 0.12s;
}
.tpl-cl-item.done .tpl-cl-box {
  border-color: var(--at-accent);
  background: var(--at-accent-glow);
}
.tpl-cl-item.done .tpl-cl-box::after {
  content: '✓'; font-size: 9px; color: var(--at-accent);
}
.tpl-cl-item.done span {
  text-decoration: line-through; color: var(--at-text-dim);
}
.tpl-cl-bar {
  margin-top: 8px; height: 3px;
  background: var(--at-border);
  border-radius: 2px; overflow: hidden;
}
.tpl-cl-fill {
  height: 100%; background: var(--at-accent);
  border-radius: 2px; transition: width 0.3s;
}

/* ── Embed ── */
.tpl-embed { padding: 10px 12px; font-family: var(--at-sans); }
.tpl-embed h1, .tpl-embed h2, .tpl-embed h3 {
  color: var(--at-text); margin: 0 0 8px; line-height: 1.3;
}
.tpl-embed h1 { font-size: 18px; }
.tpl-embed h2 { font-size: 15px; }
.tpl-embed h3 { font-size: 13px; }
.tpl-embed p {
  font-size: 12px; color: var(--at-text-sec);
  line-height: 1.65; margin: 0 0 8px;
}
.tpl-embed code {
  font-family: var(--at-mono); font-size: 10px;
  background: rgba(255,255,255,0.05);
  padding: 1px 4px; border-radius: 2px;
  color: var(--at-accent);
}
.tpl-embed pre {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--at-border);
  border-radius: 4px;
  padding: 10px; overflow-x: auto;
  margin: 0 0 8px;
}
.tpl-embed pre code { background: none; padding: 0; }
.tpl-embed blockquote {
  border-left: 2px solid var(--at-accent);
  padding-left: 12px;
  color: var(--at-text-dim);
  font-style: italic;
  margin: 8px 0;
}
.tpl-empty { color: var(--at-text-dim); font-style: italic; }

/* ── Metric ── */
.tpl-metric {
  padding: 12px 14px; font-family: var(--at-sans);
  text-align: center;
}
.tpl-metric-val {
  font-family: var(--at-mono);
  font-size: 28px; font-weight: 700;
  color: var(--at-text);
  letter-spacing: -1px;
}
.tpl-metric-label {
  font-family: var(--at-mono);
  font-size: 9px; letter-spacing: 2px;
  color: var(--at-text-dim);
  margin-top: 4px; text-transform: uppercase;
}
.tpl-metric-delta {
  font-family: var(--at-mono);
  font-size: 10px; margin-top: 8px;
}
.tpl-metric-delta.up   { color: #4caf50; }
.tpl-metric-delta.down { color: #e84030; }

/* ── Log Entry ── */
.tpl-log { padding: 10px 12px; font-family: var(--at-sans); }
.tpl-log-header {
  display: flex; align-items: center;
  gap: 6px; margin-bottom: 8px;
}
.tpl-log-icon { font-size: 12px; }
.tpl-log-type {
  font-family: var(--at-mono);
  font-size: 8px; letter-spacing: 2px;
  text-transform: uppercase;
}
.tpl-log-date {
  font-family: var(--at-mono);
  font-size: 8px; color: var(--at-text-dim);
  margin-left: auto;
}
.tpl-log h3 {
  font-size: 13px; font-weight: 700;
  color: var(--at-text);
  margin: 0 0 6px;
}
.tpl-log p {
  font-size: 11px; color: var(--at-text-sec);
  line-height: 1.5; margin: 0;
}
.tpl-log-meta {
  margin-top: 8px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.04);
  display: flex; gap: 12px;
}
.tpl-log-meta-item {
  font-family: var(--at-mono);
  font-size: 8px; color: var(--at-text-dim);
}
.tpl-log-meta-item em {
  font-style: normal; color: var(--at-text-sec);
}
