/* ///////////// BEGIN BLOCK *10 */
/**
* Document Viewer Styles
* File: styles.css
*/

/* Reset and Base Styles */
* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
}

body {
   font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
   background-color: #f5f5f5;
   overflow: hidden;
}
/* ///////////// END BLOCK *10 */

/* ///////////// REPLACE BLOCK *20 */
/* App Container and Layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
}

/* Menu Panel - Fixed left sidebar */
#menu-panel {
    width: 50px;
    height: 100vh;
    background: #f0f0f0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 2px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    border-right: 1px solid #ddd;
    /* z-index set by JavaScript from registry (controls.sidebar: 100) */
}

/* Menu items styling */
#menu-panel > div {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    color: #000000;
    font-size: 12px;
    position: relative;
}

#menu-panel > div:hover {
    background: #1178cb;
    color: #ffffff;
}

#menu-panel > div:focus-visible,
#menu-panel > div:focus {
    background: #1178cb;
    color: #ffffff;
    outline: none !important;
}

#toggle-layout:hover svg path,
#toggle-layout:focus-visible svg path {
    stroke: currentColor;
    stroke-width: 0.5;
}

/* Page indicator styling */
#page-indicator {
    background: #fff;  /* Changed to white */
    border: 1px solid #ddd;
    padding: 5px 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-weight: bold;
    color: #333;  /* Dark text */
}

/* Main content area */
#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
/* ///////////// END BLOCK *20 */

/* ///////////// BEGIN BLOCK *30 */
/* Header Controls - UNUSED/LEGACY */
#header-controls {
   background: #fff;
   border-bottom: 1px solid #ddd;
   padding: 10px;
   display: flex;
   align-items: center;
   gap: 10px;
   /* z-index would be set by JavaScript from registry if this element was used */
   box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#header-controls button {
   padding: 8px 12px;
   background: #4CAF50;
   color: white;
   border: none;
   border-radius: 4px;
   cursor: pointer;
   font-size: 14px;
   transition: background 0.3s;
}

#header-controls button:hover {
   background: #45a049;
}

#header-controls button:active {
   transform: translateY(1px);
}

#zoomLevel {
   font-weight: bold;
   color: #333;
   min-width: 50px;
   text-align: center;
}

#searchBox {
   flex: 1;
   max-width: 300px;
   padding: 8px;
   border: 1px solid #ddd;
   border-radius: 4px;
   font-size: 14px;
}

#document-selector {
   display: flex;
   gap: 10px;
}

#documentId {
   padding: 8px;
   border: 1px solid #ddd;
   border-radius: 4px;
   width: 200px;
}
/* ///////////// END BLOCK *30 */

/* ///////////// REPLACE BLOCK *40 */
/* Viewer Container */
#viewer-container {
    flex: 1;
    display: flex;
    overflow: auto; /* This enables scrollbars */
    position: relative;
    background: #e0e0e0;
}

/* Current path/filename display */
#current-path-display {
    position: fixed;
    top: 8px;
    left: 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    color: #1178cb;
    z-index: 1000;
    max-width: calc(100% - 80px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
    background: white;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Line Numbers - OLD SIDEBAR (DEPRECATED) */
#line-numbers {
    display: none !important; /* Always hide the old sidebar */
    width: 0 !important;
}

.line-number {
    position: absolute;
    width: 100%;
    text-align: right;
    padding-right: 8px;
    color: #666;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 2px solid #eee;
}

/* Hide line numbers when toggled */
body.line-numbers-hidden #line-numbers {
    display: none;
}
/* ///////////// END BLOCK *40 */

/* ///////////// BEGIN BLOCK *50 */
/* Pages Container and Page Layout */
#pages-container {
    position: relative;
    flex: 1;
    background: #e0e0e0;  /* Gray background for the container */
    min-height: 100%;
}

/* Page Container - z-index controlled by registry */
.page-container {
    /* NO BACKGROUND COLOR - let selection show through */
    background: transparent !important;
    position: absolute;
    /* NO z-index here - set by JavaScript from registry */
}

/* Page Images - PNG with transparent background */
.page-container img,
.page-image {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    /* NO z-index here - set by JavaScript from registry */
    background: transparent !important; /* Critical for PNG transparency */
    /* REMOVED mix-blend-mode - might create stacking context */
}

/* Horizontal layout mode */
#pages-container.horizontal {
    display: flex;
    flex-direction: row;
}

#pages-container.horizontal .page-container {
    position: relative;
    margin-right: 20px;
}
/* ///////////// END BLOCK *50 */

/* Page Bookmark Styles */
.page-bookmark {
    position: absolute;
    width: 72px;
    height: 72px;
    pointer-events: auto;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.2s ease;
    /* z-index set by JavaScript from registry (document.bookmarks: 15) */
}

.page-bookmark svg {
    width: 100%;
    height: 100%;
    display: block;
    transition: fill 0.3s ease, stroke 0.3s ease, stroke-dasharray 0.3s ease;
}

.page-bookmark.bookmark-inactive svg path {
    fill: transparent;
    stroke: #1178cb;
    stroke-width: 2px;
    stroke-dasharray: 4, 3;
}

.page-bookmark.bookmark-active svg path {
    fill: #1178cb;
    stroke: none;
}

.page-bookmark-number {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: sans-serif;
    font-size: 16px;
    font-weight: bold;
    color: #000000;
    pointer-events: none;
    user-select: none;
    z-index: 16;
    text-align: center;
    line-height: 1;
}

.page-bookmark.bookmark-active .page-bookmark-number {
    color: #ffffff;
}

.page-bookmark:hover {
    transform: scale(1.1);
}

.page-bookmark:hover svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.page-bookmark:active {
    transform: scale(0.95);
}

/* ///////////// REPLACE BLOCK *60 */
/* Selection Layer and Rectangles - z-index controlled by registry */
#selection-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* z-index set by JavaScript from registry (document.selections: 2) */
}

.selection-rect {
    position: absolute;
    pointer-events: none;
    opacity: 0.5;  /* 50% opacity for all selections */
    mix-blend-mode: multiply;
    /* z-index inherited from parent selection-layer */
}

/* Temporary selections during drag */
.selection-rect.temp-selection {
    opacity: 0.5;  /* Same 50% opacity for consistency */
    border: 1px dashed rgba(0, 0, 0, 0.3);  /* Optional: subtle dashed border for temp selections */
}

