/**
 * Help System Styles
 * Modal, table of contents, and content area styling
 */

/* Help Modal Overlay */
#help-modal {
    display: none;
    position: fixed;
    top: 0;
    /* Position relative to sidebar (default open width 335px) */
    left: 335px;
    width: calc(100% - 335px);
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    /* Match sidebar transition speed */
    transition: all 0.5s ease;
}

/* When modal is displayed, use flexbox to center content */
#help-modal[style*="display: block"],
#help-modal[style*="display: flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Adjust position when sidebar is closed */
body.sidebar-closed #help-modal {
    left: 60px;
    width: calc(100% - 60px);
}

#help-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Help Modal Content - 3/4 page size */
#help-modal-content {
    position: relative;
    width: 75vw;
    height: 75vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    max-width: 1400px;
}

/* Help Modal Header */
.help-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 2px solid #e8b500;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px 12px 0 0;
}

.help-modal-header h2 {
    margin: 0;
    color: #35486e;
    font-size: 1.8em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.help-modal-header h2 i {
    font-size: 1.3em;
    color: #e8b500;
}

#help-modal-close {
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
}

#help-modal-close:hover {
    color: #35486e;
    transform: scale(1.1);
}

/* Help Modal Body */
.help-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Table of Contents Sidebar */
.help-toc-sidebar {
    width: 280px;
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    border-right: 2px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-toc-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.help-toc-header h3 {
    margin: 0 0 15px 0;
    color: #35486e;
    font-size: 1.1em;
    font-weight: 600;
}

#help-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

#help-search-input:focus {
    outline: none;
    border-color: #e8b500;
}

.help-toc-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.help-toc-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #495057;
    font-size: 0.95em;
}

.help-toc-item i {
    font-size: 1.2em;
    color: #6c757d;
    transition: color 0.2s;
}

.help-toc-item:hover {
    background: rgba(232, 181, 0, 0.1);
    color: #35486e;
}

.help-toc-item:hover i {
    color: #e8b500;
}

.help-toc-item.active {
    background: linear-gradient(90deg, #e8b500 0%, #ffc107 100%);
    color: #35486e;
    font-weight: 600;
    border-left: 4px solid #35486e;
}

.help-toc-item.active i {
    color: #35486e;
}

/* Content Area */
.help-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
}

/* Loading State */
.help-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-size: 1.2em;
}

.help-loading i {
    font-size: 3em;
    margin-bottom: 15px;
    color: #e8b500;
}

/* Error State */
.help-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #dc3545;
    padding: 40px;
    text-align: center;
}

.help-error i {
    font-size: 4em;
    margin-bottom: 20px;
}

.help-error p {
    font-size: 1.1em;
    margin: 0;
}

/* Guide Header */
.help-guide-header {
    padding: 30px;
    border-bottom: 2px solid #e8b500;
    background: linear-gradient(135deg, #fffbea 0%, #ffffff 100%);
}

.help-guide-header h2 {
    margin: 0 0 10px 0;
    color: #35486e;
    font-size: 1.8em;
    font-weight: 700;
}

.help-guide-version {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0 0 10px 0;
    font-style: italic;
}

.help-guide-description {
    color: #495057;
    font-size: 1em;
    margin: 10px 0 0 0;
    line-height: 1.6;
}

/* PDF Container */
.help-pdf-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    padding: 20px;
    background: #f8f9fa;
}

.help-pdf-viewer {
    width: 100%;
    height: 100%;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
}

/* No Content State */
.help-no-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #6c757d;
    padding: 60px 40px;
    text-align: center;
}

.help-no-content i {
    font-size: 5em;
    margin-bottom: 20px;
    color: #dee2e6;
}

.help-no-content p {
    font-size: 1.1em;
    margin: 10px 0;
}

.help-note {
    font-size: 0.9em !important;
    color: #adb5bd !important;
    font-style: italic;
}

/* Guide Footer */
.help-guide-footer {
    padding: 20px 30px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
}

.help-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.help-download-btn:hover {
    background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.help-download-btn i {
    font-size: 1.2em;
}

/* Body Class When Modal is Open */
body.help-modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 1200px) {
    #help-modal-content {
        width: 90vw;
        height: 85vh;
    }
    
    .help-toc-sidebar {
        width: 240px;
    }
}

@media (max-width: 768px) {
    #help-modal-content {
        width: 95vw;
        height: 90vh;
    }
    
    .help-toc-sidebar {
        width: 200px;
    }
    
    .help-modal-header h2 {
        font-size: 1.4em;
    }
    
    .help-guide-header h2 {
        font-size: 1.4em;
    }
}

/* Custom Scrollbar for TOC */
.help-toc-list::-webkit-scrollbar {
    width: 8px;
}

.help-toc-list::-webkit-scrollbar-track {
    background: #e9ecef;
}

.help-toc-list::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.help-toc-list::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}
