
/* Help Button Styles */
.help-button {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius:50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 999;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.help-button:active {
    transform: scale(0.95);
}

.help-icon {
    color: white;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

/* Help Panel Styles */
.help-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    transition: right 0.3s ease;
    overflow-y: auto;
}

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

.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    transition: opacity 0.3s ease;
}

.help-overlay.active {
    display: block;
}

.help-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.help-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.help-close {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

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

.help-content {
    padding: 20px;
}

.help-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.help-section:last-child {
    border-bottom: none;
}

.help-section h4 {
    color: #667eea;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 600;
}

.help-item {
    margin-bottom: 12px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.help-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    font-size: 14px;
}

.help-desc {
    display: block;
    color: #5a6c7d;
    font-size: 13px;
    line-height: 1.5;
}

/* Mobile responsive for help */
@media (max-width: 768px) {
    .help-button {
        width: 45px;
        height: 45px;
        top: 70px;
        right: 15px;
    }
    
    .help-icon {
        font-size: 24px;
    }
    
    .help-panel {
        width: 100%;
        right: -100%;
    }
    
    .help-panel.active {
        right: 0;
    }
}

/* Title section */
.bom-title {
    text-align: center;
    padding: 20px 0;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.bom-title h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #2d3748;
}

.bom-title h2 {
    font-size: 1.5rem;
    font-weight: normal;
    color: #4a5568;
    margin-bottom: 20px;
}

/* Type Selection Container */
.type-selection-container {
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
}

.type-selection-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.type-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 180px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.type-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.type-btn:active {
    transform: translateY(-1px);
}

.type-icon {
    font-size: 2.5rem;
}

.type-selection-hint {
    color: #718096;
    font-size: 14px;
    margin-top: 10px;
}

/* Back Button */
.back-btn {
    background-color: #e2e8f0;
    color: #2d3748;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    align-self: center;
}

.back-btn:hover {
    background-color: #cbd5e0;
    transform: translateX(-3px);
}

/* Assembly/Part Selection Dropdown */
.assembly-selection-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    gap: 15px;
    width: 100%;
    padding: 0 20px;
}

.assembly-dropdown {
    position: relative;
    width: 500px;
    max-width: 90%;
    margin: 0 auto;
}

.assembly-dropdown input[type="text"] {
    width: 100%;
    padding: 12px 50px 12px 15px;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 16px;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.assembly-dropdown input[type="text"]:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.assembly-dropdown input[type="text"]:hover {
    border-color: #a0aec0;
}

#assemblyDropdownBtn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    color: #718096;
    cursor: pointer;
    padding: 8px;
    transition: color 0.3s ease;
}

#assemblyDropdownBtn:hover {
    color: #4a5568;
}

.assembly-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #cbd5e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin: 0;
}

.assembly-dropdown-list.show {
    display: block;
}

.dropdown-search {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.dropdown-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 14px;
}

.assembly-options {
    max-height: 250px;
    overflow-y: auto;
}

.assembly-option {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f7fafc;
    transition: background-color 0.2s ease;
}

.assembly-option:hover {
    background-color: #edf2f7;
}

.assembly-option:last-child {
    border-bottom: none;
}