/* CRITICAL: Temporarily visible selections MUST have same opacity as regular */
.selection-rect.selection-temp-visible {
    opacity: 0.5 !important;  /* Force same as regular highlights */
}

.selection-rect.selection-temp-visible.markup-underline {
    opacity: 1 !important;  /* Force underlines to full opacity */
}

.selection-rect.locked {
    opacity: 0.5;  /* Keep at 50% for consistency */
    border: 2px solid rgba(0,0,0,0.3);
}

/* Color classes - these should override any inline styles */
/* Class number = security level: 1=Open(green) through 6=Redact(black) */
.selection-rect.class-1 { background-color: #4caf50 !important; }
.selection-rect.class-2 { background-color: #fdd835 !important; }
.selection-rect.class-3 { background-color: #ff9800 !important; }
.selection-rect.class-4 { background-color: #1178cb !important; }
.selection-rect.class-5 { background-color: #f44336 !important; }
.selection-rect.class-6 { background-color: #000000 !important; }

/* Redact-Black (class-6) in marker mode: full opacity, no blend — text must be fully obscured */
.selection-rect.class-6:not(.markup-underline) {
    opacity: 1 !important;
    mix-blend-mode: normal !important;
}

/* Underline mode styles */
.selection-rect.markup-underline {
    background-color: transparent !important;
    border-bottom: 1px solid;
    opacity: 1 !important;
}

.selection-rect.markup-underline.class-1 { border-bottom-color: #4caf50 !important; }
.selection-rect.markup-underline.class-2 { border-bottom-color: #fdd835 !important; }
.selection-rect.markup-underline.class-3 { border-bottom-color: #ff9800 !important; }
.selection-rect.markup-underline.class-4 { border-bottom-color: #1178cb !important; }
.selection-rect.markup-underline.class-5 { border-bottom-color: #f44336 !important; }
.selection-rect.markup-underline.class-6 { border-bottom-color: #000000 !important; }

/* Line Numbers in Pages */
.ln-box { 
    fill: rgba(0, 255, 0, 0.2); 
    fill-opacity: 0.5; 
    pointer-events: none; 
    user-select: none;
}

.ln-text { 
    fill: #000000; 
    font-family: sans-serif; 
    text-anchor: middle; 
    dominant-baseline: middle; 
    pointer-events: none; 
    user-select: none;
    font-weight: bold;
}

/* Hide line numbers when toggled */
body.line-numbers-hidden .ln-box,
body.line-numbers-hidden .ln-text {
    display: none !important;
    visibility: hidden !important;
}
/* ///////////// END BLOCK *60 */

/* //////////// BLOCK *70 NO LONGER REQUIRED (OLD DOM RECTANGLE DETECTION)

/* ///////////// BEGIN BLOCK *80 */
/* Popup Layer */
#popup-layer {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   /* z-index set by JavaScript from registry (popups.base: 500) */
   pointer-events: none;
}

/* Icon Menu */
.selection-menu,
.icon-menu {
   position: absolute;
   background: white;
   border: 1px solid #999;
   border-radius: 3px;
   padding: 3px;
   display: flex;
   gap: 2px;
   box-shadow: 0 2px 5px rgba(0,0,0,0.3);
   /* z-index set by JavaScript from registry (overlays.hoverMenus: 300) */
   pointer-events: auto;
}

.menu-icon-btn,
.icon-button {
   background: transparent;
   border: none;
   padding: 2px;
   cursor: pointer;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 2px;
   transition: background 0.2s;
}

.menu-icon-btn:hover,
.icon-button:hover {
   background: #e0e0e0;
}

/* Highlight Palette */
#highlight-palette {
   position: absolute;
   background: white;
   border: 1px solid #ccc;
   border-radius: 4px;
   padding: 5px;
   box-shadow: 0 2px 8px rgba(0,0,0,0.15);
   /* z-index set by JavaScript from registry (popups.palette: 650) */
   pointer-events: auto;
}
/* ///////////// END BLOCK *80 */

/* ///////////// BEGIN BLOCK *90 */
/* Search Highlights */
.search-highlight {
   background: rgba(255, 0, 255, 0.3) !important;
   border: 1px solid rgba(255, 0, 255, 0.5);
}

/* Loading Indicator */
#loading-indicator {
   position: fixed;
   top: 0;
   left: 0;
   right: 0;
   bottom: 0;
   background: rgba(0, 0, 0, 0.5);
   display: none;
   align-items: center;
   justify-content: center;
   /* z-index set by JavaScript from registry (system.loading: 9500) */
}

.loading-spinner {
   width: 50px;
   height: 50px;
   border: 5px solid #f3f3f3;
   border-top: 5px solid #1178cb;
   border-radius: 50%;
   animation: spin 1s linear infinite;
}

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

.loading-text {
   color: white;
   margin-top: 20px;
   font-size: 18px;
}
/* ///////////// END BLOCK *90 */

/* ///////////// REPLACE BLOCK *91 */
/* Search Highlights - Using Selection System */
.selection-rect.class-search {
    background-color: #00CED1 !important; /* Cyan for search */
    opacity: 0.25;  /* Dim by default */
    border: none;
}

/* Current search result */
.selection-rect.class-search.search-current {
    opacity: 0.9;  /* Bright for current result */
}

/* Temporary search selection during Alt+S drag */
.selection-rect.class-search.temp-search-selection {
    opacity: 0.9 !important;  /* Full brightness during drag */
    background-color: #00CED1 !important;
}

/* Operation mode visual feedback */
.selection-rect.selection-extending {
    border: 2px solid #4CAF50 !important;
    animation: pulse 0.5s infinite;
}

.selection-rect.selection-join-candidate {
    border: 2px solid #1178cb !important;
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
    animation: pulse 0.5s infinite;
}

.selection-rect.selection-deleting {
    opacity: 0.3 !important;
    text-decoration: line-through;
}

.selection-rect.selection-divide {
    border-left: 3px solid #FF5722 !important;
    border-right: 3px solid #FF5722 !important;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
/* ///////////// END BLOCK *91 */

/* ///////////// BEGIN BLOCK *100 */
/* Multi-Selection Menu */
#multi-selection-menu {
   position: fixed;
   background: white;
   border: 1px solid #ddd;
   border-radius: 4px;
   padding: 10px;
   box-shadow: 0 2px 10px rgba(0,0,0,0.2);
   /* z-index set by JavaScript from registry (popups.base: 500) */
}

#multi-selection-menu button {
   display: block;
   width: 100%;
   padding: 8px;
   margin: 5px 0;
   background: #4CAF50;
   color: white;
   border: none;
   border-radius: 4px;
   cursor: pointer;
}

#multi-selection-menu button:hover {
   background: #45a049;
}
/* ///////////// END BLOCK *100 */

/* ///////////// BEGIN BLOCK *110 */
/* Screenshot Frame */
#screenshot-frame,
.screenshot-frame {
   position: fixed;
   border: 2px dashed #4CAF50;
   background: rgba(76, 175, 80, 0.1);
   pointer-events: none;
   /* z-index set by JavaScript from registry (system.screenshot: 9000) */
}

.resize-handle {
   position: absolute;
   width: 10px;
   height: 10px;
   background: #4CAF50;
   border: 1px solid white;
   pointer-events: auto;
   cursor: pointer;
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

#screenshot-coords {
   position: absolute;
   bottom: -25px;
   left: 0;
   background: #4CAF50;
   color: white;
   padding: 2px 8px;
   border-radius: 2px;
   font-size: 12px;
   white-space: nowrap;
}

/* Screenshot mode */
body.screenshot-mode #pages-container {
   cursor: crosshair;
}
/* ///////////// END BLOCK *110 */

/* ///////////// BEGIN BLOCK *120 */
/* Notifications */
.error-notification,
.success-notification {
   position: fixed;
   top: 20px;
   right: 20px;
   padding: 15px 20px;
   border-radius: 4px;
   box-shadow: 0 2px 10px rgba(0,0,0,0.2);
   /* z-index set by JavaScript from registry (system.notifications: 9900) */
   animation: slideIn 0.3s ease;
}

.error-notification {
   background: #f44336;
   color: white;
}

.success-notification {
   background: #4CAF50;
   color: white;
}

@keyframes slideIn {
   from {
       transform: translateX(100%);
       opacity: 0;
   }
   to {
       transform: translateX(0);
       opacity: 1;
   }
}
/* ///////////// END BLOCK *120 */

/* ///////////// REPLACE BLOCK *130
/* Popup Panels */
.document-load-popup,
.search-popup,
.settings-panel,
.help-panel,
.image-library-panel {
   position: fixed;
   background: white;
   border: 1px solid #ddd;
   border-radius: 4px;
   box-shadow: 0 4px 20px rgba(0,0,0,0.3);
   /* z-index set by JavaScript from registry (popups.base: 500) */
   padding: 20px;
   pointer-events: auto; /* Ensure popup captures its own events */
}

/* Special handling for search popup to ensure it doesn't block document interaction */
.search-popup {
   padding: 0;
   pointer-events: auto;
}

/* ==================== SEARCH POPUP CURSOR CONTROL ==================== */
/* Only allow text cursor in the search textarea */
.search-popup,
.search-popup * {
   cursor: default;
}

.search-popup button,
.search-popup [role="button"],
.search-popup label,
.search-popup input[type="radio"],
.search-popup input[type="checkbox"] {
   cursor: pointer;
}

.search-popup #popup-search,
.search-popup textarea {
   cursor: text;
}

.search-popup .search-popup-header {
   cursor: move;
}

.search-popup .search-resize-handle {
   cursor: nwse-resize;
}

.search-popup .search-edge-resize-top,
.search-popup .search-edge-resize-bottom {
   cursor: ns-resize;
}

.search-popup .search-edge-resize-left,
.search-popup .search-edge-resize-right {
   cursor: ew-resize;
}

.search-popup #search-disclosure-resize {
   cursor: ns-resize;
}

/* ==================== SEARCH POPUP FOCUS STYLES ==================== */
/* Comprehensive focus rectangles for all controls - ADA keyboard navigation */

/* Base focus style for all interactive elements */
.search-popup *:focus {
   outline: none;
}

.search-popup *:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
   border-radius: 3px;
}

/* Header window control buttons (minimize, maximize, close) - white on blue */
.search-popup-header button:focus-visible,
.search-popup-header .search-minimize-btn:focus-visible,
.search-popup-header .search-maximize-btn:focus-visible,
.search-popup-header .search-close-btn:focus-visible {
   outline: 2px solid #ffffff !important;
   outline-offset: 2px;
   border-radius: 3px;
   box-shadow: 0 0 0 4px rgba(255,255,255,0.3);
}

/* Navigation row buttons (Prev, Next, Clear, Paste, Search, Drag, Recent) */
.search-popup #search-prev:focus-visible,
.search-popup #search-next:focus-visible,
.search-popup #search-clear-results:focus-visible,
.search-popup #search-paste:focus-visible,
.search-popup #search-go-btn:focus-visible,
.search-popup #search-drag-toggle:focus-visible,
.search-popup #search-recent-btn:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
   border-radius: 3px;
   box-shadow: 0 0 0 4px rgba(33,150,243,0.2);
}

/* Search textarea */
.search-popup #popup-search:focus-visible,
.search-popup textarea:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 1px;
   border-radius: 3px;
   border-color: #1178cb;
   box-shadow: 0 0 0 4px rgba(33,150,243,0.15);
}

/* Radio buttons (Progressive, Standard search modes) */
.search-popup input[type="radio"]:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 3px;
   border-radius: 50%;
   box-shadow: 0 0 0 4px rgba(33,150,243,0.2);
}

/* Radio button labels when radio is focused */
.search-popup input[type="radio"]:focus-visible + span {
   color: #1178cb;
   font-weight: 500;
}

/* Toggle in-context button */
.search-popup #toggle-in-context:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
   border-radius: 3px;
   background: rgba(33,150,243,0.1);
}

