/* SAP Contextual Tooltip Styles */

.sap-tooltip {
    position: fixed;
    z-index: 200000;
    max-width: 380px;
    max-height: calc(100vh - 40px);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(5px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
}

.sap-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.sap-tooltip-content {
    background: white;
    border-radius: 8px;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: inherit;
}

/* Arrow */
.sap-tooltip-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.sap-tooltip[data-position="bottom"] .sap-tooltip-arrow {
    top: -6px;
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05);
}

.sap-tooltip[data-position="top"] .sap-tooltip-arrow {
    bottom: -6px;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
}

/* Header */
.sap-tooltip-header {
    background: linear-gradient(135deg, #354a5f, #2a3a4f);
    color: white;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sap-tooltip-icon {
    font-size: 20px;
    line-height: 1;
}

.sap-tooltip-title {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Body */
.sap-tooltip-body {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.6;
    color: #333;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Scrollbar styling */
.sap-tooltip-body::-webkit-scrollbar {
    width: 6px;
}

.sap-tooltip-body::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.sap-tooltip-body::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 3px;
}

.sap-tooltip-body::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Scroll indicator - shows when content is scrollable */
.sap-tooltip-body.has-scroll::after {
    content: '↓ mehr';
    position: sticky;
    bottom: 0;
    display: block;
    text-align: center;
    padding: 4px 0;
    margin: 0 -14px -12px -14px;
    background: linear-gradient(transparent, white 30%);
    color: #666;
    font-size: 10px;
    pointer-events: none;
}

.sap-tooltip-body strong {
    color: #354a5f;
    font-weight: 600;
}

.sap-tooltip-body code {
    background: #f0f4f8;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 11px;
    color: #c0392b;
    white-space: nowrap;
}

.sap-tooltip-body br {
    display: block;
    margin-bottom: 4px;
}

/* Hint section */
.sap-tooltip-hint {
    padding: 10px 14px;
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
    border-top: 1px solid #f0e6c8;
    font-size: 11px;
    line-height: 1.5;
    color: #856404;
}

.sap-tooltip-hint:empty {
    display: none;
}

/* Indicator on elements with help */
[data-sap-help] {
    position: relative;
}

/* Subtle indicator that help is available */
[data-sap-help]::after {
    content: '';
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background: #f0ab00;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

[data-sap-help]:hover::after {
    opacity: 0.8;
}

/* Don't show indicator on inputs - too intrusive */
input[data-sap-help]::after,
button[data-sap-help]::after {
    display: none;
}

/* Special styling for input labels with help */
label[data-sap-help] {
    cursor: help;
    border-bottom: 1px dotted #999;
}

label[data-sap-help]:hover {
    border-bottom-color: #354a5f;
}

/* Animation for new users - pulsing hint */
@keyframes helpPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 1;
    }
}

.help-pulse[data-sap-help]::after {
    opacity: 1;
    animation: helpPulse 2s ease-in-out infinite;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .sap-tooltip {
        max-width: calc(100vw - 20px);
        left: 10px !important;
        right: 10px !important;
    }

    .sap-tooltip-body {
        font-size: 13px;
    }
}
