/* Host Browser — EntityBrowser overrides + profile detail */

/* Override: tile grid in list pane instead of default vertical list */
#view-hosts .eb-list-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 6px;
  padding: 8px;
  align-content: start;
}

#view-hosts .eb-cell {
  padding: 0;
  border-radius: var(--radius);
  border-left: none;
  border: 1px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#view-hosts .eb-cell:hover {
  border-color: var(--accent);
  background: transparent;
}

#view-hosts .eb-cell.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: transparent;
}

/* Tile inner layout */
.host-tile-inner {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--bg-surface);
}

.host-tile-portrait {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-primary);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-tile-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.host-tile-placeholder {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-glow);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-tile-name {
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Host Profile (Detail Pane) ---- */

.host-profile {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.host-profile-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.host-profile-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.host-profile-header-name {
  flex: 1;
  margin-right: 12px;
}

.host-profile-header-name input {
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 8px;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.host-profile-header-name input:hover {
  border-color: var(--border);
}

.host-profile-header-name input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-primary);
}

.host-profile-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

/* Portrait in header */
.host-profile-header-portrait {
  width: 120px;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-profile-header-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.host-profile-header-portrait-placeholder {
  font-size: 36px;
  font-weight: 700;
  color: var(--accent);
}

.host-profile-header-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.host-profile-header-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

/* Tabs */
.host-profile-tabs {
  margin-top: 12px;
}

.host-profile-tab-panel {
  display: none;
  padding-top: 16px;
}

.host-profile-tab-panel.active {
  display: block;
}

/* Portrait tab layout */
.host-profile-portrait-section {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.host-profile-portrait {
  width: 200px;
  aspect-ratio: 3/4;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-primary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.host-profile-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.host-profile-portrait-placeholder {
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
}

.host-profile-portrait-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.host-profile-portrait-controls label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.host-profile-portrait-controls textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 8px;
  resize: vertical;
  box-sizing: border-box;
}

.host-profile-portrait-controls textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.host-profile-portrait-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* Meta line */
.host-profile-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.host-profile-id {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s;
}

.host-profile-id:hover {
  color: var(--accent);
}

/* Sections */
.host-profile-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.host-profile-section-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Editable fields */
.host-profile-field {
  margin-bottom: 10px;
}

.host-profile-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.host-profile-field input,
.host-profile-field textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 6px 8px;
  box-sizing: border-box;
}

.host-profile-field textarea {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  padding: 8px;
  resize: vertical;
}

.host-profile-field input:focus,
.host-profile-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Pill grids in profile */
.profile-archetype-grid,
.profile-style-grid,
.profile-interests-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Save indicator */
.host-profile-save-status {
  font-size: 11px;
  color: var(--status-positive);
  opacity: 0;
  transition: opacity 0.3s;
}

.host-profile-save-status.visible {
  opacity: 1;
}

/* Footer actions */
.host-profile-footer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Episodes tab */
.host-episodes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.host-episode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
}

.host-episode-row:hover {
  border-color: var(--accent);
}

.host-episode-thumb {
  width: 48px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.host-episode-info {
  flex: 1;
  min-width: 0;
}

.host-episode-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-episode-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.host-episode-status {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}

.host-episode-status.completed {
  background: var(--status-positive-bg, rgba(46,204,113,0.15));
  color: var(--status-positive);
}

.host-episode-status.generating,
.host-episode-status.pending {
  background: var(--status-warn-bg, rgba(241,196,15,0.15));
  color: var(--status-warn);
}

.host-episode-status.failed {
  background: var(--status-negative-bg, rgba(231,76,60,0.15));
  color: var(--status-negative, var(--error));
}

/* ---- Shared Pill Styles ---- */

.archetype-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.archetype-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.archetype-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.style-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.style-pill:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.style-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.interest-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.15s;
}

.interest-pill:hover {
  border-color: var(--accent);
}

.interest-pill.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---- Editable List Items ---- */

.editable-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.editable-item {
  display: flex;
  gap: 6px;
  align-items: center;
}

.editable-item input {
  flex: 1;
}

.editable-item .remove-item-btn {
  background: none;
  border: none;
  color: var(--error);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  opacity: 0.6;
}

.editable-item .remove-item-btn:hover {
  opacity: 1;
}

.add-item-btn {
  padding: 4px 12px !important;
  font-size: 11px !important;
  margin-bottom: 12px;
}

/* ---- Provider Selector ---- */

.portrait-provider-select {
  font-size: 12px;
  padding: 4px 8px;
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ---- Visibility Toggle ---- */

.visibility-toggle {
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  transition: all 0.15s;
}

.visibility-toggle:hover {
  border-color: var(--accent);
}

/* ---- Create Host Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-body label {
  margin-bottom: 10px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* Grids in modal */
.edit-archetype-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.edit-style-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.edit-interests-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

/* ---- Portrait Preview (post-create) ---- */

.portrait-modal-body {
  text-align: center;
}

.portrait-modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.portrait-preview {
  width: 240px;
  aspect-ratio: 3/4;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.portrait-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portrait-preview-placeholder {
  font-size: 13px;
  color: var(--text-muted);
}

.portrait-modal-actions {
  margin-bottom: 8px;
}
