/* ABOUTME: Styles for the inline annotation system (#23). Covers the
   floating comment icon, annotation markers/highlights, drag handles,
   inline textarea container, and SVG band overlays. */

/* --- Sentence spans: clickable, hover highlight for discoverability --- */
.ann-sentence {
    cursor: pointer;
    border-radius: 0.1rem;
    transition: background-color 0.15s;
}
.ann-sentence:hover {
    background-color: rgba(37, 99, 235, 0.12);
}

/* --- Text annotation markers (HTML view) --- */
.ann-marker {
    background-color: rgba(250, 204, 21, 0.25);
    border-bottom: 2px dotted rgba(180, 140, 0, 0.5);
    cursor: pointer;
    position: relative;
}
.ann-marker[data-depth="2"] {
    background-color: rgba(250, 204, 21, 0.45);
}
.ann-marker[data-depth="3"] {
    background-color: rgba(250, 204, 21, 0.6);
}

/* --- Drag handles --- */
.ann-handle {
    display: inline-block;
    width: 0.5rem;
    height: 1.2em;
    background: #2563eb;
    border-radius: 2px;
    cursor: col-resize;
    touch-action: none;
    vertical-align: middle;
    margin: 0 2px;
}
.ann-handle-top,
.ann-handle-bottom {
    display: block;
    width: 100%;
    height: 0.5rem;
    background: #2563eb;
    border-radius: 2px;
    cursor: row-resize;
    touch-action: none;
}

/* --- Inline textarea container --- */
/* --- Inline textarea container: overlays content below, draggable --- */
.ann-textarea-container {
    margin: 0.5rem 0;
    padding: 0.5rem;
    padding-top: 1.25rem; /* room for drag handle */
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #fefce8;
    position: relative;
    width: 100%;
    z-index: 500;
    display: flex;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    box-sizing: border-box;
    font-family: "Asap", system-ui, -apple-system, sans-serif;
}
@media (max-width: 48rem) {
    .ann-textarea-container {
        width: 100%;
    }
}
.ann-drag-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1.1rem;
    cursor: grab;
    text-align: center;
    color: #9ca3af;
    font-size: 0.7rem;
    line-height: 1.1rem;
    user-select: none;
    touch-action: none;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 0.375rem 0.375rem 0 0;
    background: #fef9e7;
}
.ann-drag-handle:active {
    cursor: grabbing;
}
.ann-textarea-container textarea {
    flex: 1;
    min-height: 4rem;
    padding: 0.4rem;
    font-family: "Asap", system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    resize: vertical;
    box-sizing: border-box;
}
.ann-textarea-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    justify-content: flex-start;
}
.ann-textarea-actions button,
.ann-textarea-actions .ann-status-glyph {
    min-width: 2.75rem;
    min-height: 2.75rem; /* WCAG 2.5.5: 44px minimum touch target */
    font-size: 1.3rem;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ann-textarea-actions button {
    border: none;
}
.ann-textarea-actions button {
    cursor: pointer;
}
.ann-status-glyph {
    background: #f5f5f4;
    color: #78716c;
    cursor: default;
    font-weight: bold;
    border: 1px solid #e7e5e4;
    transition: color 0.2s, background 0.2s;
}
.ann-status-glyph.saved {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}
.ann-status-glyph.modified {
    color: #b45309;
    background: #fef3c7;
    border-color: #fcd34d;
}
.ann-status-glyph.error {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}
.ann-btn-delete {
    background: #fee2e2;
    color: #991b1b;
}
.ann-btn-delete:hover {
    background: #fecaca;
}

/* --- SVG band overlays --- */
.ann-svg-band {
    position: absolute;
    left: 0;
    right: 0;
    background-color: rgba(250, 204, 21, 0.25);
    border-top: 2px dashed rgba(180, 140, 0, 0.5);
    border-bottom: 2px dashed rgba(180, 140, 0, 0.5);
    cursor: pointer;
    pointer-events: all;
    z-index: 10;
}
.ann-svg-band[data-depth="2"] {
    background-color: rgba(250, 204, 21, 0.45);
}
.ann-svg-band-handle {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #2563eb;
    cursor: row-resize;
    touch-action: none;
    z-index: 11;
    opacity: 0.7;
}
.ann-svg-band-handle:hover {
    opacity: 1;
}
.ann-svg-band-handle.top { top: -1px; }
.ann-svg-band-handle.bottom { bottom: -1px; }
/* Gripper protrusion in center of handle */
.ann-svg-band-handle::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    top: 50%;
    width: 6rem;
    height: 0.6rem;
    background: #2563eb;
    border-radius: 0.3rem;
}

/* --- Error overlay on save failure --- */
.ann-error-overlay {
    position: absolute;
    top: 1.25rem; /* below drag handle */
    left: 0.5rem;
    right: 3.5rem; /* leave room for buttons */
    bottom: 0.5rem;
    background: rgba(254, 226, 226, 0.85);
    color: #991b1b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem;
    border-radius: 0.25rem;
    pointer-events: none; /* let clicks through to the ✓ button underneath */
}

/* --- Save status indicator (reused from feedback-autosave) --- */
.ann-save-status {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    min-height: 1.2em;
}
.ann-save-status.saved {
    color: #166534;
}
.ann-save-status.error {
    color: #991b1b;
}

/* --- Responsive: stack textarea below on mobile --- */
@media (max-width: 48rem) {
    .ann-float-icon {
        bottom: 1rem;
        top: auto;
        right: 1rem;
    }
}
