/*
 * Aligntra Contextual Help Tooltips
 * Provides inline help and guidance throughout the application
 */

/* ========================================================================
   BASE TOOLTIP STYLES
   ======================================================================== */

/* Simple hover tooltips using data-tooltip attribute */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before,
[data-tooltip]::after {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 9999;
}

/* Tooltip bubble */
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--gray-900);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    max-width: 280px;
    min-width: 120px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tooltip arrow */
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--gray-900);
}

/* Show on hover */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

[data-tooltip]:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* ========================================================================
   TOOLTIP POSITIONS
   ======================================================================== */

/* Bottom position */
[data-tooltip-position="bottom"]::after {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
}

[data-tooltip-position="bottom"]::before {
    bottom: auto;
    top: calc(100% + 2px);
    border: 6px solid transparent;
    border-bottom-color: var(--gray-900);
    border-top-color: transparent;
}

[data-tooltip-position="bottom"]:hover::after {
    transform: translateX(-50%) translateY(0);
}

/* Left position */
[data-tooltip-position="left"]::after {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 8px);
    transform: translateY(-50%) translateX(4px);
}

[data-tooltip-position="left"]::before {
    bottom: auto;
    top: 50%;
    left: auto;
    right: calc(100% + 2px);
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: var(--gray-900);
    border-top-color: transparent;
}

[data-tooltip-position="left"]:hover::after {
    transform: translateY(-50%) translateX(0);
}

/* Right position */
[data-tooltip-position="right"]::after {
    bottom: auto;
    top: 50%;
    left: calc(100% + 8px);
    transform: translateY(-50%) translateX(-4px);
}

[data-tooltip-position="right"]::before {
    bottom: auto;
    top: 50%;
    left: calc(100% + 2px);
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: var(--gray-900);
    border-top-color: transparent;
}

[data-tooltip-position="right"]:hover::after {
    transform: translateY(-50%) translateX(0);
}

/* ========================================================================
   TOOLTIP THEMES
   ======================================================================== */

/* Info tooltip (blue) */
[data-tooltip-theme="info"]::after {
    background: var(--primary-600);
}

[data-tooltip-theme="info"]::before {
    border-top-color: var(--primary-600);
}

[data-tooltip-theme="info"][data-tooltip-position="bottom"]::before {
    border-bottom-color: var(--primary-600);
    border-top-color: transparent;
}

/* Success tooltip (green) */
[data-tooltip-theme="success"]::after {
    background: var(--success-dark, #166534);
}

[data-tooltip-theme="success"]::before {
    border-top-color: var(--success-dark, #166534);
}

/* Warning tooltip (orange) */
[data-tooltip-theme="warning"]::after {
    background: var(--warning-dark, #b45309);
}

[data-tooltip-theme="warning"]::before {
    border-top-color: var(--warning-dark, #b45309);
}

/* Error tooltip (red) */
[data-tooltip-theme="error"]::after {
    background: var(--error-dark, #991b1b);
}

[data-tooltip-theme="error"]::before {
    border-top-color: var(--error-dark, #991b1b);
}

/* ========================================================================
   HELP ICON COMPONENT
   ======================================================================== */

.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-600);
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    margin-left: 6px;
    transition: all 0.15s;
    vertical-align: middle;
}

.help-icon:hover {
    background: var(--primary-100);
    color: var(--primary-700);
}

.help-icon::after {
    content: '?';
}

/* Larger help icon */
.help-icon.help-icon-lg {
    width: 20px;
    height: 20px;
    font-size: 12px;
}

/* ========================================================================
   INLINE HELP CALLOUTS
   ======================================================================== */

.help-callout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin: 12px 0;
}

.help-callout-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.help-callout-content {
    flex: 1;
}

.help-callout-title {
    font-weight: 600;
    margin-bottom: 4px;
}

/* Info callout */
.help-callout.help-callout-info {
    background: var(--primary-50);
    border-left: 3px solid var(--primary-500);
    color: var(--primary-800);
}

/* Tip callout */
.help-callout.help-callout-tip {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    color: #166534;
}

/* Warning callout */
.help-callout.help-callout-warning {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    color: #92400e;
}

/* ========================================================================
   FORM FIELD HELP TEXT
   ======================================================================== */

.form-help {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 6px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.form-help-icon {
    flex-shrink: 0;
    color: var(--gray-400);
}

/* ========================================================================
   CONTEXTUAL HELP PANEL
   ======================================================================== */

.context-help-panel {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
}

.context-help-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.context-help-header-icon {
    color: var(--primary-600);
}

.context-help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.context-help-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    color: var(--gray-700);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.context-help-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.context-help-list li::before {
    content: '•';
    color: var(--primary-500);
    font-weight: bold;
}

/* ========================================================================
   STEP TOOLTIPS
   ======================================================================== */

.step-tooltip {
    position: relative;
}

.step-tooltip-content {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 16px;
    min-width: 200px;
    max-width: 280px;
    box-shadow: var(--shadow-lg);
    visibility: hidden;
    opacity: 0;
    transition: all 0.2s;
    z-index: 100;
}

.step-tooltip:hover .step-tooltip-content {
    visibility: visible;
    opacity: 1;
}

.step-tooltip-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.step-tooltip-desc {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.5;
}

/* ========================================================================
   UPLOAD AREA HELP
   ======================================================================== */

.upload-help {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--gray-200);
}

.upload-help-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 4px 8px;
    border-radius: 4px;
}

.upload-help-item-icon {
    font-size: 12px;
}

/* ========================================================================
   STATUS BADGE TOOLTIPS
   ======================================================================== */

.status-badge[data-tooltip] {
    cursor: help;
}

.status-badge[data-tooltip]::after {
    min-width: 180px;
}

/* ========================================================================
   RESPONSIVE ADJUSTMENTS
   ======================================================================== */

@media (max-width: 768px) {
    [data-tooltip]::after {
        max-width: 200px;
        font-size: 11px;
    }

    .help-callout {
        padding: 10px 12px;
        font-size: 12px;
    }

    /* Force tooltips to top on mobile */
    [data-tooltip-position="left"]::after,
    [data-tooltip-position="right"]::after {
        left: 50%;
        right: auto;
        top: auto;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
    }
}
