/* ============================================================
   Recruitment Center (The Tavern) - Horizontal Roster
   ============================================================ */
.tavern-page {
  padding: 40px;
  background: transparent;
  color: #d4b96a;
  min-height: 100%;
  max-width: none;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.tavern-header {
  border-bottom: 1px solid rgba(212, 185, 106, 0.2);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.tavern-header h1 {
  font-family: 'Georgia', serif;
  font-size: 32px;
  color: #ebd69b;
  margin: 0;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

/* ── Roster view header ── */
.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* ── Editor view header ── */
.editor-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
}

.editor-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.editor-team-name {
  font-size: 18px;
  font-weight: bold;
  margin: 0 4px;
}

.editor-team-name-input {
  font-size: 18px;
  font-weight: bold;
  width: 220px;
  display: none;
}

.editor-summary {
  text-align: left;
  width: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
}

/* ── Fleet cards grid ── */
.fleet-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.fleet-card {
  background: var(--theme-card-bg, rgba(28, 43, 62, 0.7));
  backdrop-filter: blur(12px);
  border: 1px solid var(--theme-card-border, #37474f);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.fleet-card-header {
  justify-content: flex-start;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--theme-card-border, #37474f);
  padding-bottom: 12px;
  height: auto;
}

.fleet-card-name {
  font-size: 20px;
  font-weight: bold;
  color: var(--theme-accent, #ebd69b);
}

.fleet-card-subtitle {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 4px;
}

.fleet-card-stats {
  margin-bottom: 16px;
}

.fleet-card-actions {
  display: flex;
  gap: 10px;
}

.fleet-manage-btn {
  flex: 1;
  border-color: var(--theme-accent, #ebd69b);
  color: var(--theme-accent, #ebd69b);
}

/* ── Compact button variant ── */
.btn-compact {
  padding: 8px 16px;
  font-size: 13px;
}

.stat-val-white {
  color: #fff;
}

.team-summary-box {
  text-align: right;
  background: rgba(0, 0, 0, 0.4);
  padding: 10px 20px;
  border-radius: 6px;
  border: 1px solid rgba(212, 185, 106, 0.1);
}

.ship-req-display {
  font-size: 13px;
  color: #ff8a65;
  margin-top: 0;
}

/* ── 3D Carousel Roster ── */
.roster-carousel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
  perspective: 1200px;
  overflow: hidden;
  padding: 20px 0;
  margin-top: 20px;
}

.roster-3d-container {
  position: relative;
  width: 320px;
  height: 500px;
  transform-style: preserve-3d;
}

/* ── Crew Card Large ── */
.crew-card-large {
  position: absolute;
  top: 0;
  left: 0;
  width: 320px;
  height: 500px;
  display: flex;
  flex-direction: column;
  background: var(--theme-card-bg, linear-gradient(180deg, rgba(28, 43, 62, 0.8) 0%, rgba(13, 21, 33, 0.8) 100%));
  backdrop-filter: blur(16px);
  border: 1px solid var(--theme-card-border, #37474f);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease, filter 0.6s ease;
  overflow: hidden;
}

.crew-card-large.content-expanded {
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease, filter 0.6s ease, height 0.2s ease;
}

/* Active card hover effect */
.crew-card-large.active-card:hover {
  transform: translateY(-5px) scale(1.02) !important;
  border-color: var(--theme-accent, #d4b96a);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), inset 0 0 20px var(--theme-glow-inner, rgba(212, 185, 106, 0.1));
}

/* Overlay to block clicks on side cards */
.crew-card-large::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 50;
  display: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
}

.crew-card-large:not(.active-card)::after {
  display: block;
}

/* Navigation Buttons */
.carousel-btn {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  background: rgba(10, 20, 30, 0.8);
  border: 2px solid var(--theme-accent, #d4b96a);
  color: var(--theme-accent, #d4b96a);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.8);
}

.carousel-btn:hover {
  background: var(--theme-accent, #d4b96a);
  color: #000;
  transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
  left: 40px;
}

.carousel-btn.next {
  right: 40px;
}

.cc-header {
  flex: 0 0 auto;
  text-align: center;
  padding: 12px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 2px solid #d4b96a;
  font-family: 'Georgia', serif;
  font-weight: bold;
  font-size: 18px;
  color: #ebd69b;
  letter-spacing: 1px;
}

.cc-header-relative {
  position: relative;
}

/* ── Crew name inline editing ── */
.cc-name-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.cc-name-input {
  display: none;
  width: 120px;
  text-align: center;
  font-family: inherit;
  font-size: inherit;
  background: var(--bg-card, #1c2b3e);
  color: var(--text-main, #ebd69b);
  border: 1px solid var(--border-color, #37474f);
  border-radius: 4px;
  padding: 2px 4px;
}

.cc-rename-btn {
  padding: 10px 14px;
  min-width: 44px;
  min-height: 44px;
  opacity: 0.6;
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cc-title {
  font-size: 11px;
  opacity: 0.7;
  display: block;
  margin-top: 2px;
}

.cc-avatar-box {
  flex: 0 0 205px;
  width: 100%;
  height: 205px;
  box-sizing: border-box;
  padding-top: 10px;
  overflow: hidden;
  position: relative;
  background: transparent;
}

/* Bottom gradient fade — lets badges blend over the avatar naturally */
.cc-avatar-box::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: clamp(32px, 22%, 80px);
  background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.58) 100%);
  pointer-events: none;
  z-index: 5;
}

.cc-avatar,
.add-avatar-anim {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.5s ease;
  filter: brightness(0.9) contrast(1.1);
}

.crew-card-large:hover .cc-avatar {
  transform: scale(1.05);
  filter: brightness(1.1) contrast(1.1);
}

.cc-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 14px 12px;
}

/* Intelligence Toggle */
.cc-intel-toggle {
  display: flex;
  background: #0b111a;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #37474f;
  margin-bottom: 12px;
}

.intel-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #78909c;
  padding: 10px 0;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.intel-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.intel-btn.active.reef {
  background: #3e2723;
  color: #d7ccc8;
}

.intel-btn.active.voyager {
  background: #004d40;
  color: #80cbc4;
}

.intel-btn.active.oracle {
  background: #4a148c;
  color: #ce93d8;
}

.intel-btn.active.byok {
  background: #1a237e;
  color: #c5cae9;
}

/* BYOK pay-as-you-go cost label */
.stat-val.byok-cost {
  color: #c5cae9;
  font-weight: 600;
}

/* BYOK status row beneath the cost stats */
.cc-byok-status {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(26, 35, 126, 0.18);
  border: 1px solid rgba(63, 81, 181, 0.35);
  font-size: 12px;
  flex: 0 0 auto;
  overflow: visible;
}

.cc-byok-status .byok-status-link {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #c5cae9;
  text-decoration: none;
  font: inherit;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.cc-byok-status .byok-status-icon {
  flex: 0 0 auto;
}

.cc-byok-status .byok-status-text {
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
}

.cc-byok-status .byok-status-link:hover {
  color: #fff;
}

.cc-byok-status.byok-ok {
  background: rgba(38, 166, 154, 0.15);
  border-color: rgba(38, 166, 154, 0.45);
}

.cc-byok-status.byok-ok .byok-status-link { color: #b2dfdb; }

.cc-byok-status.byok-warn {
  background: rgba(255, 152, 0, 0.12);
  border-color: rgba(255, 152, 0, 0.4);
}

.cc-byok-status.byok-warn .byok-status-link { color: #ffcc80; }

.byok-role-modal {
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #0b111a;
  border: 1px solid rgba(212, 185, 106, 0.28);
  border-radius: 10px;
  padding: 18px;
  margin: 24px auto;
}

.byok-role-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.byok-role-modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.byok-role-close,
.byok-role-remove {
  border: 0;
  background: transparent;
  color: #90a4ae;
  cursor: pointer;
}

.byok-role-hint,
.byok-role-empty {
  color: #90a4ae;
  font-size: 13px;
}

.byok-role-route-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0;
}

.byok-role-route-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(220px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.byok-role-route-row label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #b0bec5;
  font-size: 12px;
}

.byok-role-route-row select {
  min-width: 0;
  width: 100%;
  background: #0b111a;
  color: #cfd8dc;
  border: 1px solid #37474f;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
}

.byok-role-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 640px) {
  .byok-role-modal {
    width: calc(100vw - 16px);
    margin: 8px auto;
    padding: 14px;
  }

  .byok-role-route-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .byok-role-remove {
    justify-self: end;
  }

  .byok-role-actions {
    flex-direction: column;
  }
}

/* Stats Table */
.cc-stats {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: #b0bec5;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 4px;
}

.stat-val {
  font-weight: bold;
  font-family: monospace;
  font-size: 15px;
}

.stat-val.gold {
  color: #ffd766;
}

.stat-val.low {
  color: #cfd8dc;
}

.stat-val.med {
  color: #29b6f6;
}

.stat-val.high {
  color: #ab47bc;
}

/* Add Sailor Card */
.add-sailor-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed #455a64;
  cursor: pointer;
}

.add-sailor-card:hover {
  background: rgba(212, 185, 106, 0.05);
  border-color: #d4b96a;
}

.add-sailor-card.disabled {
  cursor: not-allowed;
  opacity: 0.55;
  border-color: rgba(255, 180, 168, 0.35);
  background: rgba(255, 80, 80, 0.06);
}

.add-sailor-card.disabled:hover {
  background: rgba(255, 80, 80, 0.06);
  border-color: rgba(255, 180, 168, 0.35);
}

.add-sailor-btn-inner {
  text-align: center;
  color: #90a4ae;
  font-family: 'Georgia', serif;
  font-size: 20px;
}

.add-sailor-hint {
  font-size: 14px;
  opacity: 0.6;
  display: block;
  margin-top: 8px;
}

.add-sailor-card:hover .add-sailor-btn-inner {
  color: #d4b96a;
}

.delete-sailor-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #ff5252;
  color: #ff5252;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-sailor-btn:hover {
  background: #ff5252;
  color: #fff;
}

/* ── Prominent Skill Badges ── */
.cc-skill-badges {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: -4px;
  margin-bottom: 10px;
  position: relative;
  z-index: 10;
}

.cc-skill-badge {
  position: relative;
  width: 122px;
  height: 42px;
  border-radius: 8px;
  border: 2px solid #d4b96a;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.95), 0 0 12px rgba(212, 185, 106, 0.15), inset 0 0 10px rgba(0, 0, 0, 0.5);
  background: rgba(8, 18, 31, 0.82);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 0 8px;
  transition: transform 0.3s;
}

.cc-skill-badge:hover {
  transform: translateY(-2px);
  z-index: 15;
}

.cc-skill-badge img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 5px;
  flex: 0 0 auto;
}

/* Optional tooltip label below the badge */
.cc-skill-badge-name {
  min-width: 0;
  color: #ffd54f;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  pointer-events: none;
}

.skill-icon {
  display: none;
  /* Hide the old tiny list icon */
}

.skill-icon-val {
  display: flex !important;
  align-items: center;
}

.crew-member-dock {
  display: none;
}

@media (max-width: 768px), (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .crew-member-dock {
    position: static;
    z-index: 90;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    margin: 0 0 12px;
    background: rgba(9, 14, 22, 0.94);
    border-top: 1px solid rgba(212, 185, 106, 0.22);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(14px);
    scrollbar-width: none;
  }

  .roster-carousel-wrapper {
    flex: 0 0 auto;
    overflow: visible;
  }

  .crew-member-dock::-webkit-scrollbar {
    display: none;
  }

  .crew-member-dock-item {
    flex: 0 0 72px;
    border: 1px solid rgba(212, 185, 106, 0.18);
    border-radius: 8px;
    background: rgba(22, 31, 45, 0.78);
    color: rgba(232, 213, 176, 0.75);
    padding: 7px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
  }

  .crew-member-dock-item.active {
    border-color: rgba(255, 217, 118, 0.78);
    color: #ffe39a;
    background: linear-gradient(180deg, rgba(212, 185, 106, 0.22), rgba(22, 31, 45, 0.9));
  }

  .dock-avatar-wrap {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(212, 185, 106, 0.35);
    background: rgba(0, 0, 0, 0.34);
  }

  .dock-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .dock-role-icon {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 15px;
    height: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(4, 8, 14, 0.92);
    color: #ffd976;
    font-size: 9px;
    border: 1px solid rgba(212, 185, 106, 0.45);
  }

  .dock-label {
    max-width: 62px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

}

/* ── Tier-based Dynamic Styling (Avatars and Cards) ── */
/* 1. Reef (Novice) - Rust Orange / Gritty Base */
.crew-card-large[data-tier="reef"] {
  border-color: #e65100; /* Industrial Orange */
}
.crew-card-large[data-tier="reef"].active-card:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(230, 81, 0, 0.3);
}
.crew-card-large[data-tier="reef"] .cc-avatar {
  filter: drop-shadow(0 0 15px rgba(230, 81, 0, 0.4)) brightness(0.95);
}
.crew-card-large[data-tier="reef"]:hover .cc-avatar {
  filter: drop-shadow(0 0 30px rgba(255, 87, 34, 0.9)) brightness(1.1);
}

/* 2. Voyager (Adept) - Ice Cyan / Netrunner Blue */
.crew-card-large[data-tier="voyager"] {
  border-color: #00e5ff; /* Neon Cyan */
}
.crew-card-large[data-tier="voyager"].active-card:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), inset 0 0 25px rgba(0, 229, 255, 0.3);
}
.crew-card-large[data-tier="voyager"] .cc-avatar {
  filter: drop-shadow(0 0 15px rgba(0, 229, 255, 0.6)) brightness(1.05);
}
.crew-card-large[data-tier="voyager"]:hover .cc-avatar {
  filter: drop-shadow(0 0 35px rgba(0, 229, 255, 1)) brightness(1.15);
}

/* 3. Oracle (Master) - Singularity Violet / Void Magenta */
.crew-card-large[data-tier="oracle"] {
  border-color: #d500f9; /* Violet */
}
.crew-card-large[data-tier="oracle"].active-card:hover {
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.9), inset 0 0 30px rgba(213, 0, 249, 0.4);
}
.crew-card-large[data-tier="oracle"] .cc-avatar {
  filter: drop-shadow(0 0 20px rgba(213, 0, 249, 0.6)) brightness(1.1);
}
.crew-card-large[data-tier="oracle"]:hover .cc-avatar {
  filter: drop-shadow(0 0 45px rgba(213, 0, 249, 1)) brightness(1.2);
}
