/* ================================================================
   EduMate Ghana — Layout V2: Header, Footer, Drawer, A11y, PWA
   Ghana Color System + Responsive Grid
   ================================================================ */

/* Design Tokens */
:root {
  --ghana-green: #006B3F;
  --ghana-gold:  #FCD116;
  --ghana-red:   #CE1126;
  --ghana-black: #000000;
  --surface:     #FFFFFF;
  --bg:          #F7F8FA;
  --text-primary:#1A1A1A;
  --text-muted:  #6B7280;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   20px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --font-scale:  1;
}
html { font-size: calc(16px * var(--font-scale)); }
body { font-family: 'Nunito Sans', 'Nunito', sans-serif; }

/* Accessibility overrides */
.high-contrast  { filter: contrast(1.6) !important; }
.dyslexic-font  { font-family: 'OpenDyslexic', Arial, sans-serif !important; }

/* ================================================================
   SITE HEADER
   ================================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: #fff;
  border-bottom: 2px solid var(--ghana-gold);
  transition: box-shadow .25s;
}
.site-header.scrolled { box-shadow: 0 2px 20px rgba(0,107,63,.15); }
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
}

/* Logo */
.header-logo { display: flex; align-items: center; gap: .5rem; text-decoration: none; flex-shrink: 0; }
.logo-svg    { width: 40px; height: 40px; border-radius: 8px; }
.logo-wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.logo-edu    { font-size: 1.1rem; font-weight: 900; color: var(--ghana-green); }
.logo-mate   { font-size: 1.1rem; font-weight: 900; color: #111; }
.logo-ghana-tag {
  font-size: .6rem; font-weight: 700; letter-spacing: .08em;
  background: var(--ghana-green); color: #fff; border-radius: 3px;
  padding: 1px 4px; align-self: flex-start; margin-top: 1px;
}

/* Desktop nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: .2rem;
  flex: 1;
  justify-content: center;
}
.hnav-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .45rem .8rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .875rem;
  color: #374151;
  text-decoration: none;
  transition: .2s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.hnav-link:hover, .hnav-link.active { background: #dcfce7; color: var(--ghana-green); }
.caret { font-size: .65rem; opacity: .7; }
.hnav-more-wrap { position: relative; }
.hnav-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  min-width: 200px;
  padding: .5rem;
  z-index: 300;
  display: none;
}
.hnav-dropdown.open { display: block; }
.hnav-dd-item {
  display: block;
  padding: .5rem .875rem;
  border-radius: var(--radius-sm);
  color: #374151;
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  transition: .15s;
}
.hnav-dd-item:hover { background: #dcfce7; color: var(--ghana-green); }

/* Right side actions */
.header-actions { display: flex; align-items: center; gap: .625rem; margin-left: auto; }
.btn-header-outline {
  display: inline-flex; align-items: center;
  padding: .4rem .9rem;
  border: 2px solid var(--ghana-green);
  border-radius: 50px;
  color: var(--ghana-green);
  font-weight: 700;
  font-size: .875rem;
  text-decoration: none;
  transition: .2s;
}
.btn-header-outline:hover { background: var(--ghana-green); color: #fff; }
.btn-header-primary {
  display: inline-flex; align-items: center;
  padding: .4rem .9rem;
  background: var(--ghana-green);
  border: 2px solid var(--ghana-green);
  border-radius: 50px;
  color: #fff;
  font-weight: 700;
  font-size: .875rem;
  text-decoration: none;
  transition: .2s;
}
.btn-header-primary:hover { background: #004d2e; border-color: #004d2e; color: #fff; }

/* Token pill */
.token-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: linear-gradient(135deg, #006B3F, #008E52);
  color: #fff;
  padding: .35rem .875rem;
  border-radius: 50px;
  font-weight: 800;
  font-size: .875rem;
  text-decoration: none;
  transition: .2s;
  border: 2px solid rgba(252,209,22,.4);
}
.token-pill:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,107,63,.3); color: #fff; }
.token-icon { width: 16px; height: 16px; }
.token-count { min-width: 2ch; text-align: center; }

/* Language dropdown */
.lang-selector-wrap { position: relative; }
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 50px;
  padding: .35rem .75rem;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
}
.lang-btn:hover { border-color: var(--ghana-green); color: var(--ghana-green); }
.lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  min-width: 140px;
  padding: .375rem;
  z-index: 300;
  display: none;
}
.lang-dropdown.open { display: block; }
.lang-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: .45rem .75rem;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .875rem;
  font-weight: 600;
  transition: .15s;
  font-family: inherit;
}
.lang-option:hover { background: #dcfce7; color: var(--ghana-green); }

/* Notification bell */
.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: .2s;
  color: #374151;
}
.notif-bell svg { width: 22px; height: 22px; }
.notif-bell:hover { background: #f3f4f6; color: var(--ghana-green); }
.notif-bell.active { color: var(--ghana-green); }
.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--ghana-red);
  color: #fff;
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  font-size: .65rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.notif-panel {
  position: fixed;
  top: 70px;
  right: 1.25rem;
  width: 320px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 250;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 1rem;
  border-bottom: 1px solid #e5e7eb;
}
.notif-panel-header h3 { font-size: .95rem; font-weight: 800; color: #111827; }
.btn-text-sm { background: none; border: none; cursor: pointer; color: var(--ghana-green); font-size: .8rem; font-weight: 700; font-family: inherit; }
.notif-panel-body { max-height: 300px; overflow-y: auto; }
.notif-panel-footer { padding: .625rem 1rem; border-top: 1px solid #e5e7eb; text-align: center; }
.notif-item { padding: .75rem 1rem; border-bottom: 1px solid #f3f4f6; }
.notif-title { font-weight: 700; font-size: .85rem; color: #111827; }
.notif-msg { font-size: .8rem; color: #6b7280; margin-top: .2rem; }
.notif-empty { padding: 1.5rem; text-align: center; color: #9ca3af; font-size: .875rem; }

/* User avatar + dropdown */
.user-avatar-wrap { position: relative; }
.user-avatar-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 50px;
  padding: .35rem .625rem .35rem .35rem;
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
}
.user-avatar-btn:hover { border-color: var(--ghana-green); background: #f0fdf4; }
.user-initials-circle {
  width: 30px;
  height: 30px;
  background: var(--ghana-green);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .8rem;
  flex-shrink: 0;
}
.user-display-name { font-size: .875rem; font-weight: 700; color: #374151; }
.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  min-width: 200px;
  padding: .5rem;
  z-index: 300;
  display: none;
}
.user-dropdown.open { display: block; }
.user-dropdown-header { padding: .625rem .875rem .5rem; }
.ud-name { font-weight: 800; font-size: .9rem; color: #111827; }
.ud-role { font-size: .78rem; color: #6b7280; font-weight: 600; }
.ud-divider { border: none; border-top: 1px solid #e5e7eb; margin: .375rem 0; }
.ud-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5rem .875rem;
  border-radius: var(--radius-sm);
  color: #374151;
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  transition: .15s;
}
.ud-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.ud-item:hover { background: #dcfce7; color: var(--ghana-green); }
.ud-logout:hover { background: #fee2e2; color: #991b1b; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 36px;
  height: 26px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 0;
  flex-shrink: 0;
}
.ham-bar { display: block; height: 3px; background: #374151; border-radius: 2px; transition: .3s; }
.hamburger.active .ham-bar:nth-child(1) { transform: translateY(10px) rotate(45deg); }
.hamburger.active .ham-bar:nth-child(2) { opacity: 0; }
.hamburger.active .ham-bar:nth-child(3) { transform: translateY(-10px) rotate(-45deg); }

@media (max-width: 1024px) { .header-nav { display: none; } }
@media (max-width: 768px)  { .hamburger { display: flex; } .d-none-sm { display: none !important; } }
@media (max-width: 640px)  { .lang-selector-wrap { display: none; } }

/* ================================================================
   MOBILE DRAWER
   ================================================================ */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 398;
  opacity: 0;
  pointer-events: none;
  transition: .3s;
}
.mobile-drawer-overlay.visible { opacity: 1; pointer-events: all; }
.mobile-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(320px, 90vw);
  height: 100vh;
  background: #fff;
  z-index: 399;
  transition: .35s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.mobile-drawer.open { right: 0; }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: var(--ghana-green);
  color: #fff;
  flex-shrink: 0;
}
.drawer-logo { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.drawer-close {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
}
.drawer-close:hover { background: rgba(255,255,255,.35); }
.drawer-user-card {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 1rem 1.25rem;
  background: #f0fdf4;
  border-bottom: 1px solid #d1fae5;
}
.duc-avatar {
  width: 44px;
  height: 44px;
  background: var(--ghana-green);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.duc-info { flex: 1; min-width: 0; }
.duc-name { font-weight: 800; font-size: .9rem; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.duc-role { font-size: .75rem; color: #6b7280; font-weight: 600; }
.duc-tokens {
  background: var(--ghana-green);
  color: #fff;
  border-radius: 50px;
  padding: .25rem .625rem;
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
  flex-shrink: 0;
}
.drawer-nav { flex: 1; padding: .75rem; display: flex; flex-direction: column; gap: .15rem; }
.drawer-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  border-radius: var(--radius-sm);
  color: #374151;
  font-weight: 700;
  font-size: .9rem;
  text-decoration: none;
  transition: .15s;
}
.drawer-link:hover { background: #dcfce7; color: var(--ghana-green); }
.drawer-footer { padding: .875rem 1.25rem; border-top: 1px solid #e5e7eb; flex-shrink: 0; }
.drawer-logout { display: block; text-align: center; color: #ef4444; font-weight: 700; padding: .625rem; text-decoration: none; font-size: .9rem; }
.drawer-cta { background: var(--ghana-green) !important; color: #fff !important; border-radius: 50px; text-align: center; margin-top: .5rem; }

/* ================================================================
   FLASH MESSAGES
   ================================================================ */
.flash {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  border-left: 4px solid;
  animation: flashSlideIn .3s ease;
}
@keyframes flashSlideIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.flash svg { width: 20px; height: 20px; flex-shrink: 0; }
.flash-success { background: #dcfce7; color: #166534; border-color: #22c55e; }
.flash-error   { background: #fee2e2; color: #991b1b; border-color: #ef4444; }
.flash-close {
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  opacity: .6;
  font-size: 1rem;
  line-height: 1;
  padding: .2rem;
  flex-shrink: 0;
}
.flash-close:hover { opacity: 1; }

/* ================================================================
   SITE FOOTER
   ================================================================ */
.site-footer { background: #0f1923; color: rgba(255,255,255,.8); margin-top: auto; }

/* Ghana flag bar */
.footer-flag-bar { display: flex; height: 6px; width: 100%; }
.flag-seg { flex: 1; }
.flag-green { background: #006B3F; }
.flag-gold  { background: #FCD116; }
.flag-red   { background: #CE1126; }
.flag-black { background: #000; }

.footer-body { max-width: 1280px; margin: 0 auto; padding: 3.5rem 1.5rem 2.5rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }

.footer-logo { display: flex; align-items: center; gap: .875rem; text-decoration: none; margin-bottom: 1.5rem; }
.footer-logo-text { display: flex; flex-direction: column; gap: .15rem; }
.flc-primary    { font-weight: 900; font-size: 1.1rem; color: #fff; }
.flc-tagline-en { font-size: .8rem; color: rgba(255,255,255,.6); }
.flc-tagline-twi { font-size: .75rem; color: var(--ghana-gold); font-style: italic; }

.footer-app-badges { display: flex; flex-direction: column; gap: .625rem; }
.app-badge { display: inline-block; text-decoration: none; transition: .2s; }
.app-badge:hover { opacity: .85; }

.footer-heading {
  font-size: .85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #fff;
  margin-bottom: 1rem;
}
.footer-link-list, .footer-social-list { list-style: none; display: flex; flex-direction: column; gap: .5rem; }
.footer-link-list a, .footer-social-list a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .875rem;
  transition: .15s;
}
.footer-link-list a:hover, .footer-social-list a:hover { color: var(--ghana-gold); }
.footer-social-list a { display: flex; align-items: center; gap: .625rem; }
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 800;
}
.social-fb { background: #1877f2; color: #fff; }
.social-tw { background: #000; color: #fff; }
.social-ig { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color: #fff; }
.social-wa { background: #25d366; color: #fff; }
.social-yt { background: #ff0000; color: #fff; }

.footer-access-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.access-chip {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  padding: .25rem .625rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
}
.footer-partners {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
  border-top: 1px solid rgba(255,255,255,.1);
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 2rem;
}
.partner-label {
  font-size: .78rem;
  color: rgba(255,255,255,.45);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  flex-shrink: 0;
}
.partner-logos { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.partner-logo {
  font-size: .85rem;
  font-weight: 800;
  color: rgba(255,255,255,.5);
  padding: .25rem .75rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50px;
  transition: .2s;
}
.partner-logo:hover { color: var(--ghana-gold); border-color: var(--ghana-gold); }
.partner-divider { color: rgba(255,255,255,.2); }

.footer-bottom { border-top: 1px solid rgba(255,255,255,.08); padding: 1.25rem 1.5rem; }
.footer-bottom-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .875rem;
  font-size: .8rem;
  color: rgba(255,255,255,.45);
}
.footer-lang { display: flex; align-items: center; gap: .5rem; }
.footer-lang-select {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: rgba(255,255,255,.8);
  padding: .2rem .5rem;
  font-size: .8rem;
  font-family: inherit;
}
.footer-copy { text-align: center; }
.footer-twi { color: var(--ghana-gold); font-weight: 700; }
.footer-legal-links { display: flex; gap: .75rem; }
.footer-legal-links a { color: rgba(255,255,255,.45); font-size: .8rem; text-decoration: none; transition: .15s; }
.footer-legal-links a:hover { color: rgba(255,255,255,.8); }

/* ================================================================
   ACCESSIBILITY TOOLBAR
   ================================================================ */
.a11y-toolbar { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 500; }
.a11y-toggle-btn {
  width: 46px;
  height: 46px;
  background: var(--ghana-green);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,107,63,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
}
.a11y-toggle-btn svg { width: 22px; height: 22px; }
.a11y-toggle-btn:hover { transform: scale(1.08); }
.a11y-panel {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
  width: 220px;
  padding: .875rem;
}
.a11y-panel-header { font-weight: 800; font-size: .85rem; color: #111827; margin-bottom: .875rem; text-transform: uppercase; letter-spacing: .06em; }
.a11y-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  background: #f9fafb;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .5rem;
  transition: .15s;
  font-family: inherit;
}
.a11y-btn:hover, .a11y-btn.active { background: var(--ghana-green); color: #fff; border-color: var(--ghana-green); }
.a11y-font-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.a11y-label { font-size: .8rem; font-weight: 600; color: #6b7280; flex: 1; }
.a11y-font-btn { padding: .35rem .625rem; border: 1px solid #e5e7eb; border-radius: 6px; background: #f9fafb; cursor: pointer; font-weight: 800; font-family: inherit; transition: .15s; }
.a11y-font-btn:hover { background: var(--ghana-green); color: #fff; border-color: var(--ghana-green); }

/* ================================================================
   PWA INSTALL BANNER
   ================================================================ */
.pwa-install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--ghana-green);
  color: #fff;
  padding: .875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,.15);
}
.pwa-icon { width: 24px; height: 24px; flex-shrink: 0; }
.pwa-install-banner span { flex: 1; font-size: .875rem; font-weight: 600; }
.pwa-install-btn {
  background: var(--ghana-gold);
  color: var(--ghana-black);
  border: none;
  padding: .45rem 1.25rem;
  border-radius: 50px;
  font-weight: 800;
  cursor: pointer;
  font-size: .875rem;
  flex-shrink: 0;
  font-family: inherit;
}
.pwa-dismiss-btn {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
}

/* ================================================================
   AUDIO REPLAY CONTROLS (Chat)
   ================================================================ */
.audio-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .5rem;
  padding: .5rem .75rem;
  background: #f0fdf4;
  border-radius: 8px;
  border: 1px solid #d1fae5;
  flex-wrap: wrap;
}
.audio-play-btn {
  width: 32px;
  height: 32px;
  background: var(--ghana-green);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .8rem;
  transition: .2s;
}
.audio-play-btn:hover { background: #004d2e; }
.audio-play-btn.playing { background: var(--ghana-red); }
.audio-waveform {
  flex: 1;
  min-width: 60px;
  height: 24px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.wave-bar {
  width: 3px;
  background: var(--ghana-green);
  border-radius: 2px;
  animation: wavePulse 1s ease infinite;
  opacity: .5;
}
.wave-bar:nth-child(2)  { animation-delay: .1s; }
.wave-bar:nth-child(3)  { animation-delay: .2s; }
.wave-bar:nth-child(4)  { animation-delay: .3s; }
.wave-bar:nth-child(5)  { animation-delay: .4s; }
.wave-bar:nth-child(6)  { animation-delay: .3s; }
.wave-bar:nth-child(7)  { animation-delay: .2s; }
.wave-bar:nth-child(8)  { animation-delay: .1s; }
@keyframes wavePulse {
  0%, 100% { height: 4px; opacity: .5; }
  50%       { height: 18px; opacity: 1; }
}
.audio-playing .wave-bar { opacity: 1; }
.audio-duration { font-size: .75rem; color: #6b7280; font-weight: 600; white-space: nowrap; }
.audio-speed {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: .75rem;
  padding: .2rem .4rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}
.audio-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .5rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: #374151;
  text-decoration: none;
  background: #fff;
  transition: .15s;
  cursor: pointer;
}
.audio-dl-btn:hover { background: var(--ghana-green); color: #fff; border-color: var(--ghana-green); }

/* ================================================================
   DOWNLOAD BUTTON (in AI chat bubbles)
   ================================================================ */
.btn-download-ai {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .45rem 1rem;
  background: linear-gradient(135deg, #006B3F, #008E52);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: .8rem;
  cursor: pointer;
  text-decoration: none;
  margin-top: .5rem;
  transition: .2s;
  font-family: inherit;
}
.btn-download-ai:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,107,63,.3); color: #fff; }
.token-cost-badge {
  display: inline-block;
  background: rgba(252,209,22,.2);
  color: #854d0e;
  border-radius: 50px;
  padding: .1rem .4rem;
  font-size: .7rem;
  font-weight: 700;
  margin-left: .25rem;
}

/* ================================================================
   MULTI-CHAT SIDEBAR
   ================================================================ */
.chat-sidebar-v4 {
  width: 260px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.csb-header {
  padding: .875rem;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.csb-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .625rem;
  background: var(--ghana-green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
  font-family: inherit;
  transition: .2s;
}
.csb-new-btn:hover { background: #004d2e; }
.csb-search {
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-family: inherit;
  margin-top: .5rem;
}
.csb-search:focus { outline: none; border-color: var(--ghana-green); }
.csb-body { flex: 1; overflow-y: auto; }
.csb-section-label {
  padding: .5rem .875rem .25rem;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #9ca3af;
}
.csb-pinned-divider {
  padding: .375rem .875rem;
  background: #fffbeb;
  border-top: 1px solid #fde68a;
  border-bottom: 1px solid #fde68a;
  font-size: .7rem;
  font-weight: 700;
  color: #92400e;
  display: flex;
  align-items: center;
  gap: .25rem;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .625rem .875rem;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: .15s;
  position: relative;
}
.conv-item:hover { background: #f9fafb; }
.conv-item.active { background: #f0fdf4; border-left-color: var(--ghana-green); }
.conv-item.pinned .conv-pin { display: block; }
.conv-icon { width: 32px; height: 32px; border-radius: 8px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }
.conv-info { flex: 1; min-width: 0; }
.conv-title { font-size: .85rem; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: .7rem; color: #9ca3af; margin-top: .1rem; }
.conv-pin { display: none; font-size: .7rem; color: #f59e0b; }
.conv-actions {
  display: none;
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: .2rem;
  gap: .2rem;
  flex-direction: column;
}
.conv-item:hover .conv-actions { display: flex; }
.conv-action-btn { background: none; border: none; cursor: pointer; padding: .2rem .4rem; border-radius: 4px; font-size: .7rem; transition: .15s; }
.conv-action-btn:hover { background: #f3f4f6; }

/* ================================================================
   AVATAR STATES (CSS animation fallback)
   ================================================================ */
.avatar-widget {
  position: relative;
  display: inline-block;
}
.avatar-face {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform .3s ease;
}

/* idle */
.avatar-state-idle .avatar-face {
  animation: avatarBreathe 3s ease-in-out infinite;
}
@keyframes avatarBreathe {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.03); }
}

/* talking */
.avatar-state-talking .avatar-face {
  animation: avatarTalk .15s ease infinite alternate;
}
@keyframes avatarTalk {
  from { transform: scaleY(1); }
  to   { transform: scaleY(.97); }
}

/* thinking */
.avatar-state-thinking .avatar-face {
  animation: avatarThink 1.5s ease-in-out infinite;
}
@keyframes avatarThink {
  0%, 100% { transform: rotate(-3deg); }
  50%       { transform: rotate(3deg); }
}

/* happy */
.avatar-state-happy .avatar-face {
  animation: avatarHappy .5s ease;
}
@keyframes avatarHappy {
  0%   { transform: translateY(0) scale(1); }
  30%  { transform: translateY(-8px) scale(1.06); }
  60%  { transform: translateY(-4px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

/* encouraging */
.avatar-state-encouraging .avatar-face {
  animation: avatarNod .6s ease-in-out;
}
@keyframes avatarNod {
  0%, 100% { transform: rotate(0); }
  25%       { transform: rotate(-5deg); }
  75%       { transform: rotate(5deg); }
}

/* celebrating */
.avatar-state-celebrating .avatar-face {
  animation: avatarCelebrate .8s ease;
}
@keyframes avatarCelebrate {
  0%   { transform: scale(1) rotate(0); }
  25%  { transform: scale(1.1) rotate(-10deg); }
  50%  { transform: scale(1.15) rotate(10deg); }
  75%  { transform: scale(1.1) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* Confetti */
.confetti-wrap { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiFall 2.5s ease forwards;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(-20px) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}
