/* Guild page of the game menu (Menu > Guild): shared tabs with icons (ui-tab with-icon and ui-tab-page, see controls.css),
   see theme.css for the colors */
/* The toolbar stays in place and only the page of the selected tab scrolls */
.game-menu-page.guild-page {
  overflow: hidden;
}

.guild-view {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.guild-view.active {
  display: flex;
}

/* Without a guild the whole view scrolls: the founding card and the invitations */
#guild-none {
  overflow-y: auto;
  padding-right: 2px;
}

.guild-page .guild-tab-page {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

/* Toolbar: the tabs and the search box (shared look and clear button, see text-field.css) */
.guild-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.guild-tabs {
  flex: 0 0 auto;
  align-self: flex-start;
}

.guild-toolbar > .guild-search-wrapper {
  flex: 1 1 140px;
}

/* The search box only filters the members: on the other tabs it keeps its place so the toolbar does not change size */
.guild-toolbar.no-search > .guild-search-wrapper {
  visibility: hidden;
}

/* Overview tab: the summary, the suspension notice and the guild house card with its warning */
.guild-page .guild-overview {
  gap: 10px;
}

/* Amber dot of the Overview tab while it has a warning */
.guild-tab-alert {
  display: none;
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--color-warning);
  box-shadow: 0 0 4px var(--color-warning);
}

.guild-tab-alert.active {
  display: block;
}

/* Number of entries of a tab: fixed width so the tabs keep their size, dimmed at zero */
.guild-tab-count {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 24px;
  padding: 0 2px;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 12px;
  text-align: center;
  white-space: nowrap;
  color: var(--color-text-soft);
  border: 1px solid #5a5a5a;
  border-radius: 7px;
  background-color: rgba(0, 0, 0, 0.45);
}

.guild-tab-count.zero {
  opacity: 0.5;
}

/* Part of a name that matches the search */
.guild-match {
  color: var(--color-accent-text);
  border-radius: 2px;
  background-color: var(--color-accent-dark);
}

