/* House page of the game menu (Menu > House): 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: the Find a House tab fills the page with its two panels, the My House tab scrolls */
.game-menu-page.house-page {
  gap: 8px;
  overflow: hidden;
}

.house-page .house-tab-page {
  flex: 1 1 auto;
  gap: 8px;
  min-height: 0;
}

.house-page .house-tab-page[tab="mine"] {
  overflow-y: auto;
  padding-right: 2px;
}

/* Toolbar: the tabs on the left, the bank balance on the right */
.house-toolbar {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* The mark of My House while the own house needs attention */
.house-tab-alert {
  display: none;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  font-size: 9px;
  font-weight: bold;
  color: black;
  /* Without the black outline of the interface text (new.css), which turns the black mark into a blob */
  text-shadow: none;
  border-radius: 50%;
  background-color: var(--color-warning);
  box-shadow: 0 0 4px var(--color-warning);
}

.house-tab-alert.visible {
  display: flex;
}

.house-bank {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent-text);
  border: 1px solid var(--color-accent-dark);
  border-radius: 12px;
  background-color: rgba(0, 0, 0, 0.35);
}

/* The gold coin at its own size, like the gold of the NPC windows (.npc-gold) */
.house-bank img {
  flex: 0 0 auto;
}

.house-bank-balance:empty::before {
  content: "...";
}

/* Filters: the kind (houses or guild houses), the search with Only available, and the towns */
.house-filters {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 6px;
}

.house-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.house-kinds {
  flex: 0 0 auto;
}

.modal button.house-kind {
  padding: 3px 10px;
  font-size: 10px;
  white-space: nowrap;
}

.house-kind .material-icons {
  font-size: 14px;
}

.house-filter-row > .house-search-wrapper {
  flex: 1 1 160px;
  min-width: 0;
}

/* A native check box with its label (accent color, see controls.css) */
.house-check {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  white-space: nowrap;
  color: var(--color-text-soft);
  cursor: pointer;
}

.house-check input {
  margin: 0;
  cursor: pointer;
}

.house-check input:disabled,
.house-check input:disabled + span {
  cursor: default;
  opacity: 0.6;
}

.house-towns {
  flex-wrap: wrap;
}

.modal button.house-town {
  flex: 0 0 auto;
  padding: 3px 9px;
  font-size: 10px;
}

/* Panels: the list of houses on the left, the details of the selected house on the right */
.house-panels {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 45%) minmax(0, 1fr);
  gap: 8px;
  min-height: 0;
}

.house-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid black;
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.house-panel-header {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  padding: 6px 8px 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.house-count {
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-accent);
}

/* Order of the list: small text buttons, the selected one in the accent color with its direction */
.house-sorts {
  display: flex;
  gap: 2px;
}

.modal button.house-sort {
  margin: 0;
  padding: 2px 5px;
  font-size: 9px;
  font-weight: bold;
  color: var(--color-text-muted);
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.modal button.house-sort:hover {
  color: var(--color-accent-text);
}

.modal button.house-sort.selected {
  color: var(--color-accent);
  border-color: var(--color-accent-dark);
  background-color: rgba(0, 0, 0, 0.35);
}

.house-sort * {
  pointer-events: none;
}

.house-sort-arrow {
  margin-left: 2px;
  font-size: 7px;
}

.house-sort.asc .house-sort-arrow::after {
  content: "\25B2";
}

.house-sort.desc .house-sort-arrow::after {
  content: "\25BC";
}

.house-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
}

/* A house of the list: status dot, name with town and size, price; selectable like the quest log entries */
.house-entry {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
  padding: 5px 7px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 5px;
  transition: background-color 0.12s, border-color 0.12s;
}

.house-entry:not(.selected):hover {
  border-color: var(--color-accent-text);
  background-image: var(--gradient-surface-hover);
}

.house-entry.selected {
  border-color: var(--color-accent);
  background-image: var(--gradient-accent);
  box-shadow: 0 0 4px var(--color-accent-glow);
}

/* The house at the player is pinned on top */
.house-entry.here {
  margin-bottom: 6px;
  border-color: var(--color-accent-dark);
}

.house-entry-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-success);
  box-shadow: 0 0 4px var(--color-success);
}

.house-entry.rented .house-entry-dot {
  background-color: var(--color-text-dim);
  box-shadow: none;
}

