/* Custom styles for documentation portal */

:root {
  --primary: #a100ff;
  --primary-dark: #8000cc;
  --primary-light: #eed4fd;
  --primary-gradient: linear-gradient(135deg, #a100ff 0%, #7000b3 100%);
  --secondary-gradient: linear-gradient(135deg, #f9f5ff 0%, #e6d1fc 100%);
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #888888;
  --surface: #ffffff;
  --surface-hover: #f5f5f5;
  --sidebar-bg: #f0f0f5;
  --sidebar-item: #444444;
  --border: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.3s ease;
  --highlight-bg: rgba(161, 0, 255, 0.15);
  --highlight-border: rgba(161, 0, 255, 0.3);
  --header-height: 60px;
  --footer-height: 40px;
  --primary-color: #a100ff;
  --primary-light: #eed4fd;
  --background-color: #f8f9fa;
  --text-color: #333;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background-color: #f9fafb;
  margin: 0;
  padding: 0;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Modern scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-full);
  transition: var(--transition);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Loading overlay */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-out;
}
#lottie-container {
  width: 180px;
  height: 180px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.loading-text {
  font-weight: 500;
  color: var(--primary, #6b7280);
  margin-top: 1.5rem;
  font-size: 1rem;
  letter-spacing: 0.5px;
}
.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--primary-light, #e5e7eb);
  border-radius: 50%;
  border-top-color: var(--primary, #6b7280);
  box-shadow: 0 4px 15px var(--primary-light, #e5e7eb);
  animation: spin 1s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Glass effect */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--theme-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

/* Sidebar toggle */
.sidebar-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
}
.sidebar-toggle:hover {
  background: var(--surface-hover);
}
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.sidebar-toggle .material-icons-round {
  font-size: 24px;
  color: var(--text-secondary);
}

/* Logo */
.logo-container {
  display: flex;
  align-items: center;
  margin-left: 1rem;
}
.logo-container img {
  height: 45px;
  transition: var(--transition);
}
.logo-container:hover img {
  transform: scale(1.05);
}

/* Page title */
.page-title {
  margin-left: auto;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 500;
  color: var(--surface);
  background: var(--primary);
  box-shadow: var(--shadow-sm);
  font-size: 1rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .page-title {
    padding: 0.4rem 0.75rem;
    font-size: .7rem;
    border-radius: var(--radius-md);
    max-width: 60vw;
  }
}

/* Theme toggle */
.theme-toggle {
  margin-left: 1rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: transparent;
}
.theme-toggle:hover {
  background: var(--surface-hover);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.theme-toggle .material-icons-round {
  font-size: 22px;
  color: var(--text-secondary);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  z-index: 40;
  padding-top: var(--header-height);
  transition: transform 0.3s ease;
  box-shadow: var(--shadow-md);
}
.sidebar-collapsed {
  transform: translateX(-280px);
}
.sidebar-content {
  height: calc(100% - var(--header-height));
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

/* Search box */
.search-container {
  margin-bottom: 1.5rem;
  position: relative;
}
.search-container .material-icons-round {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 20px;
}
.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: var(--transition);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
}
.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(161, 0, 255, 0.1);
}

/* Menu items */
.menu-section {
  margin-bottom: 1.5rem;
}
.menu-section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.5rem;
  letter-spacing: 0.5px;
}
.menu-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.25rem;
  color: var(--sidebar-item);
  text-decoration: none;
  position: relative;
}
.menu-item:hover {
  background: var(--surface-hover);
}
.menu-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.menu-item.active {
  background: var(--primary-gradient);
  color: white;
  box-shadow: var(--shadow-md);
}
.menu-item .material-icons-round {
  font-size: 20px;
  margin-right: 0.75rem;
  flex-shrink: 0;
}
.menu-item a {
  flex: 1;
  min-width: 0; /* Needed for text-overflow to work */
}
.menu-item-text {
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  display: block;
  color: var(--sidebar-item);
}
.menu-item-text::after {
  content: "";
  display: none;
}
.menu-item-text.truncated-text::after {
  content: "...";
  display: inline;
  color: var(--primary);
  font-weight: bold;
  margin-left: 2px;
}
.menu-item.active .menu-item-text,
.menu-item.active .material-icons-round {
  color: white;
}
.menu-item.active .menu-item-text.truncated-text::after {
  color: white;
}

/* Submenu */
.submenu {
  margin-left: 1.5rem;
  margin-top: 0.25rem;
  margin-bottom: 0.5rem;
  padding-left: 0.75rem;
  position: relative;
}
.submenu::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  border-left: 1px dashed var(--primary);
  opacity: 0.3;
}
.dark-mode .submenu::before {
  border-color: var(--primary-light);
}
.submenu-item {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 0.25rem;
  color: var(--sidebar-item);
  text-decoration: none;
  font-size: 0.85rem;
  position: relative;
}
.submenu-item:hover {
  background: var(--surface-hover);
}
.submenu-item:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.submenu-item.active {
  color: var(--primary-dark);
  font-weight: 500;
}
.submenu-item a {
  flex: 1;
  min-width: 0; /* Needed for text-overflow to work */
}
.submenu-item .menu-item-text {
  max-width: 100%;
}

