/* ============================================================================
   CORSAIR REALMS: BRETHREN OF THE COAST — NAUTICAL MAHOGANY & GOLD THEME
   Classic 3-Column High Seas Layout in Nautical Mahogany & Gold
   ============================================================================ */

:root {
  --bg-deep: #0b0f14;
  --bg-panel: #131922;
  --bg-card: #1a222d;
  --bg-card-alt: #212b38;
  --border-brass: #6e552b;
  --border-subtle: #2c3849;
  --gold-bright: #f5b942;
  --gold-soft: #d49b35;
  --parchment: #e8dcc4;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --crimson: #ef4444;
  --emerald: #10b981;
  --cyan: #06b6d4;
  --purple: #a855f7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle at 50% 0%, rgba(245, 185, 66, 0.07), transparent 60%),
    linear-gradient(180deg, #090d12 0%, #0f1620 100%);
  color: var(--text-main);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  min-height: 100vh;
}

/* Top Header Bar */
.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(90deg, #16110a 0%, #1f1910 50%, #16110a 100%);
  border-bottom: 2px solid var(--border-brass);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-title h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  letter-spacing: 1px;
  color: var(--gold-bright);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.brand-subtitle {
  font-size: 11px;
  color: var(--parchment);
  opacity: 0.85;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 3-Column Grid */
.corsair-layout {
  display: grid;
  grid-template-columns: 225px 1fr 295px;
  gap: 10px;
  padding: 10px;
  max-width: 1680px;
  margin: 0 auto;
  align-items: start;
}

@media (max-width: 1150px) {
  .corsair-layout {
    grid-template-columns: 200px 1fr;
  }
  .right-panel {
    grid-column: 1 / -1;
  }
}

.panel-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-brass);
  border-radius: 4px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  margin-bottom: 10px;
  overflow: hidden;
}

.panel-header {
  background: linear-gradient(90deg, #271f13 0%, #1b2430 100%);
  border-bottom: 1px solid var(--border-brass);
  padding: 6px 10px;
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 13px;
  color: var(--gold-bright);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-body {
  padding: 10px;
}

/* Left Panel Navigation Links */
.nav-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-soft);
  padding: 8px 10px 4px;
  border-top: 1px solid var(--border-subtle);
}

.nav-section-title:first-child {
  border-top: none;
}

.nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover {
  background: rgba(245, 185, 66, 0.12);
  color: var(--gold-bright);
}

.nav-link.active {
  background: rgba(245, 185, 66, 0.2);
  color: var(--gold-bright);
  font-weight: 600;
  border-left: 3px solid var(--gold-bright);
}

.nav-link.primary-nav {
  font-weight: bold;
  font-size: 13px;
}

/* Buttons & Inputs */
.btn {
  background: linear-gradient(180deg, #332716 0%, #22190d 100%);
  color: var(--gold-bright);
  border: 1px solid var(--border-brass);
  border-radius: 3px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}

.btn:hover {
  background: linear-gradient(180deg, #47361e 0%, #2e2212 100%);
  border-color: var(--gold-bright);
  color: #fff;
}

.btn-primary {
  background: linear-gradient(180deg, #b47818 0%, #86560d 100%);
  color: #fff;
  border-color: var(--gold-bright);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ce8b20 0%, #9c6510 100%);
}

.btn-danger {
  background: linear-gradient(180deg, #7f1d1d 0%, #450a0a 100%);
  color: #fecaca;
  border-color: #dc2626;
}

.btn-danger:hover {
  background: linear-gradient(180deg, #991b1b 0%, #601010 100%);
  color: #fff;
}

.btn-green {
  background: linear-gradient(180deg, #065f46 0%, #064e3b 100%);
  color: #a7f3d0;
  border-color: #10b981;
}

.btn-sm {
  padding: 2px 6px;
  font-size: 11px;
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  background: #0d131a;
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 4px 7px;
  font-size: 12px;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--gold-bright);
}

/* Sector Top Row: 3x3 Compass + Course/Info */
.sector-top-grid {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .sector-top-grid {
    grid-template-columns: 1fr;
  }
}

.compass-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  background: #0e141c;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
}

.compass-cell {
  min-height: 88px;
  padding: 8px 6px;
  gap: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
}

.compass-cell:hover:not(.disabled):not(.center) {
  border-color: var(--gold-bright);
  background: rgba(245, 185, 66, 0.15);
  transform: translateY(-1px);
}

.compass-cell.center {
  background: #271f13;
  border: 2px solid var(--gold-bright);
  color: var(--gold-bright);
  font-weight: bold;
  cursor: default;
}

.compass-cell.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Data Tables */
.corsair-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.corsair-table th {
  background: #1d2633;
  color: var(--gold-bright);
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-brass);
  font-weight: 600;
}

.corsair-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.corsair-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Badges & Bars */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
}

.badge-good { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid #059669; }
.badge-evil { background: rgba(239, 68, 68, 0.2); color: #f87171; border: 1px solid #dc2626; }
.badge-neutral { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; border: 1px solid #475569; }
.badge-gold { background: rgba(245, 185, 66, 0.2); color: var(--gold-bright); border: 1px solid var(--border-brass); }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.stat-label {
  color: var(--text-muted);
}

.stat-val {
  font-weight: 600;
}

.progress-bar {
  width: 100%;
  height: 7px;
  background: #0b0f14;
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2px;
}

.progress-fill {
  height: 100%;
  transition: width 0.25s;
}

/* 10x10 Local Sea Map Grid */
.local-map-grid {
  display: grid;
  grid-template-columns: repeat(10, minmax(84px, 1fr));
  gap: 4px;
  overflow-x: auto;
}

.map-sector-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 5px;
  min-height: 74px;
  font-size: 10.5px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.12s, transform 0.1s;
}

.map-sector-card:hover {
  border-color: var(--gold-bright);
  transform: translateY(-1px);
}

.map-sector-card.spyglass-range {
  border-color: rgba(212, 163, 89, 0.55);
  background: #18222d;
}

.map-sector-card.current {
  background: #282012;
  border: 2px solid var(--gold-bright);
  box-shadow: 0 0 10px rgba(245, 185, 66, 0.35);
}

.map-sector-card.in-course {
  border-color: var(--cyan);
  background: rgba(6, 182, 212, 0.12);
}

.port-goods-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

.port-good-box {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 3px;
  border-radius: 3px;
  font-size: 10.5px;
  line-height: 1.1;
}

.port-good-box.sell {
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid #10b981;
  color: #6ee7b7;
}

.port-good-box.buy {
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid #f59e0b;
  color: #fcd34d;
}

.pg-label {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  margin-right: 1px;
  opacity: 0.95;
}

.pg-icon {
  font-size: 11px;
}

/* Feedback / Combat Banner */
.action-banner {
  background: #1b2531;
  border-left: 4px solid var(--gold-bright);
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 3px;
  white-space: pre-line;
  font-size: 12.5px;
}

.action-banner.error {
  background: rgba(127, 29, 29, 0.35);
  border-left-color: var(--crimson);
  color: #fecaca;
}

/* Login Modal / Overlay */
.auth-container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.race-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px;
  cursor: pointer;
}

.race-card.selected {
  border: 2px solid var(--gold-bright);
  background: #271f12;
}

/* Wiki Tabs */
.wiki-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
