/**
 * Global Help System Styles
 * Works alongside form.php styles and can be used on any page
 */

/* Help Icon Styling */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    min-width: 18px;
    background: #1ba39c;
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
    margin-left: 6px;
    vertical-align: middle;
}

.help-icon:hover {
    background: #2d8b83;
    box-shadow: 0 2px 8px rgba(27, 163, 156, 0.4);
    transform: scale(1.1);
}

.help-icon-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Tooltip Container */
.tooltip {
    position: relative;
    display: inline-block;
}

/* Tooltip Text */
.tooltip .tooltiptext {
    visibility: hidden;
    width: 280px;
    background-color: #1ba39c;
    color: white;
    text-align: left;
    border-radius: 6px;
    padding: 12px 15px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -140px;
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    word-wrap: break-word;
    white-space: normal;
}

/* Tooltip Arrow */
.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1ba39c transparent transparent transparent;
}

/* Show tooltip on hover */
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Focus state for accessibility */
.tooltip:focus-within .tooltiptext {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

/* Mobile/Tablet adjustments */
@media (max-width: 768px) {
    .tooltip .tooltiptext {
        width: 200px;
        margin-left: -100px;
        font-size: 12px;
        bottom: auto;
        top: 125%;
    }
    
    .tooltip .tooltiptext::after {
        border-color: transparent transparent #1ba39c transparent;
        top: auto;
        bottom: 100%;
        margin-top: -5px;
        margin-left: -5px;
    }
}

/* Help Panel Sidebar */
.help-panel {
    position: fixed;
    right: -450px;
    top: 0;
    width: 450px;
    height: 100vh;
    background: white;
    border-left: 4px solid #1ba39c;
    box-shadow: -6px 0 16px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    z-index: 999;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
}

.help-panel.open {
    right: 0;
}

.help-panel-header {
    background: linear-gradient(135deg, #1ba39c 0%, #2d8b83 100%);
    color: white;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.help-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.help-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0.9;
}

.help-close-btn:hover {
    transform: rotate(90deg);
    opacity: 1;
}

.help-search {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    background: #f9f9f9;
}

.help-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    box-sizing: border-box;
}

.help-search input:focus {
    outline: none;
    border-color: #1ba39c;
    box-shadow: 0 0 0 3px rgba(27, 163, 156, 0.1);
}

.help-content {
    padding: 20px;
}

.help-item {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.help-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-item-title {
    font-weight: 700;
    color: #1ba39c;
    margin-bottom: 10px;
    font-size: 14px;
    text-transform: capitalize;
}

.help-item-text {
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

.help-item-section {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Help Toggle Button */
.help-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #1ba39c 0%, #2d8b83 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(27, 163, 156, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.help-toggle-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 24px rgba(27, 163, 156, 0.4);
}

.help-toggle-btn:active {
    transform: scale(0.98);
}

/* No results message */
.help-no-results {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .help-panel {
        width: 100%;
        right: -100%;
    }
    
    .help-toggle-btn {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .help-icon {
        width: 16px;
        height: 16px;
        font-size: 10px;
        margin-left: 4px;
    }
    
    .tooltip .tooltiptext {
        width: 100%;
        max-width: 220px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Print styles - hide help elements */
@media print {
    .help-icon,
    .help-toggle-btn,
    .help-panel {
        display: none !important;
    }
}

/* Animation */
@keyframes helpSlideIn {
    from {
        right: -450px;
        opacity: 0;
    }
    to {
        right: 0;
        opacity: 1;
    }
}

.help-panel.open {
    animation: helpSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