/* Search highlight */
mark, .highlight {
  background-color: var(--highlight-bg);
  color: var(--primary-dark);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 500;
  border: 1px solid var(--highlight-border);
  box-shadow: 0 1px 2px rgba(161, 0, 255, 0.1);
  animation: highlight-pulse 2s infinite;
}
@keyframes highlight-pulse {
  0% { background-color: var(--highlight-bg); }
  50% { background-color: rgba(161, 0, 255, 0.25); }
  100% { background-color: var(--highlight-bg); }
}

/* Main content */
.main-content {
  flex-grow: 1;
  margin-top: var(--header-height);
  margin-bottom: var(--footer-height);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.content-frame-container {
  flex-grow: 1;
  display: flex;
  height: calc(100vh - var(--header-height) - var(--footer-height));
  width: 100%;
}

.content-frame {
  flex-grow: 1;
  border: none;
  width: 100%;
  height: 100%;
  background-color: white;
}

/* Footer */
.app-footer {
  height: var(--footer-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
}
.app-footer-expanded {
  margin-left: 0;
}
.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.copyright {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.footer-links {
  display: flex;
  gap: 1rem;
}
.footer-link {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}
.footer-link:hover {
  color: var(--primary);
}
.footer-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Floating action button */
.fab {
  position: fixed;
  bottom: calc(var(--footer-height) + 1rem);
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: var(--transition);
  z-index: 20;
  border: none;
  opacity: 0;
  pointer-events: none;
}
.fab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(161, 0, 255, 0.3);
}
.fab:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}
.fab .material-icons-round {
  font-size: 24px;
  color: white;
}

/* Dark mode */
body.dark-mode {
  --primary: #bf4fff;
  --primary-dark: #a02ee0;
  --primary-light: #e5c2ff;
  --primary-gradient: linear-gradient(135deg, #bf4fff 0%, #9d36e6 100%);
  --secondary-gradient: linear-gradient(135deg, #2d2d3a 0%, #3a3a4a 100%);
  --text-primary: #e1e1e1;
  --text-secondary: #a0a0a0;
  --text-muted: #777777;
  --surface: #1e1e2d;
  --surface-hover: #2a2a3a;
  --sidebar-bg: #151520;
  --sidebar-item: #a0a0a0;
  --border: rgba(255, 255, 255, 0.1);
  --highlight-bg: rgba(191, 79, 255, 0.2);
  --highlight-border: rgba(191, 79, 255, 0.4);
  background-color: #141422;
}
body.dark-mode .glass {
  background: rgba(30, 30, 45, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
body.dark-mode ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}
body.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}
body.dark-mode .submenu::before {
  border-color: var(--primary-light);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-280px);
  }
  .sidebar-expanded {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .app-footer {
    margin-left: 0;
  }
}

/* Keyboard focus styles */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Modern scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 9999px;
  transition: all 0.3s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Tooltip for truncated text */
.tooltip-container {
  position: relative;
  display: inline-block;
  width: 100%;
}

.tooltip-text {
  position: absolute;
  visibility: hidden;
  opacity: 0;
  background-color: var(--surface);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  z-index: 100;
  min-width: 200px;
  max-width: 300px;
  left: 0;
  top: 100%;
  margin-top: 8px;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  border: 1px solid var(--border);
  font-size: 0.9rem;
  word-break: break-word;
  white-space: normal;
}

.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.dark-mode .tooltip-text {
  background-color: var(--surface);
  border-color: var(--border);
}

/* Long text handling */
.truncated-text {
  position: relative;
}

.menu-item:hover .material-icons-round {
  color: var(--primary);
}

/* Improved submenu styling */
.submenu {
  position: relative;
}

/* Full text popup for truncated text */
.full-text-popup {
  position: absolute;
  z-index: 100;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  max-width: 280px;
  white-space: normal;
  word-break: break-word;
  font-size: 0.9rem;
  color: var(--text-primary);
  left: 0;
  top: 100%;
  margin-top: 5px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.menu-item-container {
  position: relative;
  width: 100%;
}

.menu-item-container:hover .full-text-popup {
  opacity: 1;
  visibility: visible;
}

.dark-mode .full-text-popup {
  background-color: var(--surface);
  border-color: var(--border);
}

/* Search highlight animation */
@keyframes highlight-pulse {
  0% { background-color: var(--highlight-bg); }
  50% { background-color: rgba(161, 0, 255, 0.25); }
  100% { background-color: var(--highlight-bg); }
}

mark, .highlight {
  background-color: var(--highlight-bg);
  color: var(--primary-dark);
  padding: 0 2px;
  border-radius: 3px;
  font-weight: 500;
  border: 1px solid var(--highlight-border);
  box-shadow: 0 1px 2px rgba(161, 0, 255, 0.1);
  animation: highlight-pulse 2s infinite;
}

.dark-mode mark, .dark-mode .highlight {
  background-color: rgba(191, 79, 255, 0.2);
  border-color: rgba(191, 79, 255, 0.4);
  color: var(--primary-light);
}

/* Menu item text with ellipsis */
.menu-item-text {
  position: relative;
  transition: color 0.3s ease;
}

.menu-item-text.truncated {
  border-bottom: 1px dashed var(--primary-light);
}

/* Responsive design for menu items */
@media (max-width: 768px) {
  .full-text-popup {
    max-width: 220px;
  }
}

/* Enhance sidebar appearance */
#logo-sidebar {
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.05);
}

/* Enhance header and footer appearance */
nav, footer {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Add subtle hover effects to buttons */
button, a {
  transition: all 0.3s ease;
}

button:hover, a:hover {
  transform: translateY(-1px);
}

/* Glass effect for certain elements */
.glass-effect {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Native tooltip styling - this affects browser tooltips */
#sidebar [title] {
  position: relative;
}

/* Ensure nested menu items can be seen during hover */
#sidebar ul ul {
  overflow: visible;
}

/* Search input styling */
#menu-search {
  border-radius: 12px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(161, 0, 255, 0.1);
  padding: 10px 12px 10px 36px;
}