/* Result records in Spec and Claims boxes */
.search-popup #search-other-box [role="listitem"]:focus-visible,
.search-popup #search-claims-box [role="listitem"]:focus-visible,
.search-popup #search-other-box div[data-result-index]:focus-visible,
.search-popup #search-claims-box div[data-result-index]:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: -2px;
   background: #e3f2fd !important;
   border-radius: 2px;
}

/* Checkboxes in result records */
.search-popup input[type="checkbox"]:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
   border-radius: 2px;
   box-shadow: 0 0 0 3px rgba(33,150,243,0.25);
}

/* Select all checkboxes */
.search-popup .claims-select-all:focus-visible,
.search-popup .disclosure-select-all:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
}

/* Color marking buttons (circular) */
.search-popup [role="button"][title]:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 3px;
   box-shadow: 0 0 0 4px rgba(33,150,243,0.3);
}

/* Disclosure resize handle (for keyboard resize) */
.search-popup #search-disclosure-resize:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 1px;
   background: #bbdefb;
}

/* Edge resize handles */
.search-popup .search-edge-resize:focus-visible,
.search-popup .search-resize-handle:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 1px;
}

/* Recent searches popup items */
.search-popup #search-recent-popup div:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: -2px;
   background: #e3f2fd;
}

/* Claim count link */
.search-popup #search-claim-count:focus-visible {
   outline: 2px solid #1178cb;
   outline-offset: 2px;
   border-radius: 3px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
   .search-popup *:focus-visible {
      outline: 3px solid #000000;
      outline-offset: 2px;
   }
   
   .search-popup-header button:focus-visible {
      outline: 3px solid #ffffff !important;
      box-shadow: 0 0 0 5px #000000;
   }
}

