/* ============================================================
   ARTIST PAGE (single artist)
   ============================================================ */

.artist-page { max-width: 1200px; margin: 100px auto 30px; padding: 20px 20px 60px; }
.artist-header { display: flex; gap: 32px; align-items: flex-start; margin-bottom: 28px; }
.artist-bio { flex: 1; min-width: 0; }
.artist-bio h1 { font-size: 2rem; font-weight: 800; margin: 0; color: var(--text); }
.artist-name-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.artist-description { font-size: 1rem; color: var(--text); line-height: 1.5; }
.artist-description p { margin: 0 0 12px; }
@media (max-width: 640px) {
  .artist-description.desc-collapsed {
    max-height: 120px; overflow: hidden; position: relative;
    mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  }
}
.desc-read-more { display: none; background: none; border: none; color: var(--brand); font-size: 0.88rem; font-weight: 700; cursor: pointer; padding: 4px 0; font-family: inherit; }
@media (max-width: 640px) { .desc-read-more { display: inline-block; } }
.artist-location-summary { font-size: 0.92rem; color: var(--muted); margin-top: 14px; }
.artist-location-summary strong { color: var(--text); }
.artist-stat-bar { display: flex; align-items: center; gap: 10px; font-size: 0.82rem; color: var(--muted); margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); }
.artist-stat-bar .stat-item { display: flex; align-items: center; gap: 6px; }
.artist-stat-bar .stat-item i { font-size: 0.78rem; opacity: 0.7; }
.artist-stat-bar .stat-divider { opacity: 0.4; }
.artist-themes { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 10px; width: 100%; justify-content: center; }
.artist-theme-pill { display: inline-block; padding: 3px 10px; border-radius: 20px; border: 1.5px solid var(--border); font-size: 0.78rem; font-weight: 600; color: var(--muted); background: transparent; }
.artist-profile-wrap { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; width: 220px; }
.artist-profile-img { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border); background: var(--card-soft); display: block; }
.artist-profile-placeholder { width: 200px; height: 200px; border-radius: 50%; background: var(--card-soft); border: 3px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 3rem; }
.artist-links { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.artist-link-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 7px 10px; background: var(--brand); color: #fff; text-decoration: none; border-radius: 6px; font-size: 0.82rem; font-weight: 600; text-align: center; transition: background 0.2s; box-sizing: border-box; }
.artist-link-btn:hover { background: var(--brand-strong); }
.artist-link-label { display: inline; }
.btn-admin-edit { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: transparent; border: 1.5px solid var(--brand); color: var(--brand); border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: background 0.2s, color 0.2s; width: auto; }
.btn-admin-edit:hover { background: var(--brand); color: #fff; }
.artist-filters { margin-bottom: 22px; display: flex; flex-direction: column; gap: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.filter-row-divider { width: 1px; height: 20px; align-self: center; background: var(--border); margin: 0 2px; flex-shrink: 0; }
.artist-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .artist-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .artist-grid { grid-template-columns: repeat(4, 1fr); } }
.artist-grid .artwork-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 4px 10px var(--shadow); overflow: hidden; position: relative; cursor: pointer; transition: transform .2s ease-in-out; margin: 0; }
.artist-grid .artwork-card:hover { transform: translateY(-4px); }
.artist-grid .artwork-card img { width: 100%; height: 200px; object-fit: cover; display: block; }
.artist-grid .artwork-card-content { padding: 10px 10px 2px 10px; position: relative; }
.artist-grid .artwork-description { font-size: .9rem; color: var(--text); margin: -3px 0 5px; }
.artist-grid .artwork-title { max-width: calc(100% - 48px) !important; }

/* Edit modal */
.modal-backdrop { display: none; position: fixed; inset: 0; background: var(--backdrop); z-index: 1000; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal-box { background: var(--card); border-radius: 12px; padding: 28px 32px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.modal-box h2 { margin: 0 0 20px; font-size: 1.3rem; }
.modal-field { margin-bottom: 16px; }
.modal-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
.modal-field small { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--muted); }
.modal-field input, .modal-field textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1.5px solid var(--input-border); border-radius: 6px; background: var(--input-bg); color: var(--input-text); font-size: 0.95rem; font-family: inherit; }
.modal-field textarea { min-height: 120px; resize: vertical; }
.modal-links-list { display: flex; flex-direction: column; gap: 8px; }
.modal-link-row { display: flex; gap: 8px; align-items: center; }
.modal-link-row input { flex: 1; }
.modal-link-row .link-label-input { flex: 0 0 100px; }
.btn-remove-link { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 1rem; padding: 0 4px; line-height: 1; width: auto; }
.btn-add-link { margin-top: 6px; background: none; border: 1.5px dashed var(--border); color: var(--muted); border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 0.85rem; width: auto; }
.btn-add-link:hover { border-color: var(--brand); color: var(--brand); }
.profile-upload-row { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.profile-upload-row .preview-img { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); display: block; }
.profile-upload-row .preview-placeholder { width: 60px; height: 60px; border-radius: 50%; background: var(--card-soft); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.4rem; flex-shrink: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; align-items: center; }
.btn-save { padding: 8px 22px; background: var(--brand); color: #fff; border: none; border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 0.95rem; width: auto; }
.btn-save:hover { background: var(--brand-strong); }
.btn-save:disabled { opacity: 0.6; cursor: default; }
.btn-cancel { padding: 8px 18px; background: transparent; border: 1.5px solid var(--border); border-radius: 6px; cursor: pointer; color: var(--text); font-size: 0.95rem; width: auto; }
.modal-save-status { font-size: 0.85rem; color: var(--muted); flex: 1; }
.no-artworks { color: var(--muted); font-style: italic; margin-top: 20px; }

@media (max-width: 640px) {
  .artist-header { flex-direction: column-reverse; align-items: center; }
  .artist-profile-wrap { width: 100%; flex-direction: row; gap: 12px; align-items: center; }
  .artist-profile-img, .artist-profile-placeholder { width: 100px; height: 100px; font-size: 2rem; flex-shrink: 0; }
  .artist-links { flex-direction: row; flex-wrap: wrap; gap: 8px; flex: 1; }
  .artist-link-btn { width: auto; flex: 0 0 auto; padding: 8px 12px; font-size: 0.9rem; }
  .artist-link-label { display: none; }
}

/* ============================================================
   ARTISTS PAGE (index)
   ============================================================ */

.artists-page { max-width: 1200px; margin: 100px auto 0; padding: 20px 20px 60px; }
.artists-page h1 { font-size: 2rem; font-weight: 800; margin: 0 0 6px; color: var(--text); }
.artists-subtitle { color: var(--muted); margin: 0 0 20px; font-size: 0.95rem; }
.artists-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; margin-bottom: 18px; }
.artists-search-wrap { position: relative; flex: 1; min-width: 0; }
.artists-search-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
#artist-search { width: 100%; box-sizing: border-box; padding: 9px 12px 9px 36px; border: 1.5px solid var(--input-border); border-radius: 8px; background: var(--input-bg); color: var(--input-text); font-size: 0.92rem; font-family: inherit; }
#artist-sort { flex-shrink: 0; width: 180px; padding: 9px 12px; border: 1.5px solid var(--input-border); border-radius: 8px; background: var(--input-bg); color: var(--input-text); font-size: 0.92rem; font-family: inherit; cursor: pointer; }
@media (max-width: 600px) {
  .artists-toolbar { flex-wrap: wrap; }
  .artists-search-wrap { flex: 1 1 100%; }
  #artist-sort { flex: 1; }
}
.artists-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 600px) { .artists-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; } }
@media (min-width: 900px) { .artists-grid { grid-template-columns: repeat(5, 1fr); } }
.artist-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 4px 10px var(--shadow);
  overflow: hidden; cursor: pointer; text-decoration: none;
  display: flex; flex-direction: column; align-items: center;
  padding: 20px 14px 16px; transition: transform .2s ease-in-out; color: var(--text);
}
.artist-card:hover { transform: translateY(-4px); }
.artist-card-avatar { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); background: var(--card-soft); margin-bottom: 12px; display: block; }
.artist-card-avatar-placeholder { width: 80px; height: 80px; border-radius: 50%; background: var(--card-soft); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 1.8rem; margin-bottom: 12px; flex-shrink: 0; }
.artist-card-name { font-size: 0.95rem; font-weight: 700; text-align: center; color: var(--text); line-height: 1.3; }
.artist-card-count { font-size: 0.78rem; color: var(--muted); margin-top: 4px; text-align: center; }
.artist-card.has-bg { background-size: 160%; background-position: center; background-repeat: no-repeat; position: relative; overflow: hidden; }
.artist-card.has-bg::before { content: ''; position: absolute; inset: 0; background: inherit; filter: grayscale(40%) brightness(0.4); background-size: inherit; background-position: inherit; border-radius: inherit; z-index: 0; }
.artist-card.has-bg > * { position: relative; z-index: 1; }
.artist-card.has-bg .artist-card-name { color: #fff; }
.artist-card.has-bg .artist-card-count { color: rgba(255,255,255,0.65); }
.artist-card.has-bg .artist-card-avatar-placeholder { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.6); }

