/* ===== THEME BASICS (body + main background) ===== */
:root {
  --focus-contrast: #ffffff;
}
body.theme-light,
body.theme-light .w3-main {
  --bg-color: #F5F5F5;
  background-color: #F5F5F5;
  color: #111827;
}

body.theme-dark,
body.theme-dark .w3-main {
  --bg-color: #3f4e5a;
  background-color: #3f4e5a;
  color: #e5e7eb;
}

body.theme-grays,
body.theme-grays .w3-main {
  --bg-color: #f3f4f6;
  background-color: #f3f4f6;
  color: #111827;
}

/* ===== GLOBAL ACCENT HELPERS (driven by --focus-color) ===== */

/* Generic "panel/header" strip that uses the current focus color */
/* Generic "panel/header" strip that uses the current focus color */
.dr-panel-header {
  background: var(--focus-color);
  color: var(--focus-contrast, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Reusable accent background (also maps legacy .mycolor) */
.dr-accent-bg,
.mycolor {
  background: var(--focus-color);
  color: var(--focus-contrast, #fff);
}
.mycolor {
  color: var(--focus-contrast, #fff) !important;
}

/* Accent text only */
.dr-accent-text {
  color: var(--focus-color);
}

/* Accent border helper (for cards/buttons if you want) */
.dr-accent-border {
  border-color: var(--focus-color);
}


/* ===== SIDEBAR BASE ===== */

.side-nav {
  width: 200px;
  padding: 0;
  z-index: 100;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  border-right: 2px solid var(--focus-color);
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
}

body.theme-dark .side-nav {
  background: rgba(17, 24, 39, 0.98);
  border-right-color: var(--focus-color);
  color: #e5e7eb;
}

body.theme-grays .side-nav {
  background: rgba(243, 244, 246, 0.98);
  border-right-color: var(--focus-color);
}

/* store name bar */

.side-store-bar {
  padding: 2px;
  height: 20px;
  font-size: 11px;
  background: var(--focus-color);
  color: var(--focus-contrast, #fff);
}

/* links */

.side-link {
  padding: 6px 10px !important;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-link i.side-icon {
  width: 32px;          /* wider to comfortably fit 2xl icon */
  text-align: center;
  font-size: 1.75rem;   /* roughly 2x the old size */
  line-height: 1;
  flex-shrink: 0;
}

.side-link:hover {
  text-decoration: none;
}

body.theme-light .side-link:hover {
  background: rgba(23, 103, 167, 0.06);
}

body.theme-dark .side-link:hover {
  background: rgba(148, 163, 184, 0.15);
}

body.theme-grays .side-link:hover {
  background: rgba(107, 114, 128, 0.10);
}

/* active link */

.side-active {
  font-weight: 600;
  border-left: 4px solid var(--focus-color);
}

body.theme-light .side-active {
  background: color-mix(in srgb, var(--focus-color) 12%, #ffffff) !important;
  color: var(--focus-color) !important;
}

body.theme-dark .side-active {
    background: color-mix(in srgb, var(--focus-color) 28%, #0b1626) !important;
    color: var(--focus-color) !important;
    border-left-color: var(--focus-color);
  }

body.theme-grays .side-active {
  background: color-mix(in srgb, var(--focus-color) 12%, #f9fafb) !important;
  color: #111827 !important;
  border-left-color: var(--focus-color);
}

/* when we explicitly hide the sidebar */
#mySidebar.sidebar-hidden {
  display: none !important;
}

.side-hide-bottom {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.side-hide-bottom .side-hide-btn {
  border: 0;
  background: transparent;
  padding: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-hide-bottom .side-hide-icon {
  font-size: 1.6rem; /* nice visible circle */
}

.side-station-label {
  font-size: 11px;
  color: rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
body.theme-dark .side-station-label {
  color: rgba(255,255,255,0.75);
}


/* floating show button (for desktop when sidebar is hidden) */
#sideShowBtn {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
  display: none; /* only show when sidebar is hidden */
}

/* === AI Assist Drawer === */
.ai-drawer-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.35);
  z-index:11000; opacity:0; pointer-events:none;
  transition:opacity .15s ease;
}
.ai-drawer-overlay.show{ opacity:1; pointer-events:auto; }
.ai-drawer{
  position:fixed; top:0; right:-420px; width:360px; max-width:92vw; height:100vh;
  background: rgba(255,255,255,0.96);
  color:#0f172a;
  box-shadow:-6px 0 18px rgba(0,0,0,0.35);
  z-index:11001; display:flex; flex-direction:column;
  transition:right .18s ease;
}
body.theme-dark .ai-drawer{
  background: rgba(15,23,42,0.95);
  color:#e5e7eb;
}
.ai-drawer.open{ right:0; }
.ai-drawer.ai-drawer-pos-right{
  top:0;
  right:-420px;
  left:auto;
  bottom:auto;
  width:360px;
  max-width:92vw;
  height:100vh;
  max-height:none;
  box-shadow:-6px 0 18px rgba(0,0,0,0.35);
  transition:right .18s ease;
}
.ai-drawer.ai-drawer-pos-right.open{ right:0; }
.ai-drawer.ai-drawer-pos-bottom{
  top:auto;
  right:0;
  left:0;
  bottom:-62vh;
  width:100vw;
  max-width:100vw;
  height:42vh;
  max-height:560px;
  min-height:280px;
  box-shadow:0 -6px 18px rgba(0,0,0,0.35);
  transition:bottom .18s ease;
}
.ai-drawer.ai-drawer-pos-bottom.open{
  right:0;
  bottom:0;
}
.ai-drawer-header{
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 14px; font-weight:700; border-bottom:1px solid rgba(0,0,0,0.08);
}
body.theme-dark .ai-drawer-header{ border-color:rgba(255,255,255,0.1); }
.ai-close-btn{
  background:transparent; border:0; font-size:22px; cursor:pointer; color:inherit;
}
.ai-chat-log{
  flex:1 1 auto; overflow:auto; padding:10px 14px; gap:6px; display:flex; flex-direction:column;
}
.ai-chat-note{ font-size:12px; opacity:0.7; }
.ai-msg{ padding:6px 8px; border-radius:8px; font-size:13px; line-height:1.35; }
.ai-msg.ai-user{ background: color-mix(in srgb, var(--focus-color,#1767a7) 14%, #fff); color:#0f172a; }
.ai-msg.ai-bot{ background: rgba(0,0,0,0.04); }
body.theme-dark .ai-msg.ai-user{ background: color-mix(in srgb, var(--focus-color,#1767a7) 26%, #0b1626); color:#e5e7eb; }
body.theme-dark .ai-msg.ai-bot{ background: rgba(255,255,255,0.04); }
.ai-input-wrap{
  padding:10px 14px; border-top:1px solid rgba(0,0,0,0.08);
  display:flex; flex-direction:column; gap:8px;
}
body.theme-dark .ai-input-wrap{ border-color:rgba(255,255,255,0.1); }
.ai-input-wrap textarea{
  width:100%; resize:vertical; min-height:60px;
  border:1px solid rgba(148,163,184,0.6);
  border-radius:8px; padding:8px; font-size:13px;
  background:inherit; color:inherit;
}
.ai-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
}
.ai-pin-actions{
  display:flex;
  align-items:center;
  gap:6px;
}
.ai-main-actions{
  display:flex;
  align-items:center;
  gap:8px;
}
.ai-pin-btn{
  width:30px;
  height:30px;
  border-radius:8px;
  border:1px solid rgba(148,163,184,0.6);
  background:transparent;
  color:inherit;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
}
.ai-pin-btn:hover{
  border-color: var(--focus-color, #1767a7);
  color: var(--focus-color, #1767a7);
}
.ai-pin-btn.is-active{
  border-color: var(--focus-color, #1767a7);
  background: color-mix(in srgb, var(--focus-color, #1767a7) 18%, transparent);
  color: var(--focus-color, #1767a7);
}
.ai-btn{
  padding:6px 12px; border-radius:8px; border:1px solid var(--focus-color,#1767a7);
  background: var(--focus-color,#1767a7); color: var(--focus-contrast, #fff); cursor:pointer;
}
.ai-btn-ghost{
  background: transparent; color: inherit; border-color: rgba(148,163,184,0.6);
}
/* ===== PAGEBAR THEME VARIANTS ===== */

/* Light (default) – we keep the card white, subtle border */
body.theme-light .pagebar {
  background: #ffffff;
  border-color: rgba(0,0,0,0.05);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* Dark – dark card matching the dark body */
body.theme-dark .pagebar {
  background: #111827;
  border-color: #111827;
  box-shadow: 0 2px 10px rgba(0,0,0,0.7);
}


/* Grays – soft light-gray card */
body.theme-grays .pagebar {
  background: #f9fafb;
  border-color: #e5e7eb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
/* Default accent background (light + grays) */
.dr-accent-bg {
  background-color: var(--focus-color, #1767a7);
  color: #fff;
}

/* In dark theme, use the lighter panel color instead of full accent */
body.theme-dark .dr-accent-bg {
  background-color: #3f4e5a;         /* same “lighter back color” you’re using in dark panels */
  color: #f9fafb;
  border: 1px solid rgba(148,163,184,0.6);
}