/* Reduced motion - simpler focus indicators */
@media (prefers-reduced-motion: reduce) {
   .search-popup *:focus-visible {
      transition: none;
   }
}

/* Special handling for document-load-popup (storage menu) */
.document-load-popup {
   padding: 0;
   pointer-events: auto;
}

.panel-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 15px;
   padding-bottom: 10px;
   border-bottom: 1px solid #eee;
}

.panel-header h3 {
   margin: 0;
   font-size: 18px;
   color: #333;
}

.close-btn {
   background: none;
   border: none;
   font-size: 24px;
   cursor: pointer;
   color: #999;
   padding: 0;
   width: 30px;
   height: 30px;
   display: flex;
   align-items: center;
   justify-content: center;
}

.close-btn:hover {
   color: #333;
}

.panel-content {
   max-height: 400px;
   overflow-y: auto;
}
/* ///////////// END BLOCK *130 */

/* ///////////// ADD BLOCK *135 */
/* Tooltip Styles */
.screenshot-icon-container {
    position: absolute;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    gap: 6px;
    padding: 3px;
    pointer-events: auto;
}

.screenshot-icon-container svg {
    cursor: pointer;
    background: transparent;
    transition: background 0.2s;
}

.screenshot-icon-container svg:hover {
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
}

#selection-tooltip {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ///////////// END BLOCK *135 */



/* ///////////// ADD BLOCK *136 (Insert between existing BLOCK *135 and existing BLOCK *140) */
/* Lock Challenge Dialog Styles */
.lock-challenge-dialog {
    animation: slideDown 0.2s ease;
}

.lock-challenge-backdrop {
    animation: fadeIn 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.lock-challenge-dialog button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.lock-challenge-dialog #challenge-proceed:hover {
    background: #f57c00 !important;
}

.lock-challenge-dialog #challenge-cancel:hover {
    background: #e0e0e0 !important;
}

/* Locked selection visual indicator */
.selection-rect.locked {
    border: 2px solid rgba(255, 152, 0, 0.8) !important;
    box-shadow: inset 0 0 3px rgba(255, 152, 0, 0.3);
}
/* ///////////// END BLOCK *136 */

