/**
 * Helper Panel Component Styles
 * Floating contextual help panel that slides in from the right
 * Does not affect main layout - overlay style
 *
 * @version 1.0.0
 * @date 2025-01-XX
 */

/* ============================================
   HELPER PANEL WRAPPER
   ============================================ */
.helper-panel-wrapper {
    position: relative;
}

/* ============================================
   HELPER TRIGGER BUTTON (Default: Fixed position, old style)
   ============================================ */
.helper-panel-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary, #108D52);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #ffffff;
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    padding: 0;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.helper-panel-trigger:hover {
    background: var(--color-primary-dark, #0d7a43);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ============================================
   FORM PAGES OVERRIDE (Small, inline, red icon, no background)
   ============================================ */
.form-header .helper-panel-trigger {
    position: static !important;
    bottom: auto !important;
    right: auto !important;
    width: 24px !important;
    height: 24px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 12px !important;
    z-index: auto !important;
    padding: 0 !important;
}

.form-header .helper-panel-trigger:hover {
    background: transparent !important;
    transform: scale(1.05) !important;
    box-shadow: none !important;
}

/* Red color for icon in form header */
.form-header .helper-panel-trigger .helper-icon,
.form-header .helper-panel-trigger .helper-icon svg {
    color: #ED3934 !important;
    fill: #ED3934 !important;
}

.form-header .helper-panel-trigger:hover .helper-icon,
.form-header .helper-panel-trigger:hover .helper-icon svg {
    color: #d32f2a !important;
    fill: #d32f2a !important;
}

/* ============================================
   SUPPLIER DETAIL PAGE OVERRIDES
   Hide the original helper panel trigger button on supplier information page
   because it's now integrated into the sidebar buttons component.
   ============================================ */
.supplier-information-page .helper-panel-trigger {
    display: none !important;
}

.helper-panel-trigger:active {
    transform: scale(0.95);
}

.helper-panel-trigger:focus {
    outline: 2px solid #ED3934;
    outline-offset: 2px;
}

.helper-icon {
    display: block;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   OVERLAY BACKGROUND
   ============================================ */
.helper-panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.helper-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   SLIDE-IN PANEL
   ============================================ */
.helper-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: var(--bg-white);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transform: translate3d(100%, 0, 0);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.helper-panel.active {
    transform: translate3d(0, 0, 0);
}

/* ============================================
   PANEL HEADER
   ============================================ */
.helper-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color-light);
    flex-shrink: 0;
    background: var(--bg-white);
}

.helper-panel-title {
    font-weight: 600;
    font-size: 20px;
    line-height: 28px;
    color: var(--color-text-primary);
    margin: 0;
}

.helper-panel-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    font-size: 24px;
    line-height: 1;
    padding: 0;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.helper-panel-close:hover {
    background: var(--bg-gray-light);
    color: var(--color-text-primary);
}

.helper-panel-close:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
   PANEL CONTENT
   ============================================ */
.helper-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

.helper-panel-description {
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-secondary);
    margin: 0 0 24px 0;
}

