/**
 * Help System Styles
 * Styling for contextual help icons, tooltips, and offcanvas panel
 * Compatible with Bootstrap 4
 */

/* Help Icon */
.help-icon-wrapper {
    display: inline-block;
    margin-left: 0rem;
    vertical-align: super;
}

.help-icon {
    color: #269ed9;
    cursor: help;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.help-icon:hover {
    color: #215092;
    transform: scale(1.2);
}

.help-icon-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4em;
    height: 1.4em;
    padding: 0 0.2em;
    background-color: #269ed9;
    color: white;
    border-radius: 1em;
    /* Pill shape */
    font-size: 0.75em;
    font-weight: bold;
    cursor: help;
    transition: all 0.2s ease;
    line-height: 1;
    vertical-align: middle;
}

.help-icon-number:hover {
    background-color: #215092;
    transform: scale(1.2);
    color: white;
}

/* Help Tooltip */
.help-tooltip {
    position: fixed;
    background: white;
    border: 2px solid #269ed9;
    border-radius: 8px;
    padding: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    max-width: 350px;
    min-width: 250px;
}

.help-tooltip-content {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    color: #333;
}

.help-tooltip-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.5rem;
}

.help-action-icon {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
    color: #269ed9;
    font-size: 1.1rem;
}

.help-action-icon:hover {
    background: #f0f8ff;
    color: #215092;
    transform: scale(1.1);
}

/* Offcanvas Panel (Custom implementation for BS4) */
.help-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 500px;
    max-width: 90vw;
    background: white;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    /* Hidden by default */
    transition: transform 0.3s ease-in-out;
    z-index: 1050;
    /* Above modals and navbar */
    display: flex;
    flex-direction: column;
}

.help-offcanvas.show {
    transform: translateX(0);
}

.help-offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(10deg, rgb(33, 80, 146), #269ed9);
    color: white;
}

.help-offcanvas-title {
    margin-bottom: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.help-offcanvas-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    padding: 0;
}

.help-offcanvas-close:hover {
    opacity: 1;
    color: white;
}

.help-offcanvas-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
}

/* Help Content Container */
#help-content-container {
    padding: 0.5rem;
}

/* Help Sections */
.help-section {
    padding: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section-title {
    color: #215092;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-section-title i {
    color: #269ed9;
}

.help-section-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
}

.help-section-content code {
    background: #f5f5f5;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Highlight animation */
.help-highlight {
    background-color: #fff3cd;
    transition: background-color 0.5s ease;
}

/* Media Tabs (BS4 compatible) */
.help-media-tabs {
    margin-top: 1rem;
}

.help-media-tabs .nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.help-media-tabs .nav-link {
    color: #6c757d;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 1rem;
}

.help-media-tabs .nav-link:hover {
    color: #269ed9;
    border-bottom-color: #269ed9;
}

.help-media-tabs .nav-link.active {
    color: #215092;
    border-bottom-color: #215092;
    background: transparent;
    font-weight: 600;
}

.help-media-content {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.help-media-content img,
.help-media-content video {
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
}

/* Loading/Empty States */
.help-loading,
.help-empty {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

/* Print Styles */
@media print {

    .help-icon-wrapper,
    .help-tooltip,
    .help-offcanvas {
        display: none !important;
    }
}

/* Visibility Toggle */
body.help-icons-hidden .help-icon-wrapper {
    display: none !important;
}

.help-toggle-btn {
    transition: transform 0.2s;
    color: inherit !important;
    opacity: 1;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
}

.help-toggle-btn:hover {
    transform: scale(1.1);
    opacity: 0.7
}

/* State when icons are hidden */
body.help-icons-hidden .help-toggle-btn i {
    opacity: 1;
}

/* Strikethrough effect optional */


/* Update Toggle Button Colors requested by user */
.help-toggle-btn {
    color: #6fd466 !important;
    /* Inactive = Blue */
    opacity: 1 !important;
}

.help-toggle-btn.active {
    color: #ffffff !important;
    /* Active = White */

}

.help-toggle-btn.disabled-state {
    opacity: 1 !important;
    filter: none !important;
    color: #269ed9 !important;
}

/* Offcanvas Toggle Button requested by user */
.help-offcanvas-btn {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #dee2e6;
    color: #285ea9;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    padding: 0;
}

.help-offcanvas-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    color: #1a4b8c;
}

/* Draggable / Detached Mode */
.help-offcanvas.draggable {
    right: auto !important;
    bottom: auto !important;
    height: 70vh !important;
    /* Default height when detached */
    min-height: 300px;
    max-height: 90vh;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);

    /* Override transform transition for sliding */
    transform: none !important;
    transition: width 0.3s, height 0.3s, opacity 0.3s !important;

    /* Hidden state for draggable */
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.help-offcanvas.draggable.show {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.help-offcanvas.draggable .help-offcanvas-header {
    cursor: move;
    /* Fallback */
    cursor: grab;
}

.help-offcanvas.draggable .help-offcanvas-header:active {
    cursor: grabbing;
}