/* === roles.css === */
/* Список ролей — перенесено с CDN на сервер notahub.ru, v1.0 (2026-07) */
/* Использует переменные темы форума: --acc1..8, --text, --fishes, --font, --white */

/* === BASE WRAPPER === */
#roles {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  font: 15px/1.5 system-ui, sans-serif;
  background: var(--fishes);
  border-radius: 20px;
  position: relative;
}

/* === HEADER === */
.roles-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1em;
  flex-wrap: wrap;
  gap: 8px;
}

.roles-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: rgb(var(--text));
  margin: 0;
}

/* === ACTION BUTTONS === */
.roles-actions {
  display: flex;
  gap: 6px;
}

.roles-actions .nc-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: all .25s ease;
  background: rgba(var(--acc1), .2);
  color: rgb(var(--acc1));
}

.roles-actions .nc-btn.primary {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all .25s ease;
  background: rgba(var(--acc1), .2);
  color: rgb(var(--acc1));
  height: 28px;
  width: 200px !important;
  font-size: 14px !important;
}

.roles-actions .nc-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* === SEARCH FIELD === */
#roles-search {
  box-sizing: border-box;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(var(--acc1), .3);
  border-radius: 10px;
  margin-bottom: 16px;
  font: inherit;
  background: rgb(var(--pun), .5);
  color: rgb(var(--text));
  outline: none;
  transition: border-color .25s ease, box-shadow .25s ease;
}

#roles-search::placeholder {
  color: rgb(var(--text), .45);
}

#roles-search:focus {
  border-color: rgb(var(--acc1));
  box-shadow: 0 0 0 3px rgba(var(--acc1), .12);
}

/* === LETTERS NAV (алфавитный якорь) === */
#letters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(var(--acc3), .15);
}

.letters-nav-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 7px;
  background: rgba(var(--acc7), .3);
  color: rgb(var(--acc1));
  font: 700 12px var(--font);
  text-decoration: none;
  text-transform: uppercase;
  transition: background .2s ease, color .2s ease, transform .15s ease;
}

.letters-nav-item:hover {
  background: rgb(var(--acc1));
  color: rgb(var(--white));
  transform: translateY(-1px);
}

/* === GRID STRUCTURE === */
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 30px;
}

.letter-block {
  background: rgb(var(--pun), .35);
  border-radius: 10px;
  padding: 10px 14px;
  max-height: 420px;
  overflow-y: auto;
  scroll-margin-top: 90px;
}

.letter-block h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
  border-bottom: 2px solid rgb(var(--acc2));
  width: fit-content;
  padding-right: 4px;
  color: rgb(var(--text));
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 1;
}

/* === FANDOM CARD === */
.fandom {
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgb(var(--pun), .5);
  border: 1px solid rgba(var(--acc3), .15);
  transition: background .2s ease, box-shadow .2s ease;
}

.fandom:hover {
  background: rgb(var(--pun), .7);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}

.fandom h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px 0;
  color: rgb(var(--text));
  display: flex;
  align-items: center;
  gap: 4px;
}

.names {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 6px;
}

.names a {
  text-decoration: none;
  color: rgb(var(--acc1));
  line-height: 1.6;
  font-family: var(--font);
  font-size: 14px;
  text-transform: lowercase;
}

.names a:hover {
  text-decoration: underline;
}

/* === ROLE ITEM (чипс) === */
.role-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(var(--acc7), .12);
  position: relative;
  transition: background .2s ease;
}

.role-item:hover {
  background: rgb(var(--acc7), .2);
}

.edit-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  background: none;
  border: none;
  font-size: 13px;
  color: rgb(var(--acc1));
  cursor: pointer;
}

.role-item:hover .edit-btn {
  opacity: 1;
  pointer-events: auto;
}

/* === CAST SETTINGS === */
.cast-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* === Бейдж "выкуплено" — мелко и прозрачно, не перетягивает внимание === */
.cast-owned-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 0 4px;
  text-decoration: none;
  font: 400 9px var(--font3, var(--font));
  text-transform: lowercase;
  letter-spacing: .01em;
  color: rgb(var(--text), .45);
  transition: color .2s ease;
}

.cast-owned-badge i {
  font-size: 9px;
  opacity: .8;
}

.cast-owned-badge:hover {
  color: rgb(var(--acc8), .9);
}

.edit-cast {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: rgb(var(--acc1));
  opacity: 0;
  transform: scale(.8);
  transition: opacity .25s ease, transform .25s ease;
}

.cast-title:hover .edit-cast {
  opacity: 1;
  transform: scale(1);
}

/* ===================================================== */
/* =================== MODAL SYSTEM ==================== */
/* ===================================================== */

.nc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s ease;
}

.nc-modal-backdrop.visible {
  display: flex;
  opacity: 1;
}

.nc-modal {
  width: 400px;
  max-width: 90%;
  background: var(--fishes);
  border-radius: 16px;
  box-shadow: 0 0 18px rgba(0,0,0,.4);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateY(8px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}

.nc-modal-backdrop.visible .nc-modal {
  transform: translateY(0);
  opacity: 1;
}

.nc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nc-field label {
  font-size: 13px;
  opacity: .8;
}

.nc-field-suggest {
  position: relative;
}

.nc-suggest-box {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: var(--fishes);
  border: 1px solid rgba(var(--acc1), .3);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,.25);
  z-index: 20;
}

.nc-suggest-box.visible {
  display: block;
}

.nc-suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: rgb(var(--text));
  cursor: pointer;
}

.nc-suggest-item span {
  opacity: .5;
  font-size: 11px;
}

.nc-suggest-item:hover {
  background: rgba(var(--acc1), .15);
}

.nc-modal input,
.nc-modal select {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid rgb(var(--acc1) / .3);
  border-radius: 6px;
  background: rgba(255,255,255,.05);
  color: rgb(var(--text));
  outline: none;
  transition: border-color .25s ease;
}

.nc-modal input:focus,
.nc-modal select:focus {
  border-color: rgb(var(--acc1));
}

#roles-id-hint {
  font-size: 13px;
  color: #b22;
  min-height: 1em;
}

.nc-modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  gap: 8px;
}

.nc-modal-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 7px 10px;
  font-weight: 500;
  transition: all .25s ease;
}

.nc-modal-actions .primary {
  background: rgb(var(--acc1));
  color: #fff;
}

.nc-modal-actions .warn {
  background: rgba(200, 70, 70, .8);
  color: #fff;
}

.nc-modal-actions button:hover {
  filter: brightness(1.1);
}

/* === ADAPTIVE === */
@media (max-width: 800px) {
  .roles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 500px) {
  .roles-grid { grid-template-columns: 1fr; }
  #roles { padding: 10px; }
  .roles-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .roles-actions { width: 100%; }
  .roles-actions .nc-btn.primary { width: 100% !important; }
  #letters { gap: 4px; }
  .letter-block { max-height: none; }
  .nc-modal { width: 92%; padding: 16px; }
}