/* ///////////// REPLACE BLOCK *137 */
/* Margin Indicators for Hidden Selections */
.margin-indicator {
    position: absolute;
    pointer-events: auto !important;  /* Changed from none to auto */
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.margin-indicator:hover {
    opacity: 1;
}

/* Overlap indicators (non-hidden overlapping selections) have different opacity */
.margin-indicator.overlap-indicator {
    opacity: 0.6;
}

.margin-indicator.overlap-indicator:hover {
    opacity: 0.9;
}

/* Color classes for margin indicators - matching selection colors */
.margin-indicator.class-1 { background-color: #4caf50; }
.margin-indicator.class-2 { background-color: #fdd835; }
.margin-indicator.class-3 { background-color: #ff9800; }
.margin-indicator.class-4 { background-color: #1178cb; }
.margin-indicator.class-5 { background-color: #f44336; }
.margin-indicator.class-6 { background-color: #000000; }

/* Remove the selection-hidden visual feedback - it interferes with temp visibility */
/* Hidden selections are already display:none, no need for extra styling */
/* ///////////// END BLOCK *137 */

/* ///////////// REPLACE BLOCK *138 */
/* Display state styles for selections */
.selection-temp-visible {
    /* Show at NORMAL opacity when temporarily visible */
    opacity: 0.5 !important;  /* Normal highlight opacity */
}

.selection-temp-visible.markup-underline {
    opacity: 1 !important;  /* Full opacity for underlines */
}

/* Keep the original opacity for normal (non-temporary) selections */
.selection-rect:not(.selection-temp-visible) {
    opacity: 0.5;  /* Normal highlight opacity when not temporary */
}

.selection-rect.markup-underline:not(.selection-temp-visible) {
    opacity: 1;  /* Full opacity for underlines when not temporary */
}

/* Hidden selections that are NOT temporarily visible should be very faint */
.selection-rect.selection-hidden:not(.selection-temp-visible) {
    opacity: 0.1 !important;
    border: 1px dashed currentColor;
}

.selection-focused {
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    animation: pulse 0.5s ease;
}

/* Interactive margin indicators */
.margin-indicator:hover {
    opacity: 1;
    width: 6px !important;
    transition: all 0.2s ease;
}

.margin-indicator.interactive {
    cursor: pointer;
    transition: all 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 0.7; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}
/* ///////////// END BLOCK *138 */

/* ///////////// BEGIN BLOCK *138.5 - Color Assist Mode */
/* Color Assist Mode - ADA Compliance for colorblind users */
/* Remove all color styling and use black underlines offset 2px below bounding box */
/* Both body.color-assist-mode and html.color-assist-mode-pending body are used for early init */
body.color-assist-mode .selection-rect:not(.class-search),
html.color-assist-mode-pending body .selection-rect:not(.class-search) {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: none !important;
    box-shadow: none !important;
    opacity: 1 !important;
}

body.color-assist-mode .selection-rect:not(.class-search)::after,
html.color-assist-mode-pending body .selection-rect:not(.class-search)::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 2px;
    background-color: #000000 !important;
    pointer-events: none;
}

body.color-assist-mode .margin-indicator,
html.color-assist-mode-pending body .margin-indicator {
    background-color: #000000 !important;
    opacity: 1 !important;
}

body.color-assist-mode .margin-indicator.color-assist-indicator,
html.color-assist-mode-pending body .margin-indicator.color-assist-indicator {
    opacity: 1 !important;
}

body.color-assist-mode .screenshot-frame,
html.color-assist-mode-pending body .screenshot-frame {
    border: 2px dotted #000000 !important;
    background-color: transparent !important;
    background: transparent !important;
}

/* Ensure underlines in color-assist mode are BLACK, not colored or gray */
body.color-assist-mode .selection-rect.markup-underline:not(.class-search),
html.color-assist-mode-pending body .selection-rect.markup-underline:not(.class-search) {
    border-bottom: 2px solid #000000 !important;
    border-bottom-color: #000000 !important;
}

/* Override individual class colors for underlines in color-assist mode */
body.color-assist-mode .selection-rect.markup-underline.class-1,
body.color-assist-mode .selection-rect.markup-underline.class-2,
body.color-assist-mode .selection-rect.markup-underline.class-3,
body.color-assist-mode .selection-rect.markup-underline.class-4,
body.color-assist-mode .selection-rect.markup-underline.class-5,
body.color-assist-mode .selection-rect.markup-underline.class-6,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-1,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-2,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-3,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-4,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-5,
html.color-assist-mode-pending body .selection-rect.markup-underline.class-6 {
    border-bottom-color: #000000 !important;
}

.margin-indicator-label {
    font-family: Arial, sans-serif;
    white-space: nowrap;
}

/* Accessibility button uses same hover style as other menu buttons */
#accessibility.active {
    background: #1178cb !important;
    color: #ffffff !important;
}

#accessibility.active svg {
    color: #ffffff !important;
}

#accessibility.active:hover {
    background: #1178cb !important;
    color: #ffffff !important;
}
/* ///////////// END BLOCK *138.5 */

/* ///////////// BEGIN BLOCK *140 */
/* Zoom Display - REMOVED (using browser native zoom) */
/* ///////////// END BLOCK *140 */

/* ///////////// BEGIN BLOCK *150 */
/* Overlay Container */
#overlay-container {
   position: absolute;
   top: 0;
   left: 0;
   pointer-events: none;
   /* z-index set by JavaScript from registry */
}

/* Scrollbar Styles */
::-webkit-scrollbar {
   width: 12px;
   height: 12px;
}

::-webkit-scrollbar-track {
   background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
   background: #888;
   border-radius: 6px;
}

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

/* Scrollbar for search context scroll container */
.ctx-scroll-container::-webkit-scrollbar {
   width: 6px;
}
.ctx-scroll-container::-webkit-scrollbar-track {
   background: #e8e8e8;
   border-radius: 3px;
}
.ctx-scroll-container::-webkit-scrollbar-thumb {
   background: #999;
   border-radius: 3px;
}
.ctx-scroll-container::-webkit-scrollbar-thumb:hover {
   background: #666;
}
.ctx-scroll-container {
   scrollbar-width: thin;
   scrollbar-color: #999 #e8e8e8;
}

/* Context entry resize handle */
.ctx-resize-handle:hover {
   background: #ccc !important;
}
.ctx-resize-handle:hover span {
   background: #666 !important;
}
/* ///////////// END BLOCK *150 */

/* ///////////// ADD BLOCK *155 - Insert between existing BLOCK *150 and existing BLOCK *160 */
/* Screenshot Mode Styles */
.screenshot-mode {
    cursor: crosshair !important;
}

.screenshot-frame {
    position: absolute;
    border: 1px solid darkgrey;
    background: rgba(128, 128, 128, 0.15);
    pointer-events: none;
}

.screenshot-frame.active {
    pointer-events: auto;
}

/* Screenshot resize handles */
.screenshot-frame .resize-handle {
    position: absolute;
    background: white;
    border: 1px solid black;
    width: 16px;
    height: 16px;
    pointer-events: auto;
    z-index: 9020;
}

.screenshot-frame .resize-handle.top {
    left: 50%;
    margin-left: -8px;
    cursor: ns-resize;
    top: -9px;
    z-index: 9025;
}

.screenshot-frame .resize-handle.bottom {
    left: 50%;
    margin-left: -8px;
    cursor: ns-resize;
    bottom: -9px;
}

.screenshot-frame .resize-handle.left {
    top: 50%;
    margin-top: -8px;
    cursor: ew-resize;
    left: -9px;
}

.screenshot-frame .resize-handle.right {
    top: 50%;
    margin-top: -8px;
    cursor: ew-resize;
    right: -9px;
}

/* Screenshot frame focus styles for keyboard accessibility */
.screenshot-frame:focus {
    outline: 3px solid #1178cb;
    outline-offset: 2px;
}

.screenshot-frame .resize-handle:focus {
    outline: none;
    box-shadow: 0 0 0 2px #1178cb;
    z-index: 99999 !important;
}

.screenshot-frame .resize-handle.top:focus {
    z-index: 99999 !important;
}

.screenshot-icon-container button:focus {
    outline: 2px solid #1178cb;
    border-radius: 2px;
}

/* Screenshot icon container menu */
.screenshot-icon-container {
    position: fixed;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    display: flex;
    gap: 6px;
    padding: 3px;
    pointer-events: auto;
}

.screenshot-icon-container svg {
    cursor: pointer;
    background: white;
}

.screenshot-icon-container svg:hover {
    background: #f0f0f0;
}

/* Screenshot success tooltip */
/* ///////////// END BLOCK *155 */

/* ///////////// REPLACE BLOCK *160 */
/* Text Selection (native) */
::selection {
   background: rgba(0, 123, 255, 0.3);
}

::-moz-selection {
   background: rgba(0, 123, 255, 0.3);
}

/* Disable text selection on UI elements */
#header-controls,
#line-numbers,
#menu-panel,
.panel-header,
.icon-menu,
.selection-menu {
   -webkit-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
}

/* Shake animation for invalid input */
@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) translateX(0); }
    25% { transform: translate(-50%, -50%) translateX(-5px); }
    75% { transform: translate(-50%, -50%) translateX(5px); }
}
/* ///////////// END BLOCK *160 */

