/**
 * Policy Annotation System Styles
 *
 * Styles for personal annotations (highlights, notes, snippets) in the policy reader.
 * Supports light, dark, and sepia themes.
 */

/* ==================== Text Selection - MUST be enabled for annotations ==================== */

/* Force text selection to be enabled on content areas */
.conversation-container,
.node-content,
.response-content,
.conversation-node,
.dialogue-wrapper,
#conversationContainer {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
    -webkit-touch-callout: default !important;
}

/* Ensure text elements are selectable */
.node-content p,
.node-content span,
.node-content li,
.node-content h1,
.node-content h2,
.node-content h3,
.node-content blockquote,
.response-content p,
.response-content span {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    user-select: text !important;
    cursor: text;
}

/* Selection highlight color for better visibility */
.node-content ::selection,
.response-content ::selection,
.conversation-node ::selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: inherit;
}

.node-content ::-moz-selection,
.response-content ::-moz-selection,
.conversation-node ::-moz-selection {
    background-color: rgba(59, 130, 246, 0.3);
    color: inherit;
}

/* ==================== Interactive Elements Selection Fix ==================== */
/* Ensure all clickable/interactive spans within content are still text-selectable.
   This prevents buttons and clickable elements from breaking drag-to-select. */
.node-content .inline-citation,
.node-content .cited-source-citation,
.node-content .edition-citation,
.node-content [role="button"],
.node-content [tabindex],
.response-content .inline-citation,
.response-content .cited-source-citation,
.response-content .edition-citation {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* ==================== CSS Variables ==================== */

:root {
    /* Annotation colors */
    --annotation-yellow: #fef08a;
    --annotation-green: #bbf7d0;
    --annotation-blue: #bfdbfe;
    --annotation-pink: #fbcfe8;
    --annotation-purple: #e9d5ff;
    --annotation-orange: #fed7aa;

    /* Light theme defaults */
    --annotation-toolbar-bg: #ffffff;
    --annotation-toolbar-border: #e5e7eb;
    --annotation-toolbar-shadow: rgba(0, 0, 0, 0.15);
    --annotation-btn-bg: #ffffff;
    --annotation-btn-hover: #f3f4f6;
    --annotation-btn-text: #374151;
    --annotation-modal-bg: #ffffff;
    --annotation-modal-overlay: rgba(0, 0, 0, 0.5);
    --annotation-input-border: #d1d5db;
    --annotation-input-bg: #ffffff;
    --annotation-toast-success-bg: #10b981;
    --annotation-toast-error-bg: #ef4444;
}

/* Dark theme */
[data-theme="dark"] {
    --annotation-yellow: rgba(254, 240, 138, 0.3);
    --annotation-green: rgba(187, 247, 208, 0.3);
    --annotation-blue: rgba(191, 219, 254, 0.3);
    --annotation-pink: rgba(251, 207, 232, 0.3);
    --annotation-purple: rgba(233, 213, 255, 0.3);
    --annotation-orange: rgba(254, 215, 170, 0.3);

    --annotation-toolbar-bg: #1f2937;
    --annotation-toolbar-border: #374151;
    --annotation-toolbar-shadow: rgba(0, 0, 0, 0.4);
    --annotation-btn-bg: #1f2937;
    --annotation-btn-hover: #374151;
    --annotation-btn-text: #e5e7eb;
    --annotation-modal-bg: #1f2937;
    --annotation-modal-overlay: rgba(0, 0, 0, 0.7);
    --annotation-input-border: #4b5563;
    --annotation-input-bg: #111827;
}

/* Sepia theme */
[data-theme="sepia"] {
    --annotation-toolbar-bg: #f5f0e6;
    --annotation-toolbar-border: #d6c9b5;
    --annotation-btn-bg: #f5f0e6;
    --annotation-btn-hover: #ebe3d3;
    --annotation-btn-text: #5c4a32;
    --annotation-modal-bg: #f5f0e6;
    --annotation-input-border: #c9b99a;
    --annotation-input-bg: #faf7f0;
}

/* ==================== Selection Toolbar ==================== */

.policy-annotation-toolbar {
    position: absolute;
    z-index: 10000;
    background: var(--annotation-toolbar-bg);
    border: 1px solid var(--annotation-toolbar-border);
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--annotation-toolbar-shadow);
    padding: 6px;
    animation: policyAnnotationFadeIn 0.15s ease-out;
}

.policy-annotation-toolbar .annotation-toolbar-content {
    display: flex;
    gap: 4px;
    align-items: center;
}