.assembly-option-number {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.assembly-option-name {
    font-size: 14px;
    color: #718096;
}

.no-assemblies {
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    font-style: italic;
}

/* BOM Container */
.bom-container {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    margin: 20px auto;
    max-width: 1200px;
    overflow: hidden;
}

.bom-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.bom-info h3 {
    font-size: 1.5rem;
    margin: 0 0 5px 0;
}

.bom-info p {
    margin: 0;
    opacity: 0.9;
    font-size: 14px;
}

.bom-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.export-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.export-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* BOM Table */
.bom-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.bom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.bom-table th {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #2d3748;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 2px solid #cbd5e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.bom-table th:first-child {
    width: 80px;
    text-align: center;
}

.bom-table th:nth-child(4) { /* Quantity */
    width: 100px;
    text-align: center;
}

.bom-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.bom-table tr:hover {
    background-color: #f8fafc;
}

.bom-table tr:nth-child(even) {
    background-color: #fdfdfd;
}

.bom-table tr:nth-child(even):hover {
    background-color: #f1f5f9;
}

.item-number {
    text-align: center;
    font-weight: 600;
    color: #4a5568;
}

.part-number {
    font-weight: 600;
    color: #2d3748;
    font-family: 'Courier New', monospace;
}

.part-name {
    color: #4a5568;
}

.quantity {
    text-align: center;
    font-weight: 600;
    color: #2d3748;
}

/* ALT Parts Section */
.alt-parts-section {
    margin-top: 30px;
    padding: 20px 30px;
    background-color: #fef3c7;
    border-top: 3px solid #f59e0b;
}

.alt-parts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alt-parts-header h3 {
    font-size: 1.3rem;
    color: #92400e;
    margin: 0;
}

.alt-parts-info {
    font-size: 14px;
    color: #78350f;
    font-style: italic;
}

.alt-parts-table-container {
    overflow-x: auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.alt-parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.alt-parts-table th {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #92400e;
    font-weight: 600;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #f59e0b;
}

.alt-parts-table th:first-child {
    width: 200px;
}

.alt-parts-table th:nth-child(2) {
    width: 200px;
}

.alt-parts-table th:last-child {
    width: 150px;
    text-align: center;
}

.alt-parts-table td {
    padding: 12px;
    border-bottom: 1px solid #fde68a;
    vertical-align: middle;
}

.alt-parts-table tr:hover {
    background-color: #fffbeb;
}

.primary-part-cell {
    font-weight: 600;
    color: #2d3748;
}

.primary-part-number {
    font-family: 'Courier New', monospace;
    color: #1e40af;
    font-weight: bold;
}

.primary-part-name {
    color: #4a5568;
    font-size: 13px;
    margin-top: 2px;
}

.alt-part-cell {
    font-weight: 500;
    color: #92400e;
}

.alt-part-number {
    font-family: 'Courier New', monospace;
    color: #c2410c;
    font-weight: bold;
}

.alt-part-name {
    color: #78350f;
    font-size: 13px;
    margin-top: 2px;
}

.toggle-alt-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.toggle-alt-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
}

.toggle-alt-btn.active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.toggle-alt-btn.active:hover {
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.no-alt-parts {
    text-align: center;
    padding: 30px;
    color: #92400e;
    font-style: italic;
}

/* BOM row highlighting when ALT is active */
.bom-table tr.using-alt {
    background-color: #fef3c7 !important;
    border-left: 4px solid #f59e0b;
}

.bom-table tr.using-alt:hover {
    background-color: #fde68a !important;
}

.bom-table tr.using-alt .part-number {
    color: #c2410c;
}

.bom-table tr.using-alt .part-name {
    color: #92400e;
}

/* BOM Summary - Hidden */
.bom-summary {
    display: none;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #718096;
    max-width: 600px;
    margin: 40px auto;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: #4a5568;
    margin-bottom: 15px;
}

.empty-state p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.empty-state-hint {
    font-size: 14px;
    color: #a0aec0;
    font-style: italic;
}

/* Print styles */
@media print {
    .header, .bom-actions, .footer, .bom-summary {
        display: none !important;
    }
    
    .bom-container {
        box-shadow: none;
        margin: 0;
        max-width: none;
    }
    
    .bom-table {
        font-size: 12px;
    }
    
    .bom-table th,
    .bom-table td {
        padding: 8px 6px;
    }
    
    .bom-header {
        background: #f8fafc !important;
        color: #2d3748 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .bom-table tr:nth-child(even) {
        background-color: #f8fafc !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .alt-parts-section {
        page-break-before: always;
        background-color: #fef3c7 !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .toggle-alt-btn {
        display: none;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .bom-title h1 {
        font-size: 2rem;
    }
    
    .bom-title h2 {
        font-size: 1.25rem;
    }
    
    .assembly-dropdown {
        width: 100%;
        margin: 0 20px;
    }
    
    .bom-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .bom-actions {
        justify-content: center;
    }
    
    .bom-table {
        font-size: 12px;
    }
    
    .bom-table th,
    .bom-table td {
        padding: 8px 6px;
    }
    
    .alt-parts-section {
        padding: 15px;
    }
    
    .alt-parts-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    /* Stack table for very small screens */
    @media (max-width: 480px) {
        .bom-table-container,
        .alt-parts-table-container {
            overflow-x: scroll;
        }
        
        .bom-table,
        .alt-parts-table {
            min-width: 500px;
        }
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Highlight selected assembly in dropdown */
.assembly-option.selected {
    background-color: #e6fffa;
    border-left: 4px solid #4299e1;
}

.assembly-option.selected .assembly-option-number {
    color: #2c5282;
}