/* =========================================
   PREMIUM THEME TOGGLE BUTTON
   A perfectly circular, animated dark/light
   mode switcher — positioned near Sign In
   ========================================= */

/* The toggle wrapper — always visible */
.theme-toggle-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
  overflow: hidden;
  margin-right: 12px;
  flex-shrink: 0;
  z-index: 51;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.08);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.theme-toggle-btn:active {
  transform: scale(0.94);
}

/* Sun and Moon icon containers */
.theme-icon {
  position: absolute;
  width: 22px;
  height: 22px;
  transition: all 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sun icon (visible in dark mode => click to go light) */
.theme-icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Moon icon (hidden in dark mode) */
.theme-icon-moon {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

/* When light mode is active */
body.light-mode .theme-icon-sun {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

body.light-mode .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Light mode button style */
body.light-mode .theme-toggle-btn {
  background: rgba(0, 0, 0, 0.06);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

body.light-mode .theme-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.1);
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* SVG icon colors */
.theme-icon svg {
  width: 20px;
  height: 20px;
  fill: #f5c518;
  transition: fill 0.3s ease;
}

.theme-icon-moon svg {
  fill: #a0a0a0;
}

body.light-mode .theme-icon-moon svg {
  fill: #5f6368;
}

/* =========================================
   LIGHT MODE — Global Theme Override
   Applied to body.light-mode
   ========================================= */

/* === BASE === */
body.light-mode {
  background-color: #f8f9fa !important;
  color: #1d1d1f !important;
}

/* === HEADER === */
body.light-mode .header {
  background: rgba(255, 255, 255, 0.82) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .header-center {
  color: #1d1d1f !important;
}

/* === SIGN-IN BUTTON === */
body.light-mode .sign-in-btn {
  background: rgba(10, 132, 255, 1) !important;
}

/* === MAIN CONTENT === */
body.light-mode .main-content {
  background-color: #f8f9fa !important;
  color: #1d1d1f !important;
}

body.light-mode .main-content h1 {
  color: #1d1d1f !important;
}

/* === ROW TITLES === */
body.light-mode .row-title {
  color: #1d1d1f !important;
}

/* === PDF CARDS === */
body.light-mode .pdf-card {
  background-color: #ffffff !important;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .pdf-card:hover {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

/* Keep the hover focus effect in light mode too */
body.light-mode .pdf-row:hover .pdf-card:not(:hover) {
  filter: brightness(0.92) !important;
}

/* === PROFILE POPUP === */
body.light-mode .profile-popup {
  background-color: #ffffff !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
  color: #1d1d1f !important;
}

body.light-mode .popup-email {
  color: #5f6368 !important;
}

body.light-mode .popup-greeting {
  color: #1d1d1f !important;
}

body.light-mode .manage-account-btn {
  border-color: #dadce0 !important;
  color: #1a73e8 !important;
}

body.light-mode .manage-account-btn:hover {
  background-color: rgba(26, 115, 232, 0.04) !important;
}

body.light-mode .close-btn {
  color: #5f6368 !important;
}

body.light-mode .close-btn:hover {
  color: #1d1d1f !important;
}

body.light-mode .popup-footer {
  color: #5f6368 !important;
}

body.light-mode .popup-footer a {
  color: #5f6368 !important;
}

/* === AUTH ACTIONS === */
body.light-mode .single-account-actions,
body.light-mode .accounts-accordion {
  background-color: #f1f3f4 !important;
}

body.light-mode .single-account-actions .action-btn,
body.light-mode .accordion-toggle,
body.light-mode .expanded-actions .action-btn,
body.light-mode .secondary-account-item {
  color: #1d1d1f !important;
}

body.light-mode .single-account-actions .action-btn:hover,
body.light-mode .accordion-toggle:hover,
body.light-mode .expanded-actions .action-btn:hover,
body.light-mode .secondary-account-item:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .single-account-actions .divider {
  background-color: #dadce0 !important;
}

body.light-mode .secondary-account-name {
  color: #1d1d1f !important;
}

body.light-mode .secondary-account-email {
  color: #5f6368 !important;
}

body.light-mode .collapsed-avatar {
  border-color: #f1f3f4 !important;
}

/* === SIDEBAR === */
body.light-mode .sidebar {
  background-color: #ffffff !important;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1) !important;
  color: #1d1d1f !important;
}

body.light-mode .sidebar-section-title {
  color: #1d1d1f !important;
}

body.light-mode .sidebar-header .icon-btn {
  color: #5f6368 !important;
}

body.light-mode .sidebar-header .icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-mode .history-item:hover {
  background-color: #f1f3f4 !important;
  border-color: rgba(0, 0, 0, 0.04) !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .history-text {
  color: #1d1d1f !important;
}

body.light-mode .history-item-left .material-symbols-outlined {
  color: #5f6368 !important;
}

body.light-mode .history-more-btn {
  color: #5f6368 !important;
}

body.light-mode .delete-dropdown {
  background-color: #ffffff !important;
  border-color: #dadce0 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .delete-btn {
  color: #1d1d1f !important;
}

body.light-mode .delete-btn:hover {
  background-color: #f1f3f4 !important;
}

body.light-mode .sidebar-footer-btn {
  color: #1d1d1f !important;
}

body.light-mode .sidebar-footer-btn:hover {
  background-color: #f1f3f4 !important;
}

/* === SEARCH MODAL === */
body.light-mode .search-modal {
  background-color: #ffffff !important;
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

body.light-mode .search-header {
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .search-header .material-symbols-outlined {
  color: #5f6368 !important;
}

body.light-mode #search-input {
  color: #1d1d1f !important;
}

body.light-mode #search-input::placeholder {
  color: #9aa0a6 !important;
}

body.light-mode .search-result-item {
  color: #1d1d1f !important;
}

body.light-mode .search-result-item:hover {
  background-color: rgba(0, 0, 0, 0.04) !important;
}

/* === CHANGE PROFILE PICTURE MODAL === */
body.light-mode .change-pic-modal {
  background-color: #ffffff !important;
  color: #1d1d1f !important;
}

body.light-mode .change-pic-header {
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .change-pic-header h2 {
  color: #1d1d1f !important;
}

body.light-mode .circle-btn {
  background-color: #f1f3f4 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .circle-btn:hover {
  background-color: #e8eaed !important;
}

body.light-mode .circle-btn svg {
  fill: #5f6368 !important;
}

body.light-mode .action-btn-wrapper span {
  color: #1d1d1f !important;
}

body.light-mode .camera-icon-overlay {
  background-color: #dadce0 !important;
  border-color: #ffffff !important;
}

/* === ICON BUTTONS (general) === */
body.light-mode .icon-btn {
  color: #5f6368 !important;
}

body.light-mode .icon-btn:hover {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-mode #open-sidebar-btn {
  color: #5f6368 !important;
}

/* === MATERIAL SYMBOLS in light mode === */
body.light-mode .material-symbols-outlined {
  color: inherit;
}

/* === TOOLTIP corrections === */
body.light-mode .history-item-wrapper::after {
  background-color: #1d1d1f !important;
  color: #ffffff !important;
}

body.light-mode .profile-tooltip {
  background-color: #5f6368 !important;
}

/* === AI SIDEBAR === */
body.light-mode .ai-sidebar {
  background-color: #ffffff !important;
  border-left-color: #e0e0e0 !important;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .ai-chat-btn {
  background: linear-gradient(135deg, #1a73e8, #4285f4) !important;
}

body.light-mode .ai-sidebar-top {
  background-color: #ffffff !important;
}

body.light-mode .ai-icon-btn {
  color: #5f6368 !important;
}

body.light-mode .ai-icon-btn:hover {
  color: #1d1d1f !important;
}

body.light-mode .ai-input-container {
  background-color: #ffffff !important;
}

body.light-mode .ai-input-box::after {
  background-color: #f8f9fa !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .ai-input-box:hover::after {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.15),
    inset 0 0 20px rgba(99, 102, 241, 0.06) !important;
}

body.light-mode .ai-input-top input {
  color: #1d1d1f !important;
}

body.light-mode .ai-input-top input::placeholder {
  color: #9aa0a6 !important;
}

body.light-mode .ai-msg-user {
  background-color: #e8f0fe !important;
  color: #1d1d1f !important;
}

body.light-mode .ai-msg-bot {
  color: #1d1d1f !important;
}

body.light-mode .ai-icon-btn-outline {
  border-color: #dadce0 !important;
  color: #5f6368 !important;
}

body.light-mode .ai-icon-btn-outline:hover {
  background-color: #f1f3f4 !important;
  color: #1d1d1f !important;
}

body.light-mode .ai-model-btn {
  color: #1a73e8 !important;
}

body.light-mode .royal-send-btn {
  background-color: #1a73e8 !important;
  color: #ffffff !important;
}

body.light-mode .royal-send-btn:hover {
  background-color: #1557b0 !important;
}

body.light-mode .upload-popup {
  background-color: #ffffff !important;
  border-color: #dadce0 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .popup-item {
  color: #1d1d1f !important;
}

body.light-mode .popup-item:hover {
  background-color: #f1f3f4 !important;
}

body.light-mode .file-chip {
  background-color: #f1f3f4 !important;
  border-color: #dadce0 !important;
  color: #1d1d1f !important;
}

body.light-mode .ai-history-dropdown {
  background-color: #ffffff !important;
  border-color: #dadce0 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
}

body.light-mode .history-dropdown-header {
  color: #1d1d1f !important;
  border-bottom-color: #dadce0 !important;
  background-color: #f8f9fa !important;
}

body.light-mode .ai-history-item {
  border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-mode .ai-history-item:hover {
  background-color: #f1f3f4 !important;
}

body.light-mode .ai-history-item-query {
  color: #1d1d1f !important;
}

body.light-mode .ai-history-item-date {
  color: #5f6368 !important;
}

body.light-mode .ai-history-delete-menu {
  background-color: #ffffff !important;
  border-color: #dadce0 !important;
}

body.light-mode .ai-history-delete-btn {
  color: #1d1d1f !important;
}

body.light-mode .ai-history-delete-btn:hover {
  background-color: #f1f3f4 !important;
}

body.light-mode .new-chat-tooltip {
  background-color: #ffffff !important;
  color: #1d1d1f !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* === CINEMATIC MODAL in light mode === */
/* (already has white background, so minimal changes) */

/* === SCROLLBAR for light mode === */
body.light-mode ::-webkit-scrollbar {
  width: 8px;
}

body.light-mode ::-webkit-scrollbar-track {
  background: #f1f3f4;
}

body.light-mode ::-webkit-scrollbar-thumb {
  background: #c4c7c5;
  border-radius: 4px;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
  background: #9aa0a6;
}

/* =========================================
   SMOOTH GLOBAL TRANSITION
   Applied to body for theme switching
   ========================================= */
body.theme-transitioning,
body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
  transition:
    background-color 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    color 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    border-color 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    box-shadow 0.4s cubic-bezier(0.25, 0.1, 0.25, 1),
    fill 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) !important;
}

/* =========================================
   LIGHT MODE OVERRIDES FOR HOME UPGRADE
   ========================================= */

body.light-mode .header-search-pill {
  background: rgba(0, 0, 0, 0.04) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: #1d1d1f !important;
}

body.light-mode .header-search-pill:hover {
  background: rgba(0, 0, 0, 0.07) !important;
  border-color: rgba(0, 0, 0, 0.2) !important;
}

body.light-mode .header-search-pill kbd {
  color: rgba(0, 0, 0, 0.72) !important;
  border-color: rgba(0, 0, 0, 0.22) !important;
}

body.light-mode .profile-btn {
  background: rgba(0, 0, 0, 0.05) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
}

body.light-mode .profile-btn:hover {
  border-color: rgba(0, 0, 0, 0.24) !important;
}

body.light-mode .profile-name {
  color: #1d1d1f !important;
}

body.light-mode .continue-reading-head p {
  color: rgba(0, 0, 0, 0.55) !important;
}

body.light-mode .continue-reading-card {
  background: linear-gradient(145deg, #ffffff, #f7f9ff) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07) !important;
}

body.light-mode .continue-reading-card:hover {
  border-color: rgba(26, 115, 232, 0.32) !important;
}

body.light-mode .continue-meta h3 {
  color: #1d1d1f !important;
}

body.light-mode .continue-meta p,
body.light-mode .continue-foot,
body.light-mode .continue-reading-card small {
  color: rgba(0, 0, 0, 0.62) !important;
}

body.light-mode .continue-progress-track {
  background: rgba(0, 0, 0, 0.12) !important;
}

body.light-mode .continue-remove-btn {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(0, 0, 0, 0.12) !important;
  color: rgba(0, 0, 0, 0.62) !important;
}

body.light-mode .continue-remove-btn:hover {
  background: rgba(220, 42, 64, 0.11) !important;
  border-color: rgba(220, 42, 64, 0.42) !important;
  color: #a71a2f !important;
}

body.light-mode .search-backdrop {
  background: rgba(236, 240, 248, 0.58) !important;
}

body.light-mode .search-modal {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  box-shadow:
    0 26px 56px rgba(22, 32, 66, 0.2),
    0 0 0 1px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .search-header,
body.light-mode .search-subtext {
  border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode #search-input {
  color: #131621 !important;
}

body.light-mode #search-input::placeholder {
  color: rgba(19, 22, 33, 0.5) !important;
}

body.light-mode .search-esc {
  border-color: rgba(0, 0, 0, 0.22) !important;
  color: rgba(0, 0, 0, 0.65) !important;
}

body.light-mode .search-subtext,
body.light-mode .search-empty-state,
body.light-mode .search-count-hint {
  color: rgba(0, 0, 0, 0.62) !important;
}

body.light-mode .rich-search-item {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #1d1d1f !important;
}

body.light-mode .rich-search-item:hover {
  background: rgba(26, 115, 232, 0.08) !important;
  border-color: rgba(26, 115, 232, 0.28) !important;
}

body.light-mode .search-result-main strong {
  color: #1d1d1f !important;
}

body.light-mode .search-result-main p {
  color: rgba(0, 0, 0, 0.62) !important;
}

body.light-mode .search-result-main small {
  color: rgba(9, 99, 197, 0.9) !important;
}

body.light-mode .search-result-open {
  background: rgba(0, 0, 0, 0.08) !important;
  color: rgba(0, 0, 0, 0.68) !important;
}

/* === TRAINING MEGA MENU === */
body.light-mode .training-nav-bar {
  border-color: rgba(0, 0, 0, 0.11) !important;
  background: rgba(255, 255, 255, 0.88) !important;
  box-shadow:
    0 10px 24px rgba(31, 42, 67, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
}

body.light-mode .training-nav-item {
  color: rgba(24, 30, 40, 0.84) !important;
}

body.light-mode .training-nav-item:hover,
body.light-mode .training-nav-item:focus-visible {
  background: rgba(0, 0, 0, 0.06) !important;
  color: #0f131a !important;
}

body.light-mode .training-nav-item.active {
  background: #ffffff !important;
  color: #0f131a !important;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.09) !important;
}

body.light-mode .training-mega-backdrop {
  background: rgba(244, 247, 252, 0.56) !important;
}

body.light-mode .training-mega-panel {
  border-color: rgba(0, 0, 0, 0.09) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow:
    0 30px 56px rgba(17, 23, 38, 0.16),
    0 0 0 1px rgba(0, 0, 0, 0.05) !important;
}

body.light-mode .training-panel-eyebrow {
  color: rgba(73, 83, 99, 0.7) !important;
}

body.light-mode .training-panel-link {
  color: rgba(32, 40, 54, 0.88) !important;
}

body.light-mode .training-panel-link:hover,
body.light-mode .training-panel-link:focus-visible,
body.light-mode .training-panel-link.active {
  color: #0f131a !important;
}

body.light-mode .training-panel-books-head h2 {
  color: #141824 !important;
}

body.light-mode .training-panel-books-head p {
  color: rgba(59, 68, 82, 0.75) !important;
}

body.light-mode .training-book-card {
  border-color: rgba(0, 0, 0, 0.09) !important;
  background: #f7f9fc !important;
  box-shadow: 0 8px 20px rgba(20, 28, 44, 0.08) !important;
}

body.light-mode .training-book-card:hover,
body.light-mode .training-book-card:focus-visible {
  border-color: rgba(10, 132, 255, 0.45) !important;
  box-shadow: 0 14px 30px rgba(10, 24, 54, 0.18) !important;
}

body.light-mode .training-book-grid:hover .training-book-card:not(:hover) {
  filter: brightness(0.9) saturate(0.9) !important;
  opacity: 0.78 !important;
}

body.light-mode .training-book-title {
  color: #1a2130 !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 246, 251, 0.98)) !important;
}