#menu-search:focus {
  box-shadow: 0 0 0 3px rgba(161, 0, 255, 0.25);
  border-color: #a100ff;
  outline: none;
}

/* Sidebar menu animations */
#sidebar li {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Dropdown arrow animation */
.arrow svg {
  transition: transform 0.3s ease;
}

/* Content frame styling */
#content-frame {
  transition: all 0.3s ease;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.03);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .sm\:ml-80 {
    margin-left: 0 !important;
  }
  
  #menu-search {
    border-radius: 8px;
    padding: 8px 12px 8px 32px;
  }
}

/* Add a subtle pulse animation to newly opened menu items */
@keyframes subtle-pulse {
  0% { background-color: rgba(238, 212, 253, 0.5); }
  50% { background-color: rgba(238, 212, 253, 0.2); }
  100% { background-color: transparent; }
}

.newly-opened {
  animation: subtle-pulse 1.5s ease-out;
}

html {
  font-size: 14px;
  font-family: 'Inter', sans-serif;
}

body {
  color: #333;
  background-image: linear-gradient(to bottom right, #ffffff, #f9f5ff);
  background-attachment: fixed;
}

iframe #footer {
  display: none;
}

/* Modern scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb {
  background: #c4c4c4;
  border-radius: 8px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #a100ff;
}

/* Menu item styling */
.clickable {
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 2px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Menu item hover styles */
.clickable a div.truncate,
.clickable span,
.clickable div.truncate {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.clickable.active {
  background: linear-gradient(135deg, #a100ff 0%, #8a00e6 100%);
  font-weight: 600;
  color: #fff;
  box-shadow: 0 4px 10px rgba(161, 0, 255, 0.3);
  transform: translateX(3px);
}

.clickable.active:hover {
  color: #fff !important;
}

.clickable.active span,
.clickable.active div {
  color: #fff;
}
