/**
 * Help Center Component Styling
 */

.help-panel {
    position: fixed;
    top: 60px;
    left: -800px;
    width: 780px;
    max-width: 90vw;
    height: calc(100vh - 120px);
    background-color: var(--bg-primary);
    box-shadow: 3px 0 20px rgba(0, 0, 0, 0.15);
    border-radius: 0 12px 12px 0;
    transition: left 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.help-panel.active {
    left: 0;
}

.help-header {
    background-color: var(--accent-primary);
    color: var(--header-text);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.close-help-btn {
    background: transparent;
    border: none;
    color: var(--header-text);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-help-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.help-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.help-sidebar {
    width: 220px;
    background-color: var(--bg-secondary);
    padding: 18px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
}

.help-sidebar h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: var(--accent-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.topic-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.topic-list li {
    padding: 12px 14px;
    margin-bottom: 6px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.topic-list li:hover {
    background-color: var(--bg-tertiary);
    transform: translateX(2px);
}

.topic-list li.active {
    background-color: var(--accent-primary);
    color: white;
}

.help-main {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

#help-topic-content h3 {
    margin-top: 0;
    color: var(--color-header);
    margin-bottom: 20px;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h4 {
    color: #333;
    margin-bottom: 15px;
}

.help-section p {
    line-height: 1.6;
    margin-bottom: 15px;
}

.state-detail, 
.problem-detail, 
.scheduling-detail, 
.sync-detail {
    background-color: #f9f9f9;
    border-left: 4px solid var(--color-header);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 0 4px 4px 0;
}

.state-detail h5, 
.problem-detail h5, 
.scheduling-detail h5,
.sync-detail h5 {
    margin-top: 0;
    color: var(--color-header);
    margin-bottom: 10px;
}

.algorithm-detail {
    margin-bottom: 20px;
    padding-left: 15px;
    border-left: 3px solid #ddd;
}

.algorithm-detail h6 {
    margin-top: 10px;
    margin-bottom: 8px;
    color: #444;
}

.algorithm-pros-cons {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.algorithm-pros-cons > div {
    flex: 1;
}

.algorithm-pros-cons h6 {
    margin-top: 0;
    margin-bottom: 5px;
}

.algorithm-pros-cons ul {
    padding-left: 20px;
    margin-top: 5px;
    margin-bottom: 10px;
}

code {
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

.code-example {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #4caf50;
    font-family: monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre;
    margin: 15px 0;
}

.code-example-container {
    background-color: #f0f0f0;
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
}

.code-example-container h6 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.code-example-container p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Toggle button styling */
.floating-btn.help-btn {
    right: 80px; /* Position it to the left of the tutorial button */
    background-color: #ff9800;
}

.floating-btn.help-btn:hover {
    background-color: #f57c00;
}

/* Mobile optimization */
@media (max-width: 800px) {
    .help-panel {
        top: 60px;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 120px);
        left: -100%;
        border-radius: 0;
    }
    
    .help-content {
        flex-direction: column;
    }
    
    .help-sidebar {
        width: 100%;
        max-height: 120px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .topic-list {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .topic-list li {
        flex: 1;
        min-width: 120px;
        text-align: center;
        margin-bottom: 0;
    }
    
    .algorithm-pros-cons {
        flex-direction: column;
        gap: 10px;
    }
    
    .floating-btn.help-btn {
        right: 70px;
        bottom: 70px;
    }
}

@media (max-width: 480px) {
    .help-sidebar {
        max-height: 160px;
    }
    
    .topic-list li {
        flex-basis: 100%;
    }
    
    .floating-btn.help-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        right: 60px;
        bottom: 10px;
    }
}