.policy-annotation-toolbar .annotation-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--annotation-btn-bg);
    border: 1px solid var(--annotation-toolbar-border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--annotation-btn-text);
    transition: all 0.15s ease;
    white-space: nowrap;
}

.policy-annotation-toolbar .annotation-btn:hover {
    background: var(--annotation-btn-hover);
}

.policy-annotation-toolbar .annotation-btn svg {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.policy-annotation-toolbar .annotation-btn span {
    display: none;
}

@media (min-width: 640px) {
    .policy-annotation-toolbar .annotation-btn span {
        display: inline;
    }
}

.policy-annotation-toolbar .annotation-btn-close {
    padding: 6px;
    background: transparent;
    border: none;
    opacity: 0.6;
}

.policy-annotation-toolbar .annotation-btn-close:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Primary action button (Ask AI) */
.policy-annotation-toolbar .annotation-btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.policy-annotation-toolbar .annotation-btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.policy-annotation-toolbar .annotation-btn-primary svg {
    opacity: 1;
}

/* Dark theme primary button */
[data-theme="dark"] .policy-annotation-toolbar .annotation-btn-primary {
    background: #3b82f6;
    border-color: #3b82f6;
}

[data-theme="dark"] .policy-annotation-toolbar .annotation-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Sepia theme primary button */
[data-theme="sepia"] .policy-annotation-toolbar .annotation-btn-primary {
    background: #8b5a2b;
    border-color: #8b5a2b;
    color: #ffffff;
}

[data-theme="sepia"] .policy-annotation-toolbar .annotation-btn-primary:hover {
    background: #704821;
    border-color: #704821;
}

/* ==================== Annotation Modal ==================== */

.policy-annotation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: policyAnnotationFadeIn 0.15s ease-out;
}

.policy-annotation-modal .annotation-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--annotation-modal-overlay);
}

.policy-annotation-modal .annotation-modal-content {
    position: relative;
    background: var(--annotation-modal-bg);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: policyAnnotationSlideUp 0.2s ease-out;
}

.policy-annotation-modal .annotation-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--annotation-toolbar-border);
}

.policy-annotation-modal .annotation-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--annotation-btn-text);
}

.policy-annotation-modal .annotation-modal-close {
    background: none;
    border: none;
    color: var(--annotation-btn-text);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: all 0.15s;
}

.policy-annotation-modal .annotation-modal-close:hover {
    opacity: 1;
    background: var(--annotation-btn-hover);
}

.policy-annotation-modal .annotation-modal-body {
    padding: 20px;
}

.policy-annotation-modal .annotation-selected-text {
    margin-bottom: 20px;
}

.policy-annotation-modal .annotation-selected-text .label {
    font-size: 12px;
    font-weight: 500;
    color: var(--annotation-btn-text);
    opacity: 0.7;
    display: block;
    margin-bottom: 8px;
}

.policy-annotation-modal .annotation-selected-text blockquote {
    background: var(--annotation-yellow);
    border-left: 3px solid #f59e0b;
    padding: 12px;
    margin: 0;
    font-style: italic;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    max-height: 100px;
    overflow-y: auto;
}

.policy-annotation-modal .annotation-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.policy-annotation-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.policy-annotation-modal .form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--annotation-btn-text);
}

.policy-annotation-modal .form-group label .required {
    color: #ef4444;
}

.policy-annotation-modal .annotation-input,
.policy-annotation-modal .annotation-textarea,
.policy-annotation-modal .annotation-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--annotation-input-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: var(--annotation-input-bg);
    color: var(--annotation-btn-text);
    transition: border-color 0.15s;
}

.policy-annotation-modal .annotation-input:focus,
.policy-annotation-modal .annotation-textarea:focus,
.policy-annotation-modal .annotation-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.policy-annotation-modal .annotation-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Color Picker */
.policy-annotation-modal .annotation-color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.policy-annotation-modal .color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.policy-annotation-modal .color-btn:hover {
    transform: scale(1.1);
}

.policy-annotation-modal .color-btn.selected {
    border-color: #1f2937;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #1f2937;
}

[data-theme="dark"] .policy-annotation-modal .color-btn.selected {
    border-color: #e5e7eb;
    box-shadow: 0 0 0 2px #1f2937, 0 0 0 4px #e5e7eb;
}

/* Modal Footer */
.policy-annotation-modal .annotation-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--annotation-toolbar-border);
}

.policy-annotation-modal .annotation-btn-secondary {
    background: transparent;
    color: var(--annotation-btn-text);
    border: 1px solid var(--annotation-input-border);
}

.policy-annotation-modal .annotation-btn-secondary:hover {
    background: var(--annotation-btn-hover);
}

