/* ==========================================================================
   DeepSeek Doc Layout & Components
   ========================================================================== */

/* Top Navbar */
.doc-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.doc-navbar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--color-text);
  text-decoration: none;
}

.doc-navbar__brand:hover {
  text-decoration: none;
}

.doc-navbar__logo {
  height: 28px;
  width: auto;
}

/* ==========================================================================
   Header Live Search Bar & Dropdown (DeepSeek Style Premium Redesign)
   ========================================================================== */
.doc-search-wrapper {
  position: relative;
  flex: 0 1 480px;
  width: 100%;
  max-width: 480px;
  margin: 0 1.5rem;
}

.doc-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: 10px;
  padding: 0 0.75rem 0 0.85rem;
  height: 40px;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .doc-search-box {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.doc-search-box:hover {
  border-color: var(--color-primary);
}

[data-theme="dark"] .doc-search-box:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.doc-search-box:focus-within {
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px var(--color-primary-alpha), 0 2px 6px rgba(0, 0, 0, 0.06) !important;
  background: var(--color-bg) !important;
}

[data-theme="dark"] .doc-search-box:focus-within {
  background: #111827 !important;
  border-color: var(--color-primary) !important;
}

.doc-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  margin-right: 0.6rem;
  pointer-events: none;
  flex-shrink: 0;
}

.doc-search-icon svg {
  width: 17px;
  height: 17px;
}

.doc-search-box:focus-within .doc-search-icon {
  color: var(--color-primary);
}

/* Bulletproof Input Reset against WordPress global styles */
.doc-search-box input.doc-search-input,
.doc-navbar .doc-search-box input,
input[type="search"].doc-search-input {
  all: unset !important;
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  color: var(--color-text) !important;
  font-size: 0.925rem !important;
  font-family: inherit !important;
  padding: 0 0.5rem 0 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  line-height: normal !important;
  cursor: text !important;
}

.doc-search-box input.doc-search-input::-webkit-search-decoration,
.doc-search-box input.doc-search-input::-webkit-search-cancel-button,
.doc-search-box input.doc-search-input::-webkit-search-results-button,
.doc-search-box input.doc-search-input::-webkit-search-results-decoration {
  display: none !important;
}

.doc-search-box input.doc-search-input::placeholder,
input[type="search"].doc-search-input::placeholder {
  color: var(--color-text-muted) !important;
  font-size: 0.9rem !important;
  opacity: 0.8 !important;
}

/* Clear Button */
.doc-search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--color-border);
  border: none;
  color: var(--color-text-secondary);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  margin-right: 0.4rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.doc-search-clear:hover {
  background: var(--color-text-secondary);
  color: var(--color-surface);
}

/* Spinner Animation */
.doc-search-spinner {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  margin-right: 0.4rem;
  animation: docSearchSpin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes docSearchSpin {
  100% {
    transform: rotate(360deg);
  }
}

/* Keyboard Shortcut Badge */
.doc-search-shortcut {
  display: inline-flex !important;
  align-items: center !important;
  gap: 3px !important;
  background: var(--color-code-bg) !important;
  border: 1px solid var(--color-border) !important;
  border-radius: 6px !important;
  padding: 2px 7px !important;
  font-size: 0.725rem !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  font-weight: 600 !important;
  color: var(--color-text-muted) !important;
  pointer-events: none !important;
  flex-shrink: 0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  white-space: nowrap !important;
  line-height: 1.2 !important;
  user-select: none !important;
}

.doc-search-box:focus-within .doc-search-shortcut {
  display: none !important;
}

/* Results Dropdown Container */
.doc-search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  width: 100%;
  min-width: 480px;
  max-height: 500px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.05);
  overflow-y: auto;
  z-index: 1050;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: docSearchFadeIn 0.15s ease;
}

[data-theme="dark"] .doc-search-dropdown {
  background: rgba(22, 27, 46, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

@keyframes docSearchFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.doc-search-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.95rem;
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-sidebar-bg);
}

.doc-search-header-tip {
  font-weight: 400;
  font-size: 0.725rem;
}

.doc-search-list {
  padding: 0.4rem;
}

.doc-search-item {
  display: block;
  padding: 0.75rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s ease, color 0.15s ease;
  margin-bottom: 3px;
}

