.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999; /* Base z-index for modal overlay */
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.help-modal.active {
    opacity: 1;
}

.help-modal .modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateY(-20px);
    transition: transform 0.3s ease-in-out;
    overflow: auto;
    z-index: 100000; /* Higher z-index than overlay */
}
#help-content-container {
    padding: 20px;
    background: #ffffff;
}

.help-modal.active .modal-content {
    transform: translateY(0);
}

.help-modal .modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: right;
    background: #ffffff;
}

/* Just enhance the close button styling */
.help-modal .close-modal {
    background: #f8f9fa;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 16px;
    color: #4a5568;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 8px;
}

.help-modal .close-modal:hover {
    background: #e2e8f0;
    color: #1a202c;
    transform: scale(1.05);
}

.help-modal.active .modal-content {
    transform: translateY(0);
}

.help-modal .modal-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: right;
}

.help-modal .close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    color: #666;
}

.help-modal .close-modal:hover {
    color: #333;
}

#help-content-container {
    padding: 20px;
}

.error {
    color: #dc3545;
    padding: 10px;
    background: #f8d7da;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .help-modal .modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

/* Help icon styles */
.help-icon {
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 4px;
    margin-left: 8px;
    transition: color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.help-icon:hover {
    color: #0056b3;
}

/* Navigation Styles */
.help-nav {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    overflow-x: auto;
}

.nav-button {
    padding: 8px 16px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s ease;
    color: #64748b;
}

.nav-button:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.nav-button.active {
    background: #3b82f6;
    color: white;
}

.nav-button i {
    margin-right: 8px;
}

/* Content Sections */
.help-content {
    padding: 24px;
    overflow-y: auto;
}

.content-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

/* Welcome Box Styles */
.welcome-box {
    background: linear-gradient(to right, #e0f2fe, #e0e7ff);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.quick-start {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

/* Table Guide Styles */
.table-guide {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.guide-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: transform 0.2s ease;
}

.guide-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.guide-item i {
    font-size: 24px;
    color: #3b82f6;
}

.example {
    background: #f8fafc;
    padding: 8px;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 0.9em;
    color: #64748b;
}

/* Actions Guide Styles */
.actions-guide {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.action-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
}

.action-header {
    background: #f8fafc;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.action-header i {
    font-size: 24px;
    color: #3b82f6;
}

.action-steps {
    padding: 16px;
}

.action-steps ol {
    margin-left: 20px;
}

.action-steps ul {
    margin-left: 40px;
    margin-top: 8px;
}

/* FAQ Styles */
.faq-section {
    display: grid;
    gap: 16px;
}

.faq-item {
    background: #f8fafc;
    padding: 16px;
    border-radius: 8px;
}

.support-box {
    background: linear-gradient(to right, #e0f2fe, #e0e7ff);
    padding: 24px;
    border-radius: 12px;
    margin-top: 24px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .help-nav {
        padding: 12px;
    }

    .nav-button {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .help-content {
        padding: 16px;
    }

    .table-guide,
    .actions-guide {
        grid-template-columns: 1fr;
    }

    .guide-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Accessibility Improvements */
.nav-button:focus,
.action-card:focus-within {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .help-modal {
        position: relative;
        background: white;
    }

    .modal-content {
        box-shadow: none;
    }

    .help-nav {
        display: none;
    }

    .content-section {
        display: block !important;
        page-break-after: always;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .help-modal {
        background: rgba(0, 0, 0, 0.7);
    }

    .modal-content {
        background: #1a1a1a;
        color: #e5e5e5;
    }

    .help-nav {
        background: #262626;
        border-bottom-color: #404040;
    }

    .nav-button {
        color: #a3a3a3;
    }

    .nav-button:hover {
        background: #404040;
        color: #ffffff;
    }

    .nav-button.active {
        background: #2563eb;
        color: white;
    }

    .welcome-box {
        background: linear-gradient(to right, #1e3a8a, #312e81);
    }

    .quick-start {
        background: #262626;
    }

    .guide-item {
        border-color: #404040;
        background: #262626;
    }

    .guide-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    .example {
        background: #333333;
        color: #a3a3a3;
    }

    .action-card {
        border-color: #404040;
        background: #262626;
    }

    .action-header {
        background: #333333;
    }

    .faq-item {
        background: #333333;
    }

    .support-box {
        background: linear-gradient(to right, #1e3a8a, #312e81);
    }
}

/* Fullscreen mode styles */
.help-modal.fullscreen {
    z-index: 999999; /* Higher z-index when fullscreen */
}

.help-modal.fullscreen .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
}

/* Fullscreen toggle button styles */
.fullscreen-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px 10px;
    color: #666;
    margin-right: 10px;
    transition: color 0.2s ease;
}

.fullscreen-toggle:hover {
    color: #333;
}

/* Modal header layout for multiple controls */
.help-modal .modal-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}