/* ============================================================
   Admiralty Command Sidebar (Game UI)
   ============================================================ */

.sidebar-game {
  width: 380px !important;
  flex-direction: row !important;
  background: var(--theme-sidebar-bg, #110905);
  background-image: 
    linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 15%, transparent 50%, rgba(0,0,0,0.6) 100%),
    repeating-linear-gradient(90deg, var(--theme-stripe-1, #1f1109) 0px, var(--theme-stripe-2, #1a0e07) 2px, var(--theme-stripe-3, #26160c) 8px, var(--theme-stripe-4, #130a05) 12px);
  border-right: 4px solid var(--theme-border, #3a2212);
  box-shadow: inset -2px 0 10px rgba(0,0,0,0.8), 5px 0 15px rgba(0,0,0,0.5);
  padding: 0 !important;
  display: flex !important;
  color: var(--theme-text, #d4b96a);
  font-family: 'Georgia', serif;
  overflow: hidden;
}

/* ── LEFT PANEL (Profile & Status) ── */
.sb-left {
  width: 140px;
  background: var(--theme-left-bg, #0d0703);
  border-right: 2px solid var(--theme-left-border, #543b1e);
  box-shadow: inset -2px 0 8px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 10px;
  position: relative;
}

/* Ornate borders on left panel */
.sb-left::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(212, 185, 106, 0.2);
  border-radius: 4px;
  pointer-events: none;
}

/* Sidebar Avatar */
.sb-avatar-container {
  width: 64px;
  height: 64px;
  position: relative;
  margin: 0 auto;
  margin-bottom: 35px; /* Added margin for nameplate */
}
.sb-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--rank-primary, var(--text-muted));
}
.sb-avatar-ring {
  position: absolute;
  top: -4px; left: -4px; right: -4px; bottom: -4px;
  border-radius: 50%;
  border: 1px dashed var(--rank-primary, rgba(255,255,255,0.2));
  animation: spin 10s linear infinite, var(--rank-glow-anim, none);
  pointer-events: none;
}

/* Nameplate */
.sb-nameplate {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--rank-secondary, #2a2a2a), #111);
  border: 1px solid var(--rank-primary, #666);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 2px 6px;
  gap: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 0 8px var(--rank-glow, transparent);
  white-space: nowrap;
  z-index: 2;
}

.sb-rank-icon {
  font-size: 12px;
  filter: drop-shadow(0 0 2px var(--rank-glow, transparent));
}

.sb-rank-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1;
}

.sb-rank-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--rank-primary, #ccc);
  letter-spacing: 0.5px;
}

.sb-captain-id {
  font-size: 11px;
  color: #ddd;
  font-family: monospace;
}

/* inner metallic rim */
.sb-avatar-ring::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Links */
.sb-left-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: auto;
}

.sb-left-links a {
  color: #a8945f;
  text-decoration: none;
  font-size: 13px;
  text-align: center;
  padding: 8px;
  transition: all 0.2s;
  cursor: pointer;
  letter-spacing: 0.5px;
}

.sb-left-links a:hover {
  color: #ffd766;
  text-shadow: 0 0 5px rgba(212, 185, 106, 0.5);
}

/* Telegraph Dial */
.sb-telegraph {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 30px;
}

.sb-telegraph-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at center, #0a110a 0%, #030603 100%);
  border: 4px solid #d4b96a;
  box-shadow: 
    inset 0 0 15px rgba(0,0,0,1),
    0 0 10px rgba(0,0,0,0.8);
  position: relative;
}

.sb-telegraph-ring::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid #6b4d24;
}

/* Dial spokes */
.sb-telegraph-ring::after {
  content: '';
  position: absolute;
  top: 50%; left: -16px; right: -16px;
  height: 4px;
  background: #d4b96a;
  transform: translateY(-50%);
  z-index: -1;
  border-radius: 2px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.sb-telegraph-spoke {
  position: absolute;
  left: 50%; top: -16px; bottom: -16px;
  width: 4px;
  background: #d4b96a;
  transform: translateX(-50%);
  z-index: -1;
  border-radius: 2px;
  box-shadow: 2px 0 5px rgba(0,0,0,0.5);
}

.sb-telegraph-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d4b96a, #856d35);
  box-shadow: 0 2px 4px rgba(0,0,0,0.8);
  z-index: 5;
}

.sb-telegraph-pointer {
  position: absolute;
  top: 15%; left: 50%;
  width: 4px;
  height: 35%;
  background: #ff3333;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(0deg);
  transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 4;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 5px rgba(255, 0, 0, 0.6);
}