.house-entry.own .house-entry-dot {
  background-color: var(--color-accent);
  box-shadow: 0 0 4px var(--color-accent-glow);
}

.house-entry-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.house-entry-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: bold;
}

.house-entry.rented:not(.own) .house-entry-name {
  color: var(--color-text-soft);
}

.house-entry-details {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: normal;
  color: var(--color-text-muted);
}

.house-entry.here .house-entry-details {
  color: var(--color-accent-text);
}

.house-entry-price {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: var(--color-accent-text);
}

.house-entry.rented .house-entry-price {
  font-weight: normal;
  color: var(--color-text-dim);
}

.house-entry.own .house-entry-price {
  color: var(--color-accent);
}

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

/* Details of the selected house */
.house-details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
}

.house-details-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.house-details-title {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.3;
  color: var(--color-accent-text);
}

.house-details-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--color-text-muted);
}

/* Map of a house: the world map around the house with the floor (top left), the zoom and floor buttons (top right) and
   Walk There (bottom right) */
.house-map {
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid black;
  border-radius: 6px;
  background-color: #0b0b0b;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8), 0 1px 3px rgba(0, 0, 0, 0.6);
}

.house-map-canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.house-map-floor {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 1px 7px;
  font-size: 9px;
  font-weight: bold;
  color: var(--color-text-soft);
  border: 1px solid black;
  border-radius: 7px;
  background-color: rgba(0, 0, 0, 0.65);
  pointer-events: none;
}

/* Another floor than the entrance is shown */
.house-map-floor.other {
  color: var(--color-accent-text);
  border-color: var(--color-accent-dark);
}

.house-map-controls {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* The floor buttons sit a bit apart from the zoom buttons */
.house-map-controls > :nth-child(3) {
  margin-top: 5px;
}

/* The small map of the My House tab, next to the numbers of the house */
.house-map.small {
  flex: 0 0 220px;
  align-self: flex-start;
}

.house-overview {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 8px;
}

.house-overview > .house-stats {
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr);
}

.modal button.house-map-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: 0;
  padding: 0;
  color: white;
  cursor: pointer;
  border: 1px solid black;
  border-radius: 50%;
  background-image: var(--gradient-surface);
  box-shadow: var(--shadow-raised);
}

.modal button.house-map-button:not(:disabled):hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.modal button.house-map-button:disabled {
  cursor: default;
  opacity: 0.4;
}

.house-map-button .material-icons {
  font-size: 14px;
  pointer-events: none;
}

/* Walk There in the bottom right corner of the map */
.modal button.house-button.house-map-walk {
  position: absolute;
  right: 6px;
  bottom: 6px;
}

/* Buy right below the map, with why it cannot be bought */
.house-buy {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 5px;
}

.house-buy .game-menu-upgrade {
  align-self: center;
}

/* Small labels: status of a house, role, You */
.house-pill {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.house-pill.available {
  color: var(--color-success);
  border-color: var(--color-success);
}

/* Guild houses: an accent label next to the status */
.house-pill.guild {
  color: var(--color-accent);
  border-color: var(--color-accent-dark);
}

.house-pill.own,
.house-pill.here {
  color: var(--color-accent-text);
  border-color: var(--color-accent);
}

/* Numbers of a house: small cards with a label above the value */
.house-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}

.house-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid black;
  border-radius: 6px;
  background-image: var(--gradient-card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.house-stat-label {
  font-size: 8px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.house-stat-value {
  font-size: 11px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  color: white;
  overflow-wrap: anywhere;
}

.house-stat.negative .house-stat-value {
  color: var(--color-warning);
}

/* What buying the house costs: the bank balance and what is left, then the Buy button */
.house-purchase {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--color-accent-dark);
  border-radius: 8px;
  background-image:
    radial-gradient(circle at 0% 0%, var(--color-accent-haze), transparent 65%),
    var(--gradient-card);
}

/* Short explanations */
.house-note {
  font-size: 10px;
  font-weight: normal;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.house-note.warning {
  color: var(--color-warning);
}

/* The guild ranks that open the doors of a guild house: one check box per rank on a row */
.house-guild-doors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

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

.modal button.house-button.wide {
  align-self: stretch;
  padding: 7px 10px;
  font-size: 11px;
}

/* Small square buttons with an icon (Kick Out) */
.modal button.house-button.icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
}

.modal button.house-button.icon .material-icons {
  font-size: 14px;
  pointer-events: none;
}

/* Buy, Leave House, Remove and Leave wait for a second click: the shared look of two-click actions (--color-confirming) */
#game-menu-modal button.house-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);
}

