/**
 * Secure Energy Analytics Portal - Help System Styles v2.1
 * Compatible with main.js v2.4+
 * 
 * CHANGES:
 * - Updated color references to use Secure Energy brand colors
 * - Improved consistency with main.css variables
 */

/* =====================================================
   HELP ICON (in widget headers)
   ===================================================== */
.help-icon {
    background: transparent;
    border: none;
    color: var(--text-tertiary, #718096);
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
    border-radius: 4px;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    vertical-align: middle;
}

.help-icon:hover {
    opacity: 1;
    color: var(--se-light-green, #3EB489);
    background: var(--bg-tertiary, rgba(255,255,255,0.1));
}

.help-icon svg {
    display: block;
}

/* =====================================================
   TOOLTIP
   ===================================================== */
.help-tooltip {
    position: fixed;
    z-index: 10000;
    width: 280px;
    background: var(--bg-secondary, #131824);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    pointer-events: none;
}

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

.help-tooltip-arrow {
    position: absolute;
    top: -6px;
    left: 20px;
    width: 12px;
    height: 12px;
    background: var(--bg-secondary, #131824);
    border-left: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
    transform: rotate(45deg);
}

.help-tooltip.above .help-tooltip-arrow {
    top: auto;
    bottom: -6px;
    transform: rotate(225deg);
}

.help-tooltip-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--se-light-green, #3EB489);
    margin-bottom: 8px;
}

.help-tooltip-desc {
    font-size: 13px;
    color: var(--text-secondary, #A0AEC0);
    line-height: 1.5;
}

.help-tooltip-tips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.tip-item {
    font-size: 12px;
    color: var(--text-tertiary, #718096);
    line-height: 1.4;
}

/* =====================================================
   KEY CONCEPTS SECTION
   ===================================================== */
.key-concepts-section {
    margin-bottom: 8px;
}

.key-concepts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-secondary, #131824);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #FFFFFF);
    transition: background 0.2s;
}

.key-concepts-header:hover {
    background: var(--bg-tertiary, #1A2030);
}

.key-concepts-toggle-icon {
    font-size: 10px;
    color: var(--text-tertiary, #718096);
    transition: transform 0.2s;
}

.key-concepts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.key-concepts-grid.collapsed {
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
}

.concept-card {
    background: var(--bg-secondary, #131824);
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.concept-card:hover {
    border-color: var(--se-light-green, #3EB489);
    transform: translateY(-2px);
}

.concept-card.expanded {
    grid-column: 1 / -1;
    background: var(--bg-tertiary, #1A2030);
    border-color: var(--se-light-green, #3EB489);
}

.concept-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.concept-icon {
    font-size: 16px;
}

.concept-title {
    font-weight: 600;
    font-size: 12px;
    color: var(--text-primary, #FFFFFF);
    flex: 1;
}

.concept-toggle {
    font-size: 10px;
    color: var(--text-tertiary, #718096);
    transition: transform 0.2s;
}

.concept-card.expanded .concept-toggle {
    transform: rotate(180deg);
}

.concept-preview {
    font-size: 11px;
    color: var(--text-tertiary, #718096);
    margin-top: 4px;
    line-height: 1.4;
}

.concept-card.expanded .concept-preview {
    display: none;
}

.concept-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.concept-card.expanded .concept-details {
    display: block;
}

.concept-definition {
    font-size: 13px;
    color: var(--text-secondary, #A0AEC0);
    line-height: 1.6;
    margin: 0 0 12px 0;
}

.concept-components {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.concept-component {
    font-size: 12px;
    color: var(--text-secondary, #A0AEC0);
    padding: 6px 10px;
    background: var(--bg-secondary, #131824);
    border-radius: 6px;
}

.concept-component strong {
    color: var(--se-light-green, #3EB489);
}

/* =====================================================
   QUICK ACTION BUTTONS BAR
   ===================================================== */
.quick-actions-bar {
    padding: 12px 14px;
    background: var(--bg-tertiary, #1A2030);
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
}

.quick-actions-divider {
    height: 1px;
    background: var(--border-color, rgba(255,255,255,0.08));
    margin: 10px 0;
}

.quick-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.quick-actions-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary, #718096);
    text-transform: uppercase;
}

.quick-actions-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-action-btn {
    background: var(--bg-secondary, #131824);
    border: 1px solid var(--border-light, rgba(255,255,255,0.15));
    color: var(--text-secondary, #A0AEC0);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--se-light-green, #3EB489);
    border-color: var(--se-light-green, #3EB489);
    color: #000;
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: translateY(0);
}

/* =====================================================
   AI HELP GRID (inside chat responses)
   ===================================================== */
.ai-help-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.ai-help-item {
    background: var(--bg-tertiary, #1A2030);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-align: center;
}

.ai-help-item:hover {
    background: var(--bg-secondary, #131824);
    border-color: var(--se-light-green, #3EB489);
    transform: translateY(-2px);
}

/* =====================================================
   GUIDED TOUR
   ===================================================== */
.tour-highlight {
    position: relative;
    z-index: 100;
    box-shadow: 0 0 0 4px var(--se-light-green, #3EB489), 
                0 0 40px rgba(62, 180, 137, 0.3) !important;
    border-radius: 12px;
}

.tour-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary, #0A0E1A);
    border: 2px solid var(--se-light-green, #3EB489);
    border-radius: 12px;
    padding: 20px;
    width: 320px;
    max-width: 90%;
    z-index: 101;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.tour-popup-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--se-light-green, #3EB489);
    margin-bottom: 10px;
}

.tour-popup-msg {
    font-size: 14px;
    color: var(--text-secondary, #A0AEC0);
    line-height: 1.5;
    margin-bottom: 16px;
}

.tour-popup-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-tertiary, #718096);
}

.tour-next-btn {
    background: var(--se-light-green, #3EB489);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tour-next-btn:hover {
    background: var(--se-dark-green, #004D40);
    color: white;
    transform: translateY(-1px);
}

/* =====================================================
   AI MESSAGE ENHANCEMENTS
   ===================================================== */
.ai-message-content a {
    color: var(--se-light-green, #3EB489);
    text-decoration: none;
}

.ai-message-content a:hover {
    text-decoration: underline;
}

.ai-message-content strong {
    color: var(--text-primary, #FFFFFF);
}

.ai-message-content em {
    color: var(--text-tertiary, #718096);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 768px) {
    .help-tooltip {
        width: 260px;
        left: 10px !important;
        right: 10px !important;
    }
    
    .ai-help-grid {
        grid-template-columns: 1fr;
    }
    
    .tour-popup {
        width: 280px;
    }
    
    .quick-actions-buttons {
        justify-content: center;
    }
}