/* ///////////// BEGIN BLOCK *165 */
/* Annotation Document Container Styles */
.quill-annotation-container {
    position: fixed;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    min-width: 400px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    /* z-index set dynamically via registry lookup */
}

.quill-annotation-header {
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.quill-annotation-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.quill-annotation-controls {
    display: flex;
    gap: 10px;
}

.quill-annotation-minimize,
.quill-annotation-maximize,
.quill-annotation-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quill-annotation-minimize:hover,
.quill-annotation-maximize:hover,
.quill-annotation-close:hover {
    color: #333;
}

.quill-annotation-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.quill-annotation-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 15px;
    height: 15px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, #ccc 50%);
}
/* ///////////// END BLOCK *165 */

/* ///////////// BEGIN BLOCK *166 */
/* Quill Annotation Block Styles */
.quill-annotation-entry {
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin: 10px 0;
    padding: 12px;
    background: #fafafa;
    position: relative;
}

.quill-annotation-entry.class-1 { border-left: 4px solid #4caf50; }
.quill-annotation-entry.class-2 { border-left: 4px solid #fdd835; }
.quill-annotation-entry.class-3 { border-left: 4px solid #ff9800; }
.quill-annotation-entry.class-4 { border-left: 4px solid #1178cb; }
.quill-annotation-entry.class-5 { border-left: 4px solid #f44336; }
.quill-annotation-entry.class-6 { border-left: 4px solid #000000; }

.quill-annotation-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.quill-annotation-entry-title {
    font-weight: bold;
    font-size: 12px;
    color: #333;
}

.quill-annotation-entry-controls {
    display: flex;
    gap: 8px;
}

.quill-annotation-entry-quoted {
    background: white;
    padding: 8px;
    margin: 8px 0;
    border-radius: 3px;
    font-style: italic;
    color: #666;
    font-size: 13px;
}

.quill-annotation-entry-note {
    padding: 8px;
    background: white;
    border-radius: 3px;
    min-height: 40px;
    font-size: 13px;
    color: #333;
}
/* ///////////// END BLOCK *166 */

/* ///////////// BEGIN BLOCK *167 */
/* Quill Filter Bar Styles */
.quill-filter-bar {
    background: #f8f8f8;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quill-filter-colors {
    display: flex;
    gap: 15px;
    align-items: center;
}

.quill-filter-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    margin-right: 10px;
}

.quill-color-filter {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quill-color-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--filter-color);
}

.quill-color-checkbox[data-color="1"] { accent-color: #4caf50; }
.quill-color-checkbox[data-color="2"] { accent-color: #fdd835; }
.quill-color-checkbox[data-color="3"] { accent-color: #ff9800; }
.quill-color-checkbox[data-color="4"] { accent-color: #1178cb; }
.quill-color-checkbox[data-color="5"] { accent-color: #f44336; }
.quill-color-checkbox[data-color="6"] { accent-color: #000000; }

.quill-color-label {
    font-size: 12px;
    color: #333;
    user-select: none;
    cursor: pointer;
}

.quill-filter-sort {
    display: flex;
    gap: 10px;
    align-items: center;
}

.quill-sort-select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 12px;
    background: white;
}
/* ///////////// END BLOCK *167 */

/* ///////////// BEGIN BLOCK *168 */
/* Quill Annotation Control Button Styles */
.annotation-goto-btn,
.annotation-delete-btn {
    background: transparent;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.annotation-goto-btn:hover {
    background: #e3f2fd;
    border-color: #1178cb;
}

.annotation-delete-btn:hover {
    background: #ffebee;
    border-color: #f44336;
}

.annotation-goto-btn svg,
.annotation-delete-btn svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Quill Editor Container Styles */
.quill-editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.quill-editor-container {
    flex: 1;
    overflow: auto;
    background: white;
    border: 1px solid #ddd;
}

.ql-toolbar {
    border: none !important;
    border-bottom: 1px solid #ddd !important;
    background: #fafafa;
}

.ql-container {
    border: none !important;
    font-size: 14px;
}

.ql-editor {
    min-height: 200px;
}

/* Annotation entry within Quill */
.ql-editor .quill-annotation-entry {
    user-select: none;
    margin: 15px 0;
}

.ql-editor .quill-annotation-entry-note {
    user-select: text;
    outline: none;
}

.ql-editor .quill-annotation-entry-note:focus {
    background: #f0f8ff;
    border: 1px solid #1178cb;
    padding: 7px;
}
/* ///////////// END BLOCK *168 */

/* ///////////// BEGIN BLOCK *170 */
/* Temporary Selection State */
.temp-selection {
   background: rgba(100, 100, 255, 0.2) !important;
   border: 1px solid rgba(100, 100, 255, 0.5);
}

/* Selection Overlay (old system - deprecated) */
.selection-overlay {
   position: absolute;
   background: rgba(255, 255, 0, 0.3);
   pointer-events: none;
   border: 1px solid rgba(255, 200, 0, 0.5);
   z-index: 5;
}
/* ///////////// END BLOCK *170 */

/* ///////////// BEGIN BLOCK *200 */
/* Canvas Detection Styles */
.detection-canvas {
    cursor: text;
}

.detection-canvas:active {
    cursor: text;
}

/* Drag search mode - highlighter cursor */
body.drag-search-mode #pages-container,
body.drag-search-mode .detection-canvas,
body.drag-search-mode .detection-canvas:active {
    cursor: url('data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22%3E%3Cg%3E%3Cpath fill=%22%2300CED1%22 d=%22M12.8 16.5 L9 20.2 L2.2 18 L8.2 12 Z%22/%3E%3Cpath fill=%22%23333333%22 d=%22M23.8 10 C23.6 9.8 23.5 9.8 23.2 9.8 C23 9.8 22.9 9.8 22.7 10 L18 14.7 L10.3 7 L10.1 6.8 L14.8 2 C15.1 1.7 15.1 1.3 14.8 1 C14.5 .7 14 .7 13.7 1 L9 5.7 C8.5 6.2 8.4 6.9 8.7 7.4 L6.8 9.4 C6.2 10 6.2 11 6.8 11.6 L7.2 12 L1.7 17.5 C1.5 17.6 1.5 17.9 1.5 18.2 C1.6 18.4 1.8 18.6 2 18.7 L8.8 21 C8.8 21 8.9 21 9 21 C9.2 21 9.4 20.9 9.5 20.8 L12.8 17.6 L13.2 18 C13.8 18.6 14.7 18.6 15.3 18 L17.3 16 C17.9 16.3 18.6 16.2 19.1 15.8 L23.8 11 C23.9 10.9 24 10.7 24 10.5 C24 10.3 23.9 10.1 23.8 10 M8.8 19.4 L3.6 17.7 L8.2 13.1 L11.7 16.5 ZM14.2 16.9 L13.3 16 L8.8 11.5 L7.8 10.5 L9.8 8.6 L16.2 15 Z%22/%3E%3C/g%3E%3C/svg%3E') 6 18, text !important;
}

/* Debug mode styles */
.detection-canvas[style*="opacity: 0.3"] {
    mix-blend-mode: multiply;
}
/* ///////////// END BLOCK *200 */

/* Word-compatible font families - Text Rendering */
.ql-font-calibri { font-family: Calibri, sans-serif; }
.ql-font-arial { font-family: Arial, sans-serif; }
.ql-font-times-new-roman { font-family: 'Times New Roman', serif; }
.ql-font-cambria { font-family: Cambria, serif; }
.ql-font-georgia { font-family: Georgia, serif; }
.ql-font-verdana { font-family: Verdana, sans-serif; }
.ql-font-tahoma { font-family: Tahoma, sans-serif; }
.ql-font-courier-new { font-family: 'Courier New', monospace; }

/* Font sizes in points (converted to pixels at 96 DPI: 1pt = 1.333px) */
.ql-size-8pt { font-size: 10.67px; }
.ql-size-9pt { font-size: 12px; }
.ql-size-10pt { font-size: 13.33px; }
.ql-size-11pt { font-size: 14.67px; }
.ql-size-12pt { font-size: 16px; }
.ql-size-14pt { font-size: 18.67px; }
.ql-size-16pt { font-size: 21.33px; }
.ql-size-18pt { font-size: 24px; }
.ql-size-20pt { font-size: 26.67px; }
.ql-size-22pt { font-size: 29.33px; }
.ql-size-24pt { font-size: 32px; }
.ql-size-26pt { font-size: 34.67px; }
.ql-size-28pt { font-size: 37.33px; }
.ql-size-36pt { font-size: 48px; }
.ql-size-48pt { font-size: 64px; }
.ql-size-72pt { font-size: 96px; }

/* Quill Dropdown Labels - Font Picker Display */
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=calibri]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=calibri]::before {
    content: 'Calibri' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=arial]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=arial]::before {
    content: 'Arial' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=times-new-roman]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=times-new-roman]::before {
    content: 'Times New Roman' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=cambria]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=cambria]::before {
    content: 'Cambria' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=georgia]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=georgia]::before {
    content: 'Georgia' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=verdana]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=verdana]::before {
    content: 'Verdana' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=tahoma]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=tahoma]::before {
    content: 'Tahoma' !important;
}
.ql-snow .ql-picker.ql-font .ql-picker-label[data-value=courier-new]::before,
.ql-snow .ql-picker.ql-font .ql-picker-item[data-value=courier-new]::before {
    content: 'Courier New' !important;
}

/* Quill Size Dropdown Labels */
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="8pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="8pt"]::before { content: '8pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="9pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="9pt"]::before { content: '9pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="10pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="10pt"]::before { content: '10pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="11pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="11pt"]::before { content: '11pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="12pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="12pt"]::before { content: '12pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="14pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="14pt"]::before { content: '14pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="16pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="16pt"]::before { content: '16pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="18pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="18pt"]::before { content: '18pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="20pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="20pt"]::before { content: '20pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="22pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="22pt"]::before { content: '22pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="24pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="24pt"]::before { content: '24pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="26pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="26pt"]::before { content: '26pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="28pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="28pt"]::before { content: '28pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="36pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="36pt"]::before { content: '36pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="48pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="48pt"]::before { content: '48pt' !important; }
.ql-snow .ql-picker.ql-size .ql-picker-label[data-value="72pt"]::before,
.ql-snow .ql-picker.ql-size .ql-picker-item[data-value="72pt"]::before { content: '72pt' !important; }
/* ============================================
   CLAIM CHART BUTTON STYLES
   ============================================ */

#claimchart {
    color: #7D7D7D;
}

#claimchart:hover {
    color: #333;
}