/* ============================================================
   ARTIST RELATIONSHIPS
   ============================================================ */

.artist-card-img-wrap { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; }

.mini-avatars { position: absolute; display: flex; gap: 2px; bottom: 6px; }
.mini-avatars-bottom-right { right: 4px; flex-direction: row-reverse; }
.mini-avatars-bottom-left  { left: 4px;  flex-direction: row; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--card); background: var(--card-soft); overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 0.65rem; color: var(--muted); flex-shrink: 0; box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.mini-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-avatar i { font-size: 0.7rem; }
.mini-avatar-more { background: var(--brand); color: #fff; font-size: 0.6rem; font-weight: 700; border-color: var(--card); }
.artist-card.has-bg .mini-avatar { border-color: rgba(255,255,255,0.6); }

.artist-card-type-badge { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 20px; background: var(--brand); color: #fff; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-align: center; }
.artist-card.has-bg .artist-card-type-badge { background: rgba(255,255,255,0.2); color: #fff; backdrop-filter: blur(2px); }

.artist-relations { margin-top: 16px; width: 100%; text-align: center; }
.relations-label { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 6px; }
.relations-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; justify-content: center; }
.relation-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border: 1.5px solid var(--border); border-radius: 999px; background: var(--card); color: var(--text); text-decoration: none; font-size: 0.82rem; font-weight: 600; white-space: normal; transition: border-color 0.2s, color 0.2s; }
.relation-chip:hover { border-color: var(--brand); color: var(--brand); }
.relation-chip img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--border); flex-shrink: 0; }
.relation-chip-placeholder { width: 24px; height: 24px; border-radius: 50%; background: var(--card-soft); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.65rem; flex-shrink: 0; }