/* My House tab */
.house-mine {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Cards: the checklist without a house and the header of the managed house */
.house-card {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-start;
  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);
}

/* A house of the player on the My House tab: the header opens and closes it, the body holds what the role of the player can do */
.house-card.house-collapsible {
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.house-collapsible-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  border-radius: 10px;
}

.house-collapsible-header:hover .house-card-title {
  color: var(--color-accent);
}

/* Points right while closed and down while opened */
.house-collapsible-chevron {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border: solid var(--color-text-dim);
  border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
  transition: transform 0.12s, border-color 0.12s;
}

.house-collapsible-header:hover .house-collapsible-chevron {
  border-color: var(--color-accent);
}

.house-collapsible.expanded .house-collapsible-chevron {
  transform: rotate(45deg);
}

.house-collapsible-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);
}

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

.house-collapsible-tags {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

/* The warning mark of a house in danger: the same look as on the My House tab, a bit larger */
.house-collapsible-tags .house-tab-alert {
  width: 16px;
  height: 16px;
  font-size: 11px;
  line-height: 1;
}

.house-collapsible-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Leave House or Leave, on the right below the numbers */
.house-card-actions {
  display: flex;
  justify-content: flex-end;
}

.house-card-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: bold;
  color: var(--color-accent-text);
}

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

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

/* Steps to get a house: a numbered marker, a gold check when done */
.house-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.house-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-soft);
}

.house-step-marker {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  font-size: 10px;
  font-weight: bold;
  color: var(--color-accent);
  border: 2px solid var(--color-accent-dark);
  border-radius: 50%;
  background-color: var(--color-surface-bottom);
}

/* Go Premium on the premium step of free accounts */
.house-step-upgrade {
  margin-left: 4px;
}

.house-step.done {
  color: var(--color-text-muted);
}

.house-step.done .house-step-marker {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
}

.house-step.done .house-step-marker::after {
  content: "";
  width: 3px;
  height: 7px;
  margin-top: -2px;
  border: solid var(--color-accent-darker);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Warnings of the own house */
.house-notice {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 6px;
  padding: 7px 10px;
  font-size: 10px;
  font-weight: normal;
  line-height: 1.5;
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
  border-radius: 8px;
  background-color: rgba(0, 0, 0, 0.3);
}

.house-notice .material-icons {
  flex: 0 0 auto;
  font-size: 14px;
}

/* Section heading: the line of the section sits between the title and the count */
.house-collapsible-body > .house-section {
  margin: 6px 0 0;
}

.house-section-count {
  order: 1;
  flex: 0 0 auto;
  font-weight: normal;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-muted);
}

/* The invite form: name, role and Invite on one line */
.house-invite {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

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

/* Guest and Subowner: two small tabs */
.house-role-switch {
  flex: 0 0 auto;
  padding: 2px;
  gap: 2px;
}

.modal button.house-role {
  padding: 2px 7px;
  font-size: 9px;
}

/* A person with access (or a house the player may enter): badge, name and the controls on the right */
.house-guest {
  display: flex;
  flex-wrap: wrap;
  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);
}

.house-guest-badge {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 12px;
  font-weight: bold;
  color: var(--color-accent);
  border: 1px solid var(--color-accent-dark);
  border-radius: 7px;
  background-image: radial-gradient(circle at 30% 25%, #555555, #1a1a1a 80%);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Outfit of a guest (like the member rows of the Guild page): the 40px preview (see Canvas.drawOutfitPreview) is centered and
   clipped to the badge */
.house-guest-outfit {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  overflow: hidden;
}

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

.house-guest-name {
  display: flex;
  flex: 1 1 100px;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: bold;
}

.house-guest-name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The people with access below their search box (rows that do not match are hidden) */
.house-guest-search {
  flex: 0 0 auto;
}

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

.house-guest-controls {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

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

/* Narrow screens: the list goes above the details */
@media (max-width: 640px) {

  .house-panels {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(120px, 45%) 1fr;
  }

  .house-overview {
    flex-direction: column;
    align-items: stretch;
  }

  .house-map.small {
    flex: 0 0 auto;
    align-self: center;
    width: 220px;
  }

}