#claimchart svg {
    width: 18px;
    height: 18px;
}

/* Color picker keyboard navigation focus styles */
#color-picker-panel .color-picker-focus {
    outline: 2px solid #1178cb !important;
    outline-offset: 1px;
    border-radius: 2px;
}

#color-picker-panel [id^="color-swatch-"].color-picker-focus {
    outline-offset: 2px;
}

#color-picker-panel [id^="radio-highlight-"].color-picker-focus,
#color-picker-panel [id^="radio-underline-"].color-picker-focus {
    outline-offset: 0px;
}

/* Keyboard text selection mode styles */
.keyboard-selection-highlight {
    transition: opacity 0.1s ease;
}

#keyboard-selection-tooltip {
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Pencil menu styles */
#pencil-keyboard-menu [role="menuitem"]:focus {
    background: #e3f2fd;
    outline: 2px solid #1178cb;
    outline-offset: -2px;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   HELP WINDOW STYLES
   ============================================ */

.help-window {
    position: fixed;
    background: #ffffff;
    border: 1px solid #c0c0c0;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 3000;
    min-width: 400px;
    min-height: 300px;
    contain: layout style;
}

.help-window.dragging,
.help-window.resizing {
    will-change: width, height, left, top;
}

.help-window.visible {
    display: flex;
}

.help-window-header {
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1178cb;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
}

.help-window-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.help-window-title svg {
    width: 18px;
    height: 18px;
}

.help-window-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.help-window-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-window-btn:hover {
    background: rgba(255,255,255,0.2);
    color: #ffffff;
}