.doc-search-item:last-child {
  margin-bottom: 0;
}

.doc-search-item:hover,
.doc-search-item.is-selected {
  background: var(--color-primary-alpha);
  color: var(--color-primary);
  text-decoration: none;
}

.doc-search-item__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.3rem;
}

.doc-search-item__badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.doc-search-item__title {
  font-size: 0.925rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-search-item.is-selected .doc-search-item__title,
.doc-search-item:hover .doc-search-item__title {
  color: var(--color-primary);
}

.doc-search-item__snippet {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-highlight {
  background: rgba(77, 107, 254, 0.22);
  color: var(--color-primary);
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
}

.doc-search-empty {
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--color-text-secondary);
}

.doc-search-empty svg {
  margin-bottom: 0.6rem;
  color: var(--color-text-muted);
}

.doc-search-empty p {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--color-text);
}

.doc-search-empty span {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.doc-search-footer {
  padding: 0.5rem 0.95rem;
  background: var(--color-sidebar-bg);
  border-top: 1px solid var(--color-border);
  font-size: 0.725rem;
  color: var(--color-text-muted);
  text-align: right;
}

@media (max-width: 900px) {
  .doc-search-wrapper {
    flex: 1;
    margin: 0 0.75rem;
    max-width: none;
  }
  .doc-search-dropdown {
    min-width: 100%;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    border-radius: 0 0 12px 12px;
    max-height: calc(100vh - var(--header-height) - 20px);
  }
}


.doc-navbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}


/* Theme Toggle Button */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--color-sidebar-hover);
  border-color: var(--color-primary);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Language Switcher */
.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-switcher__btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.lang-switcher__btn:hover {
  background: var(--color-sidebar-hover);
}

.lang-switcher__dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  min-width: 130px;
  z-index: 1001;
  padding: 0.25rem 0;
  list-style: none;
  margin: 0;
}

.lang-switcher:hover .lang-switcher__dropdown {
  display: block;
}

.lang-switcher__dropdown a {
  display: block;
  padding: 0.4rem 0.75rem;
  color: var(--color-text);
  font-size: 0.875rem;
  text-decoration: none;
}

.lang-switcher__dropdown a:hover {
  background: var(--color-primary-alpha);
  color: var(--color-primary);
}

/* User Auth Link / Status */
.user-auth-pill {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 500;
}

.user-auth-pill--login {
  background: var(--color-primary);
  color: #ffffff !important;
}

.user-auth-pill--login:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

.user-auth-pill--logout {
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.user-auth-pill--logout:hover {
  background: var(--color-sidebar-hover);
  text-decoration: none;
}

/* 3-Column Layout Container */
.doc-page-wrapper {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

/* Left Sidebar (Auto hierarchy menu) */
.doc-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  overflow-y: auto;
  background: var(--color-sidebar-bg);
  border-right: 1px solid var(--color-border);
  padding: 1.25rem 0.75rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.doc-sidebar::-webkit-scrollbar {
  width: 5px;
}
.doc-sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 4px;
}

.doc-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-menu__group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 700;
  padding: 0.75rem 0.75rem 0.25rem;
}

.doc-menu__item {
  margin-bottom: 2px;
}

.doc-menu__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.15s ease;
}

.doc-menu__link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  text-decoration: none;
}

.doc-menu__link.is-active {
  background: var(--color-sidebar-active);
  color: var(--color-sidebar-active-text);
  font-weight: 600;
}

/* Collapsible Submenu Accordion */
.doc-menu__collapsible-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.doc-menu__collapsible-toggle:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
}

.doc-menu__arrow {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
  fill: currentColor;
}

.doc-menu__item.is-open > .doc-menu__collapsible-toggle .doc-menu__arrow {
  transform: rotate(90deg);
}

.doc-menu__submenu {
  list-style: none;
  padding-left: 0.75rem;
  margin: 0;
  display: none;
  border-left: 1px solid var(--color-border);
  margin-left: 1rem;
}

.doc-menu__item.is-open > .doc-menu__submenu {
  display: block;
}

/* Center Content */
.doc-main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3.5rem;
  display: flex;
  justify-content: center;
}

.doc-article-container {
  width: 100%;
  max-width: var(--max-content-width);
}

