/* ==============================================================================
   DOCUMENT TOOLTIP SYSTEM - RESPONSIVE POSITIONING
============================================================================== */

/* ===== Document Tooltip Styling ===== */
.document-tooltip {
    position: absolute;
    top: 40px;
    right: 10px; /* Changed from 0 to 10px for consistent margin */
    left: auto;
    background: var(--tooltip-bg);
    color: var(--text-color-1);
    padding: 10px;
    border-radius: 15px;
    width: 280px;
    max-width: calc(100vw - 40px); /* Ensures 20px margin on each side */
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    box-shadow: var(--cards-shadow);
    backdrop-filter: blur(10px);
    border: 1px solid var(--tooltip-border);
}

.document-tooltip::before {
    content: '';
    position: absolute;
    top: -10px;
    right: 15px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid var(--border-separator);
    z-index: 1;
}

.document-tooltip::after {
    content: '';
    position: absolute;
    top: -8px;
    right: 17px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--tooltip-arrow);
    z-index: 2;
}

.document-tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.document-tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}

.document-tooltip-title {
    font-size: 0.85rem;
    margin: 0;
    color: var(--text-color-1);
    font-weight: bold;
    flex: 1;
}

.document-tooltip-message {
    font-size: 0.8rem;
    line-height: 1.4;
    margin-bottom: 10px;
    color: var(--lighter-text);
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding-left: 10px;
}

.doc-message-tooltip-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.document-tooltip-message i {
    width: 13px;
    height: 13px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.document-tooltip-close {
    color: red;
    font-size: 18px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color 0.3s ease;
    width: 30px;
    height: 30px;
    background: var(--bg-color-1);
    border: 1px solid var(--btns-border);
    border-radius: 10px;
    box-shadow: var(--cards-shadow);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-tooltip-close:hover {
    border-color: var(--clear-btns-border-hover);
    color: var(--orange-text);
}

.document-tooltip-close i {
    font-weight: bolder;
    font-size: 18px;
    color: red;
    transition: all 0.3s ease;
}

/* Preview Button in Tooltip */
.preview-btn {
    width: 100%;
    background: var(--orange-btn-bg);
    color: var(--orange-btn-color);
    border: none;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.preview-btn:hover {
    background: var(--blue-text-hover, #0056b3);
    transform: translateY(-1px);
}

.preview-btn i {
    font-size: 14px;
}

/* ==============================================
   RESPONSIVE STYLES FOR DOCUMENT TOOLTIPS
   ============================================== */

/* Tablet and smaller desktops (up to 768px) */
@media (max-width: 768px) {
    .document-tooltip {
        width: 260px;
        max-width: calc(100vw - 40px);
        right: 10px;
    }
}

/* Mobile view (up to 480px) */
@media (max-width: 480px) {
    .document-info-btn {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .document-info-btn i {
        font-size: 16px;
    }

    .document-tooltip {
        width: 240px;
        max-width: calc(100vw - 40px); /* 20px margin on each side */
        right: 10px; /* Consistent right margin */
        padding: 8px;
    }

    .document-tooltip-title {
        font-size: 0.8rem;
    }

    .preview-btn {
        font-size: 0.75rem;
        padding: 6px 10px;
    }
}

/* Very small mobile (up to 360px) */
@media (max-width: 360px) {
    .document-tooltip {
        width: 220px;
        max-width: calc(100vw - 32px); /* 16px margin on each side */
        right: 8px;
        padding: 8px;
    }
}

/* Very small mobile (up to 320px) */
@media (max-width: 320px) {
    .document-info-btn {
        top: 6px;
        right: 6px;
        width: 30px;
        height: 30px;
        padding: 5px;
    }

    .document-info-btn i {
        font-size: 15px;
    }

    .document-tooltip {
        width: 200px;
        max-width: calc(100vw - 32px); /* 16px margin on each side */
        right: 8px;
        padding: 8px;
    }

    .document-tooltip-title {
        font-size: 0.75rem;
    }

    .preview-btn {
        font-size: 0.7rem;
        padding: 5px 8px;
    }
}

/* Very very small mobile (up to 260px) */
@media (max-width: 260px) {
    .document-info-btn {
        top: 5px;
        right: 5px;
        width: 28px;
        height: 28px;
        padding: 4px;
    }

    .document-info-btn i {
        font-size: 14px;
    }

    .document-tooltip {
        width: 180px;
        max-width: calc(100vw - 24px); /* 12px margin on each side */
        right: 6px;
        padding: 6px;
    }

    .document-tooltip-title {
        font-size: 0.7rem;
    }

    .preview-btn {
        font-size: 0.65rem;
        padding: 4px 6px;
    }

    .document-tooltip::before {
        right: 12px;
        border-left: 8px solid transparent;
        border-right: 8px solid transparent;
        border-bottom: 8px solid var(--border-separator);
    }

    .document-tooltip::after {
        right: 14px;
        border-left: 6px solid transparent;
        border-right: 6px solid transparent;
        border-bottom: 6px solid var(--tooltip-arrow);
    }
}