.help-window-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 1px;
}

.help-window-btn svg {
    width: 14px;
    height: 14px;
}

.help-window-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    position: relative;
}

.help-window-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Disable iframe pointer events during drag/resize */
.help-window.dragging .help-window-content iframe,
.help-window.resizing .help-window-content iframe {
    pointer-events: none;
}

/* Hide iframe during resize to prevent expensive reflows */
.help-window.resizing .help-window-content iframe {
    visibility: hidden;
}

/* Resize placeholder */
.help-window-resize-placeholder {
    display: none;
    position: absolute;
    inset: 0;
    background: #f0f0f0;
    align-items: center;
    justify-content: center;
    color: #767676;
    font-size: 13px;
}

.help-window.resizing .help-window-resize-placeholder {
    display: flex;
}

/* Global overlay to capture mouse during drag/resize */
.drag-resize-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    cursor: default;
}

.drag-resize-overlay.dragging {
    display: block;
    cursor: move;
}

.drag-resize-overlay.resizing {
    display: block;
    cursor: nwse-resize;
}

/* Resize handle */
.help-window-resize {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #c0c0c0 50%);
    border-radius: 0 0 8px 0;
}

.help-window-resize::before {
    content: '';
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 30px;
    height: 30px;
    cursor: nwse-resize;
}

/* ==================== RECENT SEARCHES POPUP STYLES ==================== */
#search-recent-popup {
    transition: opacity 0.15s ease-in-out;
}

#search-recent-popup .recent-search-item {
    transition: background-color 0.15s ease;
}

#search-recent-popup .recent-search-item:focus {
    outline: 2px solid #1178cb;
    outline-offset: -2px;
    background: #e3f2fd !important;
}

#search-recent-popup .recent-search-item:focus-visible {
    outline: 2px solid #1178cb;
    outline-offset: -2px;
}

#search-recent-popup .delete-history-item:focus {
    outline: 2px solid #f44336;
    outline-offset: 1px;
}

#search-recent-popup .delete-history-item:focus-visible {
    outline: 2px solid #f44336;
    outline-offset: 1px;
}

#clear-all-history:hover {
    background: #ffebee !important;
    color: #f44336 !important;
    border-color: #f44336 !important;
}

#clear-all-history:focus {
    outline: 2px solid #f44336;
    outline-offset: 1px;
}

/* Multi-term search indicator badge */
.search-multi-term-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: #1178cb;
    background: #e3f2fd;
    padding: 1px 6px;
    border-radius: 10px;
    margin-top: 2px;
}

.search-multi-term-badge svg {
    width: 10px;
    height: 10px;
}

/* ==================== CROSS-TAB SEARCH TAB BAR ==================== */
.search-tab-bar {
    overflow-x: auto;
    scrollbar-width: thin;
}

.search-tab-bar::-webkit-scrollbar {
    height: 3px;
}

.search-tab-bar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.search-patent-tab {
    position: relative;
    padding: 3px 8px;
    font-size: 10px;
    border: 1px solid #ddd;
    border-bottom: 2px solid transparent;
    background: white;
    cursor: pointer;
    border-radius: 3px 3px 0 0;
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
    font-weight: 500;
    transition: border-bottom-color 0.15s, background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.search-patent-tab:hover {
    background: #f0f0f0;
    color: #333;
}

.search-patent-tab.active {
    border-bottom: 2px solid #1178cb;
    background: #1178cb;
    color: white;
    font-weight: 600;
}

.search-patent-tab.stale::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background: #ff9800;
    border-radius: 50%;
    margin-left: 3px;
    flex-shrink: 0;
}

.search-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 12px;
    font-size: 10px;
    line-height: 1;
    color: #555;
    cursor: pointer;
    border-radius: 2px;
    flex-shrink: 0;
}

.search-tab-close:hover {
    background: #e0e0e0;
    color: #333;
}

.search-patent-tab.active .search-tab-close {
    color: rgba(255,255,255,0.7);
}

.search-patent-tab.active .search-tab-close:hover {
    background: rgba(255,255,255,0.2);
    color: white;
}

.search-patent-tab.active.stale::after {
    background: #ffcc80;
}

/* Add-patent picker dropdown */
.search-add-patent-picker {
    z-index: 10;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    min-width: 140px;
    max-width: 220px;
    max-height: 200px;
    overflow-y: auto;
}

.search-picker-item {
    padding: 5px 10px;
    font-size: 11px;
    color: #333;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-picker-item:hover {
    background: #e3f2fd;
    color: #1178cb;
}

.search-picker-empty {
    padding: 10px;
    font-size: 11px;
    color: #333;
    font-style: italic;
    text-align: center;
}

/* ==================== ADA TEXT CONTRAST — SEARCH PANEL ==================== */
/* All text in search popup content area must meet WCAG AA contrast (4.5:1) */
/* against white background. #333 on white = 12.6:1 ratio. */
.search-popup .search-popup-content {
    color: #333;
}

.search-popup .search-popup-content span,
.search-popup .search-popup-content label,
.search-popup .search-popup-content legend,
.search-popup .search-popup-content div {
    color: #333 !important;
}

/* Active tab must override ADA color for white-on-blue */
.search-popup .search-patent-tab.active,
.search-popup .search-patent-tab.active .search-tab-label,
.search-popup .search-patent-tab.active .search-tab-close {
    color: white !important;
}

/* Inactive tabs stay dark for ADA */
.search-popup .search-patent-tab:not(.active) {
    color: #333 !important;
}

/* Preserve blue color for interactive elements */
.search-popup .search-popup-content .search-result-entry span[style*="color:#1178cb"],
.search-popup .search-popup-content #in-context-label,
.search-popup .search-popup-content [id$="-results-label"] {
    color: #333 !important;
}

/* Preserve result match bold text as black */
.search-popup .search-popup-content .ctx-word b {
    color: #000 !important;
}

/* Status text can stay colored for semantic meaning */
.search-popup .search-popup-content #search-status {
    color: inherit !important;
}

/* Prefix labels in result entries stay blue for visual distinction */
.search-popup .search-popup-content .search-result-entry span[style*="font-weight:600"] {
    color: #1178cb !important;
}

/* ── Storage menu toggle buttons (library popout) ── */
.po-toggle-btn:hover {
    opacity: 0.85;
}
