/* ========================================
   Help Drawer - Best Practices & Tips
   MasterPrompt v1.3.0
   ======================================== */

/* Info Button */
.info-button-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.btn-info {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-info:hover {
    background: var(--bg-hover);
    color: var(--color-orange);
}

.btn-info:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--color-orange-light);
}

.btn-info svg {
    width: 18px;
    height: 18px;
}

/* Tooltip */
.info-button-wrapper .tooltip {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--bg-dark);
    color: white;
    font-size: 0.7rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 100;
}

.info-button-wrapper:hover .tooltip {
    opacity: 1;
}

/* Drawer Backdrop */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 499;
}

.drawer-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* Help Drawer */
.help-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    z-index: 500;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.help-drawer.open {
    transform: translateX(0);
}

/* Drawer Header */
.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
    color: white;
    flex-shrink: 0;
}

.drawer-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.drawer-header h2::before {
    content: '';
    font-size: 1.25rem;
}

.drawer-close {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.drawer-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Drawer Tabs */
.drawer-tabs {
    display: flex;
    background: var(--bg-hover);
    padding: var(--space-xs);
    gap: var(--space-xs);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    overflow-x: auto;
}

.drawer-tabs::-webkit-scrollbar {
    display: none;
}

.drawer-tab {
    flex: 1;
    min-width: 0;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drawer-tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.drawer-tab[aria-selected="true"] {
    background: var(--bg-card);
    color: var(--color-orange);
    box-shadow: var(--shadow-sm);
}

/* Drawer Content */
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* Tab Panels */
.drawer-panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.drawer-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Quick Start Steps */
.quick-start-step {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-orange) 0%, var(--color-orange-hover) 100%);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-content h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.step-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Accordion */
.accordion-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
}

.accordion-header {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-card);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.accordion-header:hover {
    background: var(--bg-hover);
}

.accordion-icon {
    font-size: 0.75rem;
    transition: transform var(--transition-fast);
    color: var(--text-muted);
}

.accordion-item.open .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    display: none;
    padding: 0 var(--space-md) var(--space-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.accordion-item.open .accordion-content {
    display: block;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; }
    to { opacity: 1; }
}

.accordion-content p {
    margin-bottom: var(--space-sm);
}

.accordion-content p:last-child {
    margin-bottom: 0;
}

.accordion-content ul {
    margin: var(--space-sm) 0;
    padding-left: var(--space-lg);
}

.accordion-content li {
    margin-bottom: var(--space-xs);
}

/* Tips List */
.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tip-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: background var(--transition-fast);
}

.tip-item:hover {
    background: var(--color-orange-light);
}

.tip-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.tip-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.tip-text strong {
    color: var(--color-orange-hover);
}

/* FAQ */
.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md) 0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
}

.faq-question::before {
    content: 'Q';
    width: 20px;
    height: 20px;
    background: var(--color-navy);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.faq-answer {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 28px;
}

/* Mobile Bottom Sheet */
@media (max-width: 768px) {
    .help-drawer {
        width: 100%;
        height: 85vh;
        top: auto;
        bottom: 0;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .help-drawer.open {
        transform: translateY(0);
    }

    .drawer-header {
        padding: var(--space-md);
        border-radius: 16px 16px 0 0;
    }

    /* Drag handle indicator */
    .drawer-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .drawer-tabs {
        padding: var(--space-xs);
        gap: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        mask-image: linear-gradient(to right, black 85%, transparent 100%);
        -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
    }

    .drawer-tab {
        font-size: 0.7rem;
        padding: 8px 6px;
        min-height: 44px;
        flex: 0 0 auto;
    }

    .drawer-content {
        padding: var(--space-md);
        padding-bottom: calc(var(--space-md) + var(--safe-area-bottom));
    }

    .quick-start-step {
        padding: var(--space-sm);
    }

    .step-number {
        width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .step-content h3 {
        font-size: 0.9rem;
    }

    .step-content p {
        font-size: 0.8rem;
    }

    .tooltip {
        display: none !important;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .help-drawer {
        background: var(--bg-dark);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
    }

    .drawer-tabs {
        background: rgba(15, 23, 42, 0.6);
        border-bottom-color: rgba(230, 126, 34, 0.15);
    }

    .drawer-tab {
        color: var(--text-secondary);
    }

    .drawer-tab:hover {
        background: rgba(28, 46, 74, 0.6);
    }

    .drawer-tab[aria-selected="true"] {
        background: rgba(28, 46, 74, 0.8);
        color: var(--color-orange);
    }

    .quick-start-step,
    .tip-item {
        background: rgba(28, 46, 74, 0.4);
    }

    .tip-item:hover {
        background: rgba(230, 126, 34, 0.15);
    }

    .accordion-item {
        border-color: rgba(230, 126, 34, 0.15);
    }

    .accordion-header {
        background: rgba(28, 46, 74, 0.4);
    }

    .accordion-header:hover {
        background: rgba(28, 46, 74, 0.6);
    }

    .faq-item {
        border-bottom-color: rgba(230, 126, 34, 0.15);
    }

    .drawer-backdrop {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .help-drawer,
    .drawer-backdrop,
    .accordion-icon {
        transition: none;
    }

    .drawer-panel {
        animation: none;
    }
}