.policy-annotation-modal .annotation-btn-primary {
    background: #3b82f6;
    color: white;
    border: 1px solid #3b82f6;
}

.policy-annotation-modal .annotation-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* ==================== Toast Notifications ==================== */

.policy-annotation-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 10002;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.policy-annotation-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.policy-annotation-toast-success {
    background: var(--annotation-toast-success-bg);
}

.policy-annotation-toast-error {
    background: var(--annotation-toast-error-bg);
}

.policy-annotation-toast-info {
    background: #3b82f6;
}

/* ==================== Highlight Colors in Content ==================== */

.policy-highlight {
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.15s;
}

.policy-highlight:hover {
    filter: brightness(0.95);
}

.policy-highlight-yellow { background-color: var(--annotation-yellow); }
.policy-highlight-green { background-color: var(--annotation-green); }
.policy-highlight-blue { background-color: var(--annotation-blue); }
.policy-highlight-pink { background-color: var(--annotation-pink); }
.policy-highlight-purple { background-color: var(--annotation-purple); }
.policy-highlight-orange { background-color: var(--annotation-orange); }

/* Note indicator */
.policy-highlight.has-note::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: super;
    font-size: 8px;
}

/* Snippet indicator */
.policy-highlight.is-snippet {
    border-bottom: 2px dashed currentColor;
}

/* ==================== Sidebar Tab Navigation ==================== */

.annotation-sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--annotation-toolbar-border);
    margin-bottom: 0;
    flex-shrink: 0;
}

.annotation-sidebar-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    color: var(--annotation-btn-text);
    cursor: pointer;
    transition: all 0.15s;
    opacity: 0.7;
}

.annotation-sidebar-tab svg {
    width: 14px;
    height: 14px;
}

.annotation-sidebar-tab:hover {
    opacity: 1;
    background: var(--annotation-btn-hover);
}

.annotation-sidebar-tab.active {
    opacity: 1;
    border-bottom-color: #3b82f6;
    color: #3b82f6;
}

/* Tab Content Containers */
.tab-content {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for flex children to shrink below content size */
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

.tab-content.my-annotations-tab {
    padding: 0;
    overflow: hidden;
}

.tab-content.community-tab {
    padding: 0;
    overflow: hidden;
}

/* ==================== My Annotations Panel ==================== */

.my-annotations-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Allow shrinking below content size */
    overflow: hidden;
}

.my-annotations-panel.active {
    display: flex;
}

.my-annotations-content {
    flex: 1;
    min-height: 0; /* Important: allow shrinking */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
}

/* Container inside tab content */
.my-annotations-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0; /* Allow shrinking */
    overflow: hidden;
}

/* Annotation groups in my annotations */
.annotation-group {
    margin-bottom: 16px;
}

.annotation-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--annotation-btn-text, #374151);
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--annotation-toolbar-border, #e5e7eb);
    margin-bottom: 8px;
}