/* Breadcrumbs */
.doc-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.825rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.doc-breadcrumbs a {
  color: var(--color-text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease;
}

.doc-breadcrumbs a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.doc-breadcrumbs span {
  color: var(--color-text-muted);
}

.doc-breadcrumbs__current {
  color: var(--color-text);
  font-weight: 500;
}

/* Article Styling */
.doc-article h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.doc-article h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.doc-article h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.doc-article p {
  margin-bottom: 1.25rem;
  color: var(--color-text);
  line-height: 1.7;
}

/* Code Blocks & Copy Button */
.doc-article pre {
  position: relative;
  background: var(--color-code-bg);
  color: var(--color-code-text);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  margin: 1.5rem 0;
  border: 1px solid var(--color-border);
}

.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.doc-article pre:hover .code-copy-btn {
  opacity: 1;
}

.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.code-copy-btn.copied {
  background: var(--color-success);
  border-color: var(--color-success);
}

/* Inline Code */
.doc-article code:not(pre code) {
  background: var(--color-inline-code-bg);
  color: var(--color-inline-code-text);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 85%;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Tables (DeepSeek pricing style) */
.doc-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.doc-article th,
.doc-article td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  text-align: left;
}

.doc-article th {
  background: var(--color-sidebar-bg);
  font-weight: 600;
  color: var(--color-text);
}

.doc-article tr:hover td {
  background: var(--color-sidebar-hover);
}

/* Right TOC (Table of Contents) */
.doc-toc {
  width: var(--toc-width);
  flex-shrink: 0;
  height: calc(100vh - var(--header-height));
  position: sticky;
  top: var(--header-height);
  padding: 2.5rem 1rem 1rem;
  overflow-y: auto;
}

.doc-toc__title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.doc-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--color-border);
}

.doc-toc__item {
  margin: 0;
}

.doc-toc__link {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.15s ease;
  position: relative;
  left: -2px;
  border-left: 2px solid transparent;
}

.doc-toc__link:hover {
  color: var(--color-text);
  text-decoration: none;
}

.doc-toc__link.is-active {
  color: var(--color-toc-active);
  font-weight: 600;
  border-left-color: var(--color-toc-active);
}

.doc-toc__item--h3 .doc-toc__link {
  padding-left: 1.5rem;
}

/* Previous / Next Article Navigation */
.doc-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
}

.doc-pagination__card {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.doc-pagination__card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  text-decoration: none;
}

.doc-pagination__card--next {
  text-align: right;
  grid-column: 2;
}

.doc-pagination__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.doc-pagination__title {
  font-size: 0.95rem;
  color: var(--color-primary);
  font-weight: 600;
}

/* Security Locked Message Banner */
.doc-locked-banner {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 2.5rem;
  text-align: center;
  max-width: 500px;
  margin: 4rem auto;
  box-shadow: var(--shadow-md);
}

.doc-locked-banner__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  color: var(--color-warning);
}

.doc-locked-banner__title {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  color: var(--color-text);
}

.doc-locked-banner__desc {
  color: var(--color-text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

/* Mobile Responsive */
.mobile-nav-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-text);
  padding: 0.5rem;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .doc-toc {
    display: none;
  }
  .doc-main-content {
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 768px) {
  .mobile-nav-toggle {
    display: flex;
  }
  .doc-sidebar {
    position: fixed;
    left: -100%;
    top: var(--header-height);
    z-index: 999;
    width: 280px;
    height: calc(100vh - var(--header-height));
    transition: left 0.3s ease;
    box-shadow: var(--shadow-md);
  }
  .doc-sidebar.is-open {
    left: 0;
  }
  .doc-sidebar-overlay {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
  }
  .doc-sidebar-overlay.is-active {
    display: block;
  }
  .doc-pagination {
    grid-template-columns: 1fr;
  }
  .doc-pagination__card--next {
    grid-column: 1;
    text-align: left;
  }
}

/* ==========================================================================
   High-Speed Member Comments & Pulse Reactions (Greenlight Style)
   ========================================================================== */

.doc-comments-section {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.doc-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.doc-comments-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-text);
}

.doc-comments-badge {
  background: var(--color-sidebar-active);
  color: var(--color-primary);
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 700;
}