/* Modal: isCollective inline field */
.modal-field-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.modal-field-inline label { margin: 0; font-size: 0.85rem; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.modal-field-inline input[type="checkbox"] { width: auto; transform: scale(1.2); cursor: pointer; accent-color: var(--brand); flex-shrink: 0; }
.modal-field-inline small { width: 100%; margin: 0; font-size: 0.78rem; color: var(--muted); }

/* Linked artist search */
.linked-search-wrap { position: relative; }
.linked-search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--card); border: 1.5px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.18); max-height: 220px; overflow-y: auto; z-index: 50; margin-top: 2px; }
.linked-result-item { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; transition: background 0.15s; }
.linked-result-item:hover { background: var(--bg-soft); }
.linked-result-item img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--border); flex-shrink: 0; }
.linked-result-placeholder { width: 30px; height: 30px; border-radius: 50%; background: var(--card-soft); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.75rem; flex-shrink: 0; }
.linked-result-name { flex: 1; font-size: 0.88rem; font-weight: 600; color: var(--text); }
.linked-result-badge { font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px; background: var(--brand); color: #fff; letter-spacing: 0.03em; text-transform: uppercase; flex-shrink: 0; }
.edit-linked-list { display: flex; flex-direction: column; gap: 6px; }
.linked-artist-row { display: flex; align-items: center; gap: 9px; padding: 6px 10px; background: var(--bg-soft); border: 1.5px solid var(--border); border-radius: 8px; }
.linked-artist-row img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--border); flex-shrink: 0; }
.linked-artist-placeholder { width: 28px; height: 28px; border-radius: 50%; background: var(--card-soft); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.7rem; flex-shrink: 0; }
.linked-artist-name { flex: 1; font-size: 0.88rem; font-weight: 600; color: var(--text); }

@media (max-width: 480px) {
  .relations-row { gap: 6px; }
  .relation-chip { font-size: 0.78rem; }
}