/* platform.ui v1 — shared UI primitives
   All classes prefixed pui- to avoid module collisions.
   Uses shell CSS vars (--bg, --bg2, --primary, etc). */

/* ── Modal ───────────────────────────────────────── */
.pui-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: puiFadeIn 0.12s ease-out;
}
.pui-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  min-width: 320px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: puiSlideUp 0.15s ease-out;
}
.pui-modal-header {
  padding: 16px 20px 0;
  font-family: var(--font-head);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--primary);
  text-transform: uppercase;
}
.pui-modal-content {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.pui-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}

/* ── Toast ───────────────────────────────────────── */
.pui-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.pui-toast {
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: puiFadeIn 0.15s ease-out;
  pointer-events: auto;
}
.pui-toast.pui-toast-out {
  animation: puiFadeOut 0.2s ease-in forwards;
}

/* ── Confirm ─────────────────────────────────────── */
.pui-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: puiFadeIn 0.12s ease-out;
}
.pui-confirm {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  padding: 20px 24px;
  min-width: 280px;
  max-width: 400px;
  animation: puiSlideUp 0.15s ease-out;
}
.pui-confirm-msg {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.4;
}
.pui-confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Dropzone ────────────────────────────────────── */
.pui-dropzone {
  border: 2px dashed var(--border2);
  border-radius: 10px;
  padding: 24px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.pui-dropzone.active {
  border-color: var(--primary);
  background: rgba(0,230,210,0.05);
  color: var(--primary);
}

/* ── File Preview ────────────────────────────────── */
.pui-file-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-mid);
}
.pui-file-preview-thumb {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.pui-file-preview-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pui-file-preview-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.pui-file-preview-remove:hover {
  color: var(--red);
  background: rgba(255,57,151,0.1);
}

/* ── List ────────────────────────────────────────── */
.pui-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pui-list-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  cursor: pointer;
}
.pui-list-item:last-child { border-bottom: none; }
.pui-list-item:hover { background: var(--bg3); }

/* ── Buttons ─────────────────────────────────────── */
.pui-btn {
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
}
.pui-btn:hover {
  background: var(--border);
  border-color: var(--border2);
}
.pui-btn-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: var(--bg);
  font-weight: 600;
}
.pui-btn-primary:hover { opacity: 0.85; }
.pui-btn-danger {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
}
.pui-btn-danger:hover {
  background: rgba(255,57,151,0.1);
}

/* ── Input ───────────────────────────────────────── */
.pui-input {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.pui-input:focus { border-color: var(--primary); }

/* ── Avatar ──────────────────────────────────────── */
.pui-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  font-weight: 700;
  color: var(--primary);
  flex-shrink: 0;
  line-height: 1;
}
.pui-avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.pui-avatar-md { width: 32px; height: 32px; font-size: 14px; }
.pui-avatar-lg { width: 48px; height: 48px; font-size: 20px; }
.pui-avatar-xl { width: 72px; height: 72px; font-size: 32px; }

/* ── Badge ───────────────────────────────────────── */
.pui-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1.4;
}
.pui-badge-default { background: var(--bg3); color: var(--text-mid); border: 1px solid var(--border2); }
.pui-badge-primary { background: rgba(0,230,210,0.12); color: var(--primary); border: 1px solid rgba(0,230,210,0.3); }
.pui-badge-green { background: rgba(57,255,127,0.1); color: #39ff7f; border: 1px solid rgba(57,255,127,0.3); }
.pui-badge-red { background: rgba(255,57,151,0.1); color: var(--red); border: 1px solid rgba(255,57,151,0.3); }
.pui-badge-yellow { background: rgba(255,215,0,0.1); color: var(--yellow); border: 1px solid rgba(255,215,0,0.3); }
.pui-badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}
.pui-badge-dot.green { background: #39ff7f; box-shadow: 0 0 6px rgba(57,255,127,0.5); }
.pui-badge-dot.yellow { background: var(--yellow); box-shadow: 0 0 6px rgba(255,215,0,0.5); }
.pui-badge-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(255,57,151,0.5); }

/* ── Tabs ────────────────────────────────────────── */
.pui-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.pui-tab {
  padding: 10px 18px;
  font-family: var(--font-head);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
  font-family: inherit;
}
.pui-tab:hover { color: var(--text-mid); }
.pui-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ── Form Group ──────────────────────────────────── */
.pui-form-group {
  margin-bottom: 14px;
}
.pui-label {
  display: block;
  font-size: 11px;
  color: var(--text-mid);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.pui-textarea {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  min-height: 80px;
  resize: vertical;
}
.pui-textarea:focus { border-color: var(--primary); }
.pui-select {
  background: var(--bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235a6a70' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.pui-select:focus { border-color: var(--primary); }
.pui-form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  display: none;
}
.pui-form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Star Rating ─────────────────────────────────── */
.pui-stars {
  display: inline-flex;
  gap: 2px;
}
.pui-star {
  font-size: 18px;
  cursor: pointer;
  color: var(--border2);
  transition: color 0.1s;
  user-select: none;
}
.pui-star.lit { color: #f0c040; }
.pui-star.hover { color: #f0c040; opacity: 0.7; }
.pui-stars-display .pui-star { cursor: default; }
.pui-stars-val {
  font-size: 13px;
  color: #f0c040;
  font-weight: 600;
  margin-left: 6px;
}

/* ── Empty State ─────────────────────────────────── */
.pui-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}
.pui-empty-icon {
  font-size: 32px;
  opacity: 0.3;
  margin-bottom: 8px;
}
.pui-empty-msg {
  font-size: 14px;
}

/* ── Button disabled ─────────────────────────────── */
.pui-btn:disabled, .pui-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.pui-btn-sm {
  font-size: 11px;
  padding: 5px 10px;
}

/* ── Animations ──────────────────────────────────── */
@keyframes puiFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes puiFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes puiSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