/* Member Composer Box */
.comment-composer {
  display: flex;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
  position: relative;
}

.comment-composer:focus-within {
  border-color: var(--color-primary);
}

.comment-composer__avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: block;
}

.comment-composer__body {
  flex: 1;
  position: relative;
}

/* Mini Formatting Toolbar */
.comment-toolbar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border-subtle);
  flex-wrap: wrap;
}

.comment-toolbar__btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-secondary);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.825rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
  line-height: 1;
}

.comment-toolbar__btn:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
  border-color: var(--color-border);
}

.comment-toolbar__btn--image {
  color: var(--color-primary);
  font-weight: 500;
}

.comment-toolbar__btn--image:hover {
  background: var(--color-primary-alpha);
  border-color: var(--color-primary);
}

.comment-toolbar__sep {
  width: 1px;
  height: 16px;
  background: var(--color-border);
  margin: 0 0.25rem;
}

.comment-composer__textarea {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.925rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  padding: 0.25rem 0;
  min-height: 68px;
}

.comment-composer__textarea::placeholder {
  color: var(--color-text-muted);
}

/* Upload Previews Grid */
.comment-upload-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment-upload-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: var(--color-sidebar-bg);
}

.comment-upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.comment-upload-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.comment-upload-remove:hover {
  background: var(--color-danger);
}

.comment-upload-thumb.is-uploading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-upload-thumb.is-uploading img {
  opacity: 0.3;
}

.comment-upload-spinner {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Dropzone Overlay Indicator */
.comment-dropzone-indicator {
  display: none;
  position: absolute;
  inset: 0;
  background: var(--color-surface);
  border: 2px dashed var(--color-primary);
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.5rem;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 10;
  pointer-events: none;
}

.comment-dropzone-indicator.is-active {
  display: flex;
}

/* Private Toggle Switch */
.comment-private-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.comment-private-toggle input {
  cursor: pointer;
}

.comment-composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border-subtle);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.comment-composer__hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.comment-composer__submit {
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.comment-composer__submit:hover:not(:disabled) {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.comment-composer__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Guest Lock Box */
.comment-guest-lock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-sidebar-bg);
  border: 1px dashed var(--color-border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  gap: 1rem;
}

.comment-guest-lock__icon {
  color: var(--color-warning);
  flex-shrink: 0;
}

.comment-guest-lock__content h4 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  color: var(--color-text);
}

.comment-guest-lock__content p {
  margin: 0;
  font-size: 0.825rem;
  color: var(--color-text-muted);
}

.comment-guest-lock__btn {
  background: var(--color-primary);
  color: #fff !important;
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.comment-guest-lock__btn:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

/* Comments Stream List */
.comments-stream {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-item {
  display: flex;
  gap: 0.85rem;
  padding: 1.15rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.comment-item.is-pending {
  opacity: 0.6;
}

.comment-item.is-private-item {
  border-left: 3px solid var(--color-warning);
}

.comment-item__avatar img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: block;
}

.comment-item__main {
  flex: 1;
}

.comment-item__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.comment-item__author {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Role Badges */
.comment-role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  line-height: 1.2;
}

.comment-role-badge--admin {
  background: rgba(77, 107, 254, 0.12);
  color: var(--color-primary);
  border: 1px solid rgba(77, 107, 254, 0.25);
}

.comment-role-badge--client {
  background: var(--color-sidebar-hover);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.comment-private-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-warning);
  background: rgba(245, 158, 11, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.comment-item__date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.comment-item__body {
  font-size: 0.9rem;
  color: var(--color-text);
  line-height: 1.65;
  margin-bottom: 0.6rem;
  word-break: break-word;
}

.comment-private-mask {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Attached Image Gallery in Comments */
.comment-attached-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.comment-image-card {
  display: block;
  max-width: 240px;
  max-height: 160px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.comment-image-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.comment-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Greenlight Pulse / Upvote Button */
.comment-pulse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.comment-pulse-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.comment-pulse-btn.is-active {
  background: var(--color-primary-alpha);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.comments-stream__loading,
.comments-empty {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  background: var(--color-sidebar-bg);
  border-radius: 10px;
  border: 1px dashed var(--color-border);
}