.annotation-group-header .count {
    background: var(--annotation-btn-hover, #f3f4f6);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Color indicators on annotation cards */
.my-annotation-card.annotation-color-yellow {
    border-left: 3px solid var(--annotation-yellow, #fef08a);
}

.my-annotation-card.annotation-color-green {
    border-left: 3px solid var(--annotation-green, #bbf7d0);
}

.my-annotation-card.annotation-color-blue {
    border-left: 3px solid var(--annotation-blue, #bfdbfe);
}

.my-annotation-card.annotation-color-pink {
    border-left: 3px solid var(--annotation-pink, #fbcfe8);
}

.my-annotation-card.annotation-color-purple {
    border-left: 3px solid var(--annotation-purple, #e9d5ff);
}

.my-annotation-card.annotation-color-orange {
    border-left: 3px solid var(--annotation-orange, #fed7aa);
}

/* Tags styling */
.annotation-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.annotation-tags .tag {
    background: var(--annotation-btn-hover, #f3f4f6);
    color: var(--annotation-btn-text, #374151);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.my-annotations-filters {
    display: flex;
    gap: 8px;
    padding: 12px;
    flex-wrap: wrap;
    flex-shrink: 0; /* Don't shrink - stay fixed at top */
    border-bottom: 1px solid var(--annotation-toolbar-border, #e5e7eb);
}

.my-annotations-filters .filter-btn {
    padding: 6px 12px;
    background: var(--annotation-btn-bg);
    border: 1px solid var(--annotation-toolbar-border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--annotation-btn-text);
    cursor: pointer;
    transition: all 0.15s;
}

.my-annotations-filters .filter-btn:hover {
    background: var(--annotation-btn-hover);
}

.my-annotations-filters .filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

.my-annotations-list {
    padding: 12px;
    padding-bottom: 20px; /* Extra bottom padding for scroll comfort */
}

.my-annotation-card {
    padding: 12px;
    background: var(--annotation-btn-bg);
    border: 1px solid var(--annotation-toolbar-border);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.15s;
}

.my-annotation-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.my-annotation-card .annotation-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--annotation-btn-hover);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--annotation-btn-text);
    margin-bottom: 8px;
}

.my-annotation-card .annotation-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--annotation-btn-text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-annotation-card .annotation-note {
    font-size: 12px;
    color: var(--annotation-btn-text);
    opacity: 0.8;
    font-style: italic;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.my-annotation-card .annotation-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--annotation-btn-text);
    opacity: 0.6;
}

.my-annotation-card .annotation-actions {
    display: flex;
    gap: 8px;
}

.my-annotation-card .annotation-action-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--annotation-btn-text);
    opacity: 0.5;
    transition: all 0.15s;
}

.my-annotation-card .annotation-action-btn:hover {
    opacity: 1;
}

.my-annotation-card .annotation-action-btn.favorite.active {
    color: #f59e0b;
    opacity: 1;
}

/* Export button - fixed at bottom, outside scroll area */
.my-annotations-export-btn {
    flex-shrink: 0;
    width: calc(100% - 24px);
    padding: 12px;
    margin: 12px;
    background: var(--annotation-btn-bg);
    border: 1px solid var(--annotation-toolbar-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--annotation-btn-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s;
}

.my-annotations-export-btn:hover {
    background: var(--annotation-btn-hover);
    border-color: #3b82f6;
}

/* Empty state */
.my-annotations-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--annotation-btn-text);
    opacity: 0.6;
}

.my-annotations-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.my-annotations-empty p {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.my-annotations-empty .hint {
    font-size: 12px;
    opacity: 0.8;
}

/* Loading state for my annotations */
.my-annotations-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.my-annotations-loading .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--annotation-toolbar-border, #e5e7eb);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: policyAnnotationSpin 0.8s linear infinite;
}

.my-annotations-loading p {
    margin-top: 12px;
    font-size: 13px;
    color: var(--annotation-btn-text, #374151);
    opacity: 0.7;
}

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

/* Error state */
.annotation-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--annotation-btn-text, #374151);
}

.annotation-error .retry-btn {
    margin-top: 12px;
    padding: 8px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.annotation-error .retry-btn:hover {
    background: #2563eb;
}

/* ==================== Animations ==================== */

@keyframes policyAnnotationFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes policyAnnotationSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Color Picker Popup ==================== */

.policy-annotation-color-picker-popup {
    position: absolute;
    z-index: 10001;
    background: var(--annotation-toolbar-bg, #ffffff);
    border: 1px solid var(--annotation-toolbar-border, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--annotation-toolbar-shadow, rgba(0, 0, 0, 0.15));
    padding: 12px;
    animation: fadeInScale 0.15s ease-out;
}

.color-picker-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-picker-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--annotation-btn-text, #374151);
    opacity: 0.8;
}

.color-picker-options {
    display: flex;
    gap: 8px;
}

.color-picker-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
}

.color-picker-btn:hover {
    transform: scale(1.15);
    border-color: rgba(0, 0, 0, 0.2);
}

.color-picker-btn:active {
    transform: scale(1.05);
}

/* Dark theme */
[data-theme="dark"] .color-picker-btn:hover {
    border-color: rgba(255, 255, 255, 0.3);
}

/* ==================== Note Number Indicator ==================== */

.policy-highlight.has-note {
    position: relative;
}

.policy-highlight.has-note::after {
    content: attr(data-note-number);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    background: #3b82f6;
    color: white;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: super;
    font-size: 10px;
    font-weight: 600;
    padding: 0 4px;
}

/* Without number, show just a dot */
.policy-highlight.has-note:not([data-note-number])::after {
    content: '';
    width: 8px;
    height: 8px;
    min-width: 8px;
    padding: 0;
}

/* ==================== Mobile Adjustments ==================== */

@media (max-width: 640px) {
    .policy-annotation-toolbar {
        padding: 4px;
    }

    .policy-annotation-toolbar .annotation-btn {
        padding: 10px;
    }

    .policy-annotation-modal .annotation-modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .annotation-sidebar-tabs {
        flex-wrap: wrap;
    }

    .annotation-sidebar-tab {
        padding: 10px 12px;
        font-size: 12px;
    }

    .policy-annotation-color-picker-popup {
        padding: 10px;
    }

    .color-picker-btn {
        width: 28px;
        height: 28px;
    }
}