/* Highlight info box inside panel (used on supplier detail guidelines panel) */
.helper-panel-info-box {
    background: #f3f4f6;
    border-left: 4px solid var(--color-primary, #108D52);
    padding: 14px 16px;
    font-size: 14px;
    margin: 12px 0 16px 0;
    color: var(--color-text-primary, #111827);
}

.helper-panel-info-box p {
    margin: 0 0 8px 0;
}

.helper-panel-info-box ul {
    margin: 0 0 8px 18px;
    padding: 0;
}

.helper-panel-info-box li {
    margin: 4px 0;
}

.helper-panel-content a {
    color: var(--color-primary, #108D52);
    text-decoration: underline;
}

.helper-panel-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

/* ============================================
   STEPS (RFQ MODE)
   ============================================ */
.helper-panel-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.helper-panel-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.helper-panel-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.helper-panel-step-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.helper-panel-step-title {
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-primary);
    margin: 0;
}

.helper-panel-step-description {
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* ============================================
   TIPS (QUOTATION MODE)
   ============================================ */
.helper-panel-tips {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.helper-panel-tip {
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color-light);
}

.helper-panel-tip:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.helper-panel-tip-title {
    font-weight: 500;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-primary);
    margin: 0 0 8px 0;
}

.helper-panel-tip-description {
    font-weight: 400;
    font-size: 14px;
    line-height: 20px;
    color: var(--color-text-secondary);
    margin: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 768px) {
    /* Default style (old style) for all pages */
    .helper-panel-trigger {
        bottom: 80px !important;
        right: 10px !important;
        width: 48px !important;
        height: 48px !important;
        font-size: 20px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    }

    .helper-panel-trigger:hover {
        transform: scale(1.03) !important;
    }

    /* Override for form pages (small, inline, red icon, no background) */
    .form-header .helper-panel-trigger {
        bottom: auto !important;
        right: auto !important;
        width: 24px !important;
        height: 24px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        font-size: 12px !important;
    }

    /* Hide helper panel trigger on supplier information page (now in sidebar) */
    .supplier-information-page .helper-panel-trigger {
        display: none !important;
    }

    .helper-panel {
        max-width: 100%;
        width: 100%;
    }

    .helper-panel-header {
        padding: 16px 20px;
        border-bottom: 1px solid var(--border-color-light);
    }

    .helper-panel-title {
        font-size: 18px;
        line-height: 24px;
    }

    .helper-panel-close {
        width: 36px;
        height: 36px;
        font-size: 22px;
    }

    .helper-panel-content {
        padding: 20px;
    }

    .helper-panel-description {
        font-size: 13px;
        line-height: 18px;
        margin-bottom: 20px;
    }

    .helper-panel-steps {
        gap: 18px;
    }

    .helper-panel-tips {
        gap: 20px;
    }

    .helper-panel-tip {
        padding-bottom: 20px;
    }
}

@media (max-width: 480px) {
    /* Default style (old style) for all pages */
    .helper-panel-trigger {
        bottom: 80px !important;
        right: 10px !important;
        width: 44px !important;
        height: 44px !important;
        font-size: 18px !important;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2) !important;
    }

    /* Override for form pages (small, inline, red icon, no background) */
    .form-header .helper-panel-trigger {
        bottom: auto !important;
        right: auto !important;
        width: 24px !important;
        height: 24px !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        font-size: 12px !important;
    }

    /* Hide helper panel trigger on supplier information page (now in sidebar) */
    .supplier-information-page .helper-panel-trigger {
        display: none !important;
    }

    .helper-panel-header {
        padding: 14px 16px;
    }

    .helper-panel-title {
        font-size: 16px;
        line-height: 22px;
    }

    .helper-panel-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }

    .helper-panel-content {
        padding: 16px;
    }

    .helper-panel-description {
        font-size: 12px;
        line-height: 16px;
        margin-bottom: 16px;
    }

    .helper-panel-step {
        gap: 12px;
    }

    .helper-panel-step-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .helper-panel-step-title,
    .helper-panel-tip-title {
        font-size: 14px;
        line-height: 20px;
    }

    .helper-panel-step-description,
    .helper-panel-tip-description {
        font-size: 12px;
        line-height: 18px;
    }

    .helper-panel-steps {
        gap: 16px;
    }

    .helper-panel-tips {
        gap: 16px;
    }

    .helper-panel-tip {
        padding-bottom: 16px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.helper-panel[aria-hidden="true"] {
    display: none;
}

.helper-panel[aria-hidden="false"] {
    display: flex;
}

/* Panel overlay prevents interaction with background, but doesn't lock body scroll */
/* Form can still scroll normally when panel is open */

/* Mobile-specific: Ensure panel is above all content */
@media (max-width: 768px) {
    .helper-panel-overlay {
        z-index: 9998;
    }

    .helper-panel {
        z-index: 9999;
    }

    .supplier-information-page .helper-panel-trigger {
        display: none !important;
    }
}