/* Pointer States based on classes applied via JS */
.sb-telegraph-pointer.s-boot    { transform: translateX(-50%) rotate(90deg); background: #ffaa00; box-shadow: 0 0 5px rgba(255,170,0,0.6); }
.sb-telegraph-pointer.s-running { transform: translateX(-50%) rotate(180deg); background: #33ff77; box-shadow: 0 0 10px rgba(51,255,119,0.8); }
.sb-telegraph-pointer.s-stop    { transform: translateX(-50%) rotate(270deg); background: #888; box-shadow: none; }

.sb-telegraph-label {
  position: absolute;
  font-size: 8px;
  font-family: sans-serif;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: rgba(212, 185, 106, 0.6);
}

.sb-telegraph-label.top { top: 6px; left: 50%; transform: translateX(-50%); }
.sb-telegraph-label.right { top: 50%; right: 6px; transform: translateY(-50%) rotate(90deg); }
.sb-telegraph-label.bottom { bottom: 6px; left: 50%; transform: translateX(-50%); color: #33ff77; text-shadow: 0 0 3px #33ff77;}
.sb-telegraph-label.left { top: 50%; left: 6px; transform: translateY(-50%) rotate(-90deg); }


/* Balance Area */
.sb-balance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.sb-coin-icon {
  width: 40px;
  height: 40px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6));
}

.sb-balance-text {
  text-align: center;
}

.sb-balance-label {
  font-size: 10px;
  color: #a8945f;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sb-balance-val {
  font-size: 14px;
  font-weight: bold;
  color: #fff4d4;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  margin-top: 2px;
}

/* ── RIGHT PANEL (Navigation) ── */
.sb-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 30px 16px;
}

.sb-header {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #c7ad5c;
  text-align: center;
  margin-bottom: 30px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.sb-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #d4b96a 50%, transparent 100%);
  margin-top: 10px;
  opacity: 0.5;
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-game .nav-item {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  background: var(--theme-nav-bg, linear-gradient(180deg, #2a1a0f 0%, #170d06 100%));
  border: 2px solid var(--theme-nav-border, #6b4d24);
  border-radius: 6px;
  color: var(--theme-text, #d4b96a);
  text-decoration: none;
  box-shadow: 
    0 4px 10px rgba(0,0,0,0.6),
    inset 0 1px 1px rgba(255,255,255,0.1);
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

/* Subtle responsive corner rivets using radial gradients */
.sidebar-game .nav-item::before {
  content: '';
  position: absolute;
  inset: 4px;
  pointer-events: none;
  background: 
    radial-gradient(circle at 2px 2px, var(--theme-nav-rivet, #856d35) 2px, transparent 2.5px) top left,
    radial-gradient(circle at calc(100% - 2px) 2px, var(--theme-nav-rivet, #856d35) 2px, transparent 2.5px) top right,
    radial-gradient(circle at 2px calc(100% - 2px), var(--theme-nav-rivet, #856d35) 2px, transparent 2.5px) bottom left,
    radial-gradient(circle at calc(100% - 2px) calc(100% - 2px), var(--theme-nav-rivet, #856d35) 2px, transparent 2.5px) bottom right;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  opacity: 0.8;
}

.sidebar-game .nav-item:hover {
  background: var(--theme-nav-hover, linear-gradient(180deg, #362214 0%, #1e1109 100%));
  border-color: var(--theme-nav-border-hover, #8c6836);
  transform: translateY(-2px);
  box-shadow: 
    0 6px 15px rgba(0,0,0,0.8),
    inset 0 1px 1px rgba(255,255,255,0.15);
}

.sidebar-game .nav-item.active {
  background: var(--theme-nav-active, linear-gradient(180deg, #3a2512 0%, #291809 100%));
  border-color: var(--theme-border, #ffd766);
  box-shadow: 
    0 4px 15px rgba(0,0,0,0.8),
    0 0 15px var(--theme-glow, rgba(255, 215, 102, 0.4)),
    inset 0 0 20px var(--theme-glow-inner, rgba(212, 185, 106, 0.2));
}

/* Inner glow for active item */
.sidebar-game .nav-item.active::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--theme-glow, rgba(255,215,102,0.1)) 50%, transparent 100%);
  animation: nav-glow 2s ease-in-out infinite alternate;
}

@keyframes nav-glow {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

.sidebar-game .nav-icon {
  font-size: 32px;
  margin-right: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--theme-nav-icon, radial-gradient(circle at center, #d4b96a 0%, #856d35 100%));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8));
}

.sidebar-game .nav-item.active .nav-icon {
  background: var(--theme-nav-icon-active, radial-gradient(circle at center, #ffedb3 0%, #d4b96a 100%));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--theme-glow, rgba(255,215,102,0.6)));
}

.sidebar-game .nav-text {
  display: flex;
  flex-direction: column;
}

.sidebar-game .title {
  font-size: 16px;
  font-weight: bold;
  color: #ebd69b;
  letter-spacing: 1px;
}

.sidebar-game .nav-item.active .title {
  color: #fff4d4;
  text-shadow: 0 0 8px rgba(255,215,102,0.5);
}

.sidebar-game .subtitle {
  font-size: 11px;
  color: #a8945f;
  margin-top: 4px;
  font-family: sans-serif;
  letter-spacing: 0.5px;
}

/* ── Collapsed State ── */
.sidebar-game {
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-game.collapsed {
  width: 140px !important;
}

.sidebar-game.collapsed .sb-right {
  display: none;
  opacity: 0;
}

/* Toggle Button */
.sb-toggle-btn {
  margin-bottom: 24px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 8px rgba(0,0,0,0.6), inset 0 2px 4px rgba(255,255,255,0.3);
  z-index: 10;
}

.sb-toggle-btn:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(245, 158, 11, 0.4), inset 0 2px 4px rgba(255,255,255,0.4);
}

.sb-toggle-btn:active {
  transform: scale(0.95);
  box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.sb-toggle-btn .icon {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-size: 16px;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.sidebar-game.collapsed .sb-toggle-btn .icon {
  transform: rotate(180deg);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sidebar-game {
    display: none !important; /* Will rely on standard bottom nav for now */
  }
}
