/**
 * Contextual Help System Styles
 *
 * Provides inline help tooltips, popovers, and info cards styling.
 *
 * Version: 1.0
 * Date: February 9, 2026
 */

/* Tooltips */
.contextual-help-tooltip {
    position: fixed;
    background: #343a40;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    max-width: 250px;
    z-index: 9999;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.15);
    pointer-events: none;
    transform: translateX(-50%);
    transition: opacity 0.2s ease;
}

.contextual-help-tooltip::after {
    content: '';
    position: absolute;
    border: 6px solid transparent;
}

.contextual-help-tooltip.placement-top::after {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #343a40;
}

.contextual-help-tooltip.placement-bottom::after {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: #343a40;
}

.contextual-help-tooltip.placement-left::after {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #343a40;
}

.contextual-help-tooltip.placement-right::after {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: #343a40;
}

/* Popovers */
.contextual-help-popover {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    max-width: 400px;
    z-index: 9998;
    display: none;
}

.popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 0.5rem 0.5rem 0 0;
}

.popover-header h6 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #212529;
}

.popover-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.popover-close:hover {
    color: #212529;
}

.popover-body {
    padding: 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
}

.popover-body p:last-child {
    margin-bottom: 0;
}

/* Info Cards */
.info-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    background: #f8f9fa;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.info-card-header i {
    font-size: 1.25rem;
    color: #0d6efd;
}

.info-card-header h6 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #212529;
}

.info-card-body {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #495057;
}

.info-card-steps {
    margin: 0;
    padding-left: 1.5rem;
}

.info-card-steps li {
    margin-bottom: 0.5rem;
}

.info-card-steps li:last-child {
    margin-bottom: 0;
}

/* "What Happens Next" Card Variant */
.info-card.what-happens-next {
    background: #e7f3ff;
    border-color: #b3d9ff;
}

.info-card.what-happens-next .info-card-header i {
    color: #0d6efd;
}

/* Info Card Type Variants */
.info-card.info-card-info {
    background: #e7f3ff;
    border-color: #b3d9ff;
}

.info-card.info-card-info .info-card-header i {
    color: #0d6efd;
}

.info-card.info-card-warning {
    background: #fff3cd;
    border-color: #ffd680;
}

.info-card.info-card-warning .info-card-header i {
    color: #ffc107;
}

.info-card.info-card-success {
    background: #d4edda;
    border-color: #a3d9b1;
}

.info-card.info-card-success .info-card-header i {
    color: #28a745;
}

.info-card.info-card-help {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.info-card.info-card-help .info-card-header i {
    color: #6c757d;
}

/* Field Examples */
.field-example {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: #6c757d;
    font-style: italic;
}

.field-example i {
    color: #ffc107;
    margin-right: 0.25rem;
}

/* Help Icons */
.help-icon {
    color: #6c757d;
    cursor: help;
    font-size: 0.875rem;
    margin-left: 0.375rem;
    transition: color 0.2s ease;
}

.help-icon:hover {
    color: #0d6efd;
}

/* Terminology Definitions */
.term-definition {
    border-bottom: 1px dotted #6c757d;
    cursor: help;
    text-decoration: none;
}

.term-definition:hover {
    border-bottom-color: #0d6efd;
    color: #0d6efd;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .contextual-help-tooltip {
        max-width: 200px;
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }

    .contextual-help-popover {
        max-width: calc(100vw - 2rem);
        left: 1rem !important;
        right: 1rem;
    }

    .popover-header {
        padding: 0.5rem 0.75rem;
    }

    .popover-body {
        padding: 0.75rem;
        font-size: 0.8125rem;
    }

    .info-card {
        padding: 0.75rem;
    }

    .info-card-header i {
        font-size: 1rem;
    }

    .info-card-header h6 {
        font-size: 0.875rem;
    }

    .info-card-body {
        font-size: 0.8125rem;
    }
}

/* Touch Support */
@media (hover: none) and (pointer: coarse) {
    .help-icon {
        padding: 0.25rem;
        margin: -0.25rem 0 -0.25rem 0.375rem;
    }

    .term-definition {
        padding: 0.125rem 0;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .contextual-help-tooltip {
        background: #f8f9fa;
        color: #212529;
    }

    .contextual-help-tooltip.placement-top::after {
        border-top-color: #f8f9fa;
    }

    .contextual-help-tooltip.placement-bottom::after {
        border-bottom-color: #f8f9fa;
    }

    .contextual-help-tooltip.placement-left::after {
        border-left-color: #f8f9fa;
    }

    .contextual-help-tooltip.placement-right::after {
        border-right-color: #f8f9fa;
    }

    .contextual-help-popover {
        background: #343a40;
        border-color: #495057;
    }

    .popover-header {
        background: #495057;
        border-bottom-color: #6c757d;
    }

    .popover-header h6 {
        color: #f8f9fa;
    }

    .popover-close {
        color: #adb5bd;
    }

    .popover-close:hover {
        color: #f8f9fa;
    }

    .popover-body {
        color: #dee2e6;
    }

    .info-card {
        background: #343a40;
        border-color: #495057;
    }

    .info-card-header h6 {
        color: #f8f9fa;
    }

    .info-card-body {
        color: #dee2e6;
    }
}

/* Print Styles */
@media print {
    .contextual-help-tooltip,
    .contextual-help-popover {
        display: none !important;
    }

    .help-icon {
        display: none;
    }

    .term-definition {
        border-bottom: none;
    }

    .info-card {
        page-break-inside: avoid;
        border: 1px solid #000;
    }
}

/* Accessibility Enhancements */
.help-icon:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.term-definition:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .contextual-help-tooltip {
        border: 2px solid white;
    }

    .contextual-help-popover {
        border: 2px solid currentColor;
    }

    .info-card {
        border: 2px solid currentColor;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .contextual-help-tooltip,
    .popover-close {
        transition: none;
    }
}