/* Founding card of the players without a guild */
.guild-found {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--color-accent-dark);
  border-radius: 10px;
  background-image:
    radial-gradient(circle at 0% 0%, var(--color-accent-haze), transparent 65%),
    var(--gradient-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.guild-found-title {
  font-size: 13px;
  font-weight: bold;
  color: var(--color-accent-text);
}

.guild-found-text {
  font-size: 10px;
  font-weight: normal;
  line-height: 1.5;
  color: var(--color-text-soft);
}

.guild-found-premium {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  font-weight: normal;
  color: var(--color-text-muted);
}

/* A text box with its button on one line (found, invite, message of the day) */
.guild-form {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.guild-form > .text-field-box,
.guild-form > .text-field {
  flex: 1 1 auto;
  min-width: 0;
}

.guild-page .guild-tab-page > .guild-form {
  margin-bottom: 8px;
}

.guild-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Member, invited character or inviting guild: badge, name with details and the tags and buttons on the right */
.guild-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  border: 1px solid black;
  border-radius: 8px;
  background-image: linear-gradient(to right, #444444, #2a2a2a);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.guild-row.offline {
  background-image: linear-gradient(to right, #383838, #242424);
}

/* Vocation (or guild initial) badge with the online dot in its corner */
.guild-row-badge {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 10px;
  font-weight: bold;
  color: var(--color-accent);
  border: 1px solid var(--color-accent-dark);
  border-radius: 8px;
  background-image: radial-gradient(circle at 30% 25%, #555555, #1a1a1a 80%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

.guild-row.offline .guild-row-badge {
  color: var(--color-text-dim);
}

/* Outfit of a member (like .party-row-badge): the 40px preview (see Canvas.drawOutfitPreview) is centered and clipped to the
   badge, in its own frame so the online dot can stay outside the corner */
.guild-row-outfit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  overflow: hidden;
}

.guild-row-outfit canvas {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

/* Offline members are shown faded */
.guild-row.offline .guild-row-outfit canvas {
  filter: grayscale(0.8);
  opacity: 0.6;
}

.guild-row-status {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  border: 1px solid black;
  border-radius: 50%;
  background-color: var(--color-text-dim);
}

.guild-row-status.online {
  background-color: var(--color-success);
  box-shadow: 0 0 4px var(--color-success);
}

.guild-row-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.guild-row-name {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: bold;
}

.guild-row-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guild-row.offline .guild-row-name-text {
  color: var(--color-text-soft);
}

.guild-row-nick {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: normal;
  font-style: italic;
  color: var(--color-accent-text);
}

.guild-row-details {
  font-size: 10px;
  font-weight: normal;
  color: var(--color-text-muted);
}

/* Inline nickname editor of a member row */
.guild-row-editor {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.guild-row-editor > .text-field-box,
.guild-row-editor > .text-field {
  flex: 1 1 auto;
  min-width: 0;
}

/* Heading of a rank group of the member list: the rank name and its online members */
.guild-list > .guild-rank-section {
  margin: 8px 0 1px;
}

.guild-list > .guild-rank-section:first-child {
  margin-top: 0;
}

.guild-rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The line of the section sits between the rank name and the count */
.guild-rank-count {
  order: 1;
  flex: 0 0 auto;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-muted);
}

/* Buttons of the rows, the summary and the forms: shared look and variants (ui-button, see controls.css), a bit smaller */
.modal button.guild-button {
  flex: 0 0 auto;
  margin: 0;
  padding: 3px 10px;
  font-size: 10px;
}

/* Edit nickname: a small square button with an icon */
.modal button.guild-button.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
}

.modal button.guild-button.icon .material-icons {
  font-size: 13px;
}

/* A Save button whose change was saved: green for a moment (it stays disabled, without the faded disabled look) */
#game-menu-modal button.guild-button.saved {
  opacity: 1;
  filter: none;
  color: var(--color-success);
  border-color: var(--color-success);
  background-image: var(--gradient-surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 6px var(--color-success);
}

/* Exclude, pass leadership, leave and disband wait for a second click: the shared look of two-click actions (--color-confirming) */
#game-menu-modal button.guild-button.confirming {
  color: var(--color-confirming);
  border-color: var(--color-confirming);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 6px var(--color-confirming);
}

/* Summary of the own guild: name, size, own rank and the message of the day with the guild buttons */
.guild-summary {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-accent-dark);
  border-radius: 10px;
  background-image:
    radial-gradient(circle at 0% 0%, var(--color-accent-haze), transparent 65%),
    var(--gradient-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 6px rgba(0, 0, 0, 0.6);
}

.guild-summary-text {
  display: flex;
  flex: 1 1 160px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guild-summary-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: bold;
  color: var(--color-accent-text);
}

.guild-summary-subtitle {
  font-size: 10px;
  font-weight: normal;
  color: var(--color-text-muted);
}

/* The message of the day is shown whole: the Overview tab has room for it */
.guild-summary-motd {
  margin-top: 2px;
  font-size: 10px;
  font-weight: normal;
  font-style: italic;
  line-height: 1.4;
  color: var(--color-text-soft);
  overflow-wrap: anywhere;
}

.guild-summary-motd.empty {
  color: var(--color-text-dim);
}

.guild-summary-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

/* Guild house card: a shield badge, the guild house (or what one needs), the premium vice-leaders and the button to the House page */
.guild-house {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 6px;
  border: 1px solid black;
  border-radius: 8px;
  background-image: var(--gradient-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.guild-house:empty {
  display: none;
}

.guild-house.owned {
  border-color: var(--color-accent-dark);
}

.guild-house-badge {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-accent);
  border: 1px solid var(--color-accent-dark);
  border-radius: 8px;
  background-image: radial-gradient(circle at 30% 25%, #555555, #1a1a1a 80%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

.guild-house-badge .material-icons {
  font-size: 18px;
}

.guild-house-text {
  display: flex;
  flex: 1 1 160px;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guild-house-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: bold;
  color: var(--color-accent-text);
}

.guild-house-subtitle {
  font-size: 10px;
  font-weight: normal;
  line-height: 1.4;
  color: var(--color-text-soft);
}

/* Premium vice-leaders against the number a guild house needs: green once there are enough */
.guild-house-progress {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--color-text-muted);
  border: 1px solid #5a5a5a;
  border-radius: 10px;
  background-color: rgba(0, 0, 0, 0.35);
}

.guild-house-progress .material-icons {
  font-size: 13px;
}

.guild-house-progress.complete {
  color: var(--color-success);
  border-color: var(--color-success-dark);
}

/* Notes: the suspension of the guild, the guild house in danger and why the settings cannot be changed */
.guild-notice {
  flex: 0 0 auto;
  margin-bottom: 8px;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: normal;
  line-height: 1.5;
  color: var(--color-text-soft);
  border: 1px solid black;
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.3);
}

.guild-notice:empty {
  display: none;
}

.guild-notice.warning {
  margin-bottom: 0;
  color: var(--color-warning);
  border-color: var(--color-warning);
}

/* Rank names of the Settings tab: a label above each text box */
.guild-ranks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.guild-rank-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.guild-rank-label {
  font-size: 10px;
  font-weight: normal;
  color: var(--color-text-muted);
}

.guild-settings-actions {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0;
}

/* Lists without entries: one short sentence, like the empty chat channels */
.guild-empty {
  padding: 18px 12px;
  font-size: 10px;
  font-weight: normal;
  font-style: italic;
  text-align: center;
  color: var(--color-text-muted);
}

@media (max-width: 480px) {

  .guild-ranks {
    grid-template-columns: minmax(0, 1fr);
  }

}
