/* CSS for Document Annotations in File Manager */

.thx-fm-ann-hl {
    background-color: transparent;
    cursor: pointer;
    border-radius: 2px;
    transition: background-color 0.2s, box-shadow 0.2s;
    position: relative;
}
.thx-fm-ann-hl.hl-active {
    box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
    z-index: 2;
}

/* Tooltip: Bấm để xem ghi chú */
.thx-fm-ann-note-icon[data-tooltip-text]::before {
    content: attr(data-tooltip-text);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(0) scale(0.9);
    background: #ffffff;
    color: #2563eb;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); /* Hiệu ứng nảy (spring) */
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.thx-fm-ann-note-icon[data-tooltip-text]::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 11;
    pointer-events: none;
}
.thx-fm-ann-hl.hl-hovered .thx-fm-ann-note-icon[data-tooltip-text]::before,
.thx-fm-ann-note-icon[data-tooltip-text]:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-6px) scale(1);
}
.thx-fm-ann-hl.hl-hovered .thx-fm-ann-note-icon[data-tooltip-text]::after,
.thx-fm-ann-note-icon[data-tooltip-text]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0px);
}

/* Icon huy hiệu báo có ghi chú */
.thx-fm-ann-note-icon {
    position: relative; /* Thêm relative để làm gốc cho tooltip */
    display: inline-block;
    vertical-align: 4px; /* Đưa lên cao như superscript */
    margin-right: 3px;
    margin-left: -2px;
    color: #2563eb;
    background: #eff6ff; /* Nền xanh nhạt */
    border-radius: 50%;
    padding: 3px; /* Bọc xung quanh icon */
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 0 0 1px rgba(59, 130, 246, 0.1);
    transition: transform 0.2s, background 0.2s;
}
.thx-fm-ann-note-icon svg {
    display: block;
    width: 10px;
    height: 10px;
}
.thx-fm-ann-hl:hover .thx-fm-ann-note-icon {
    transform: translateY(-1px) scale(1.05);
    background: #dbeafe;
}

/* Action Tooltip */
.thx-fm-ann-action-tt {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.2);
    z-index: 999999;
    display: none;
    padding: 6px;
    opacity: 0;
    transform: translateY(5px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.thx-fm-ann-action-tt.is-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.thx-fm-ann-action-tt::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 19px; /* Cố định vị trí tam giác ứng với tâm của icon bút */
    transform: translateX(-50%);
    border-width: 6px 6px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

@media (max-width: 768px) {
    .thx-fm-ann-action-tt::after {
        bottom: auto;
        top: -6px;
        border-width: 0 6px 6px;
        border-color: transparent transparent #fff transparent;
    }
}

.thx-fm-ann-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.thx-fm-ann-colors-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    padding: 3px 0; /* Đủ padding dọc để chứa các màu khi bị scale(1.15) */
    transition: max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease-in-out;
}

.thx-fm-ann-toolbar:hover .thx-fm-ann-colors-wrap {
    max-width: 400px; /* Nới rộng tối đa để không bị che khuất màu cuối */
    padding-right: 4px;
    opacity: 1;
}

.thx-fm-ann-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
}
.thx-fm-ann-btn-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.1s;
    flex-shrink: 0;
}
.thx-fm-ann-btn-swatch:hover {
    transform: scale(1.15);
}
.thx-fm-ann-btn-swatch.is-active {
    border-color: #333;
    transform: scale(1.1);
}
.thx-fm-ann-sep {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 4px;
}
.thx-fm-ann-btn-hl {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    color: #333;
    transition: filter 0.1s;
}
.thx-fm-ann-btn-hl:hover {
    filter: brightness(0.9);
}
.thx-fm-ann-btn-hl svg {
    width: 16px;
    height: 16px;
}

/* Rich Editor Modal */
.thx-fm-ann-editor-modal {
    position: absolute;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.2);
    width: 300px;
    z-index: 999998;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.thx-fm-ann-editor-modal.is-visible {
    display: flex;
}
.thx-fm-ann-editor-header {
    background: #f8fafc;
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: grab;
}
.thx-fm-ann-editor-header:active {
    cursor: grabbing;
}
.thx-fm-ann-editor-header button {
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    padding: 4px;
    display: flex;
    align-items: center;
    color: #475569;
}
.thx-fm-ann-editor-header button:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.thx-fm-ann-editor-header button svg {
    width: 14px;
    height: 14px;
}
.thx-fm-ann-editor-body {
    padding: 10px;
    min-height: 80px;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    font-size: 14px;
    line-height: 1.5;
}
.thx-fm-ann-editor-body[placeholder]:empty:before {
    content: attr(placeholder);
    color: #94a3b8;
    pointer-events: none;
}
.thx-fm-ann-editor-footer {
    padding: 8px 10px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.thx-fm-ann-editor-footer button.btn-close {
    background: #e2e8f0;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.thx-fm-ann-editor-footer button.btn-delete {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.thx-fm-ann-editor-footer button.btn-delete:hover {
    background: #fee2e2;
}

/* Floating Panel (Right corner) */
.thx-fm-ann-panel {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 999990;
    overflow: hidden;
    font-family: inherit;
    border: 1px solid #e2e8f0;
    display: none;
}
.thx-fm-ann-panel.is-visible {
    display: block;
}
.thx-fm-ann-panel-header {
    padding: 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.thx-fm-ann-panel-header h4 {
    margin: 0;
    font-size: 15px;
    color: #0f172a;
}
.thx-fm-ann-panel-header .btn-close {
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #64748b;
}
.thx-fm-ann-panel-body {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}
.thx-fm-ann-toggle-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #e2e8f0;
}
.thx-fm-ann-toggle-label {
    font-size: 14px;
    color: #334155;
    flex: 1;
}

/* Switch toggle */
.thx-fm-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-left: 10px;
}
.thx-fm-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.thx-fm-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 20px;
}
.thx-fm-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .thx-fm-slider {
    background-color: #10b981;
}
input:checked + .thx-fm-slider:before {
    transform: translateX(16px);
}

.thx-fm-shared-users-title {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 10px;
    font-weight: 600;
}
.thx-fm-shared-users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.thx-fm-shared-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border: 1px solid transparent;
}
.thx-fm-shared-user:hover {
    background: #f1f5f9;
}
.thx-fm-shared-user.is-active {
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.thx-fm-shared-user img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.thx-fm-shared-user span {
    font-size: 14px;
    color: #334155;
    flex: 1;
}

/* Float trigger button (if hidden) */
.thx-fm-ann-trigger {
    position: fixed;
    right: 20px;
    top: 208px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999980;
    transition: transform 0.2s;
    border: 1px solid #e2e8f0;
    color: #475569;
}
.thx-fm-ann-trigger:hover {
    transform: scale(1.05);
    color: #0f172a;
}
.thx-fm-ann-trigger svg {
    width: 20px;
    height: 20px;
}
.thx-fm-ann-trigger.is-hidden {
    display: none;
}
