/* ============================================================================
   ASSEMBLIES PAGE LAYOUT
============================================================================ */
.assemblies-page-wrapper {
    width: 100%;
    max-width: 100%;
    padding: 0;
    box-sizing: border-box;
}

.assemblies-page-container {
    max-width: var(--max-width, 1400px);
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    box-sizing: border-box;
}

/* ============================================================================
   VEHICLE HEADER
============================================================================ */
.vehicle-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.vehicle-header-icon {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    position: relative;
}

.vehicle-header-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.vehicle-icon-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.vehicle-header-brand-model {
    text-align: center;
    width: 100%;
    font-size: 8px;
    line-height: 1.2;
    color: #6b7280;
    margin-top: 2px;
}

.vehicle-brand {
    font-weight: 600;
    color: #374151;
    font-size: 9px;
}

.vehicle-model {
    font-size: 7px;
    color: #9ca3af;
}

.vehicle-header-description {
    flex: 1;
    min-width: 0;
}

.vehicle-description-text {
    font-size: 16px;
    font-weight: 700;
    color: #374151;
    line-height: 1.5;
    display: block;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.vehicle-header-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
    align-items: center;
}

.vehicle-details-btn,
.vehicle-change-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
    white-space: nowrap;
}

.vehicle-details-btn {
    background: #ffffff;
    border-color: #3b82f6;
    color: #3b82f6;
}

.vehicle-details-btn:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

.vehicle-change-btn {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.vehicle-change-btn:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.vehicle-details-btn svg,
.vehicle-change-btn svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ============================================================================
   ASSEMBLIES CONTROLS
============================================================================ */
.assemblies-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 24px;
}

.product-groups-section {
    flex: 1;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.product-groups-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 16px 0;
}

.product-group-filters {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scroll-behavior: smooth;
    /* Improve touch scrolling on mobile */
    touch-action: pan-x;
    /* Add padding for better scroll indication */
    scroll-padding: 12px;
    width: 100%;
    min-width: 0;
    /* Ensure scrolling works on mobile */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.product-group-filters::-webkit-scrollbar {
    height: 6px;
}

.product-group-filters::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.product-group-filters::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.product-group-filters::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.product-group-filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    white-space: normal;
    text-align: center;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    box-sizing: border-box;
    /* Prevent buttons from shrinking on mobile */
    min-width: 100px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.product-group-filter-btn:hover {
    background: #f3f4f6;
}

.product-group-filter-btn.active {
    background: #ffffff;
    border-color: #f97316;
    color: #f97316;
}

.product-group-filter-btn.active .product-group-icon {
    color: #f97316;
}

.product-group-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: #6b7280;
    transition: color 0.2s;
}

.product-group-label {
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
}

.view-switcher-section {
    flex-shrink: 0;
}

.view-switcher {
    display: flex;
    gap: 8px;
    align-items: center;
}

.view-switcher-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
}

.view-switcher-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.view-switcher-btn.active {
    background: var(--primary, #1d4ed8);
    border-color: var(--primary, #1d4ed8);
    color: #ffffff;
}

.view-switcher-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================================================
   ASSEMBLIES GRID
============================================================================ */
.assemblies-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============================================================================
   ASSEMBLY CARD
============================================================================ */
.assembly-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s, transform 0.2s;
    display: flex;
    flex-direction: column;
}

.assembly-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.assembly-card-header {
    background: #e0f2fe;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.assembly-card-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #374151;
}

.assembly-card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    flex: 1;
}

.assembly-card-body {
    padding: 16px;
    flex: 1;
}

.assembly-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.assembly-card-empty {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
    text-align: center;
    padding: 16px 0;
}

/* ============================================================================
   ASSEMBLY LINE ITEM
============================================================================ */
.assembly-line-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-main);
    position: relative;
}

.assembly-line-arrow {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    color: #6b7280;
    margin-right: -4px;
}

.assembly-line-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #6b7280;
}

.assembly-line-name {
    flex: 1;
    min-width: 0;
    font-weight: 400;
    color: var(--text-main);
}

.assembly-line-part-number {
    flex-shrink: 0;
    padding: 4px 8px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #374151;
    font-family: monospace;
}

.assembly-line-chevron {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    margin-left: auto;
    transition: color 0.2s;
}

.assembly-line-chevron:hover {
    color: var(--primary, #1d4ed8);
}

.assembly-line-chevron svg {
    width: 12px;
    height: 12px;
}

/* ============================================================================
   NO ASSEMBLIES MESSAGE
============================================================================ */
.no-assemblies-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.no-assemblies-message p {
    font-size: 16px;
    margin: 0;
}

/* ============================================================================
   RESPONSIVE DESIGN
============================================================================ */
@media (max-width: 1024px) {
    .assemblies-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .assemblies-page-container {
        padding: 16px 12px;
    }
    
    .vehicle-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .vehicle-header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .vehicle-header-icon {
        width: 48px;
        height: 48px;
        align-self: flex-start;
    }
    
    .vehicle-header-description {
        width: 100%;
        order: 2;
        min-width: 0;
    }
    
    .vehicle-description-text {
        font-size: 14px;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        display: block;
    }
    
    .vehicle-header-actions {
        order: 3;
        width: 100%;
        justify-content: space-between;
        margin-top: 0;
        gap: 8px;
    }
    
    .vehicle-details-btn,
    .vehicle-change-btn {
        padding: 8px 12px;
        font-size: 13px;
        gap: 6px;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    .vehicle-details-btn span,
    .vehicle-change-btn span {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .vehicle-details-btn svg,
    .vehicle-change-btn svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }
    
    .assemblies-controls {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    .view-switcher-section {
        align-self: flex-start;
    }
    
    .assemblies-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .product-group-filters {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        flex-wrap: nowrap;
        padding-bottom: 12px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
        width: calc(100% + 24px);
        min-width: 0;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
    }
    
    .product-group-filters::-webkit-scrollbar {
        height: 6px;
    }
    
    .product-group-filters::-webkit-scrollbar-track {
        background: #f3f4f6;
        border-radius: 3px;
    }
    
    .product-group-filters::-webkit-scrollbar-thumb {
        background: #d1d5db;
        border-radius: 3px;
    }
    
    .product-group-filters::-webkit-scrollbar-thumb:hover {
        background: #9ca3af;
    }
    
    .product-group-filter-btn {
        width: 85px;
        height: 85px;
        padding: 8px 4px;
        font-size: 10px;
        gap: 6px;
    }
    
    .product-group-icon {
        width: 26px;
        height: 26px;
    }
    
    .product-groups-title {
        font-size: 16px;
        margin: 0 0 12px 0;
    }
}

@media (max-width: 480px) {
    .assemblies-page-container {
        padding: 12px 8px;
    }
    
    .vehicle-header {
        padding: 12px;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .vehicle-header-content {
        gap: 10px;
    }
    
    .vehicle-header-icon {
        width: 40px;
        height: 40px;
    }
    
    .vehicle-description-text {
        font-size: 13px;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        display: block;
    }
    
    .vehicle-header-actions {
        gap: 8px;
        margin-top: 0;
        flex-wrap: nowrap;
    }
    
    .vehicle-details-btn,
    .vehicle-change-btn {
        padding: 8px 10px;
        font-size: 12px;
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    
    .vehicle-details-btn span,
    .vehicle-change-btn span {
        display: inline;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    
    .vehicle-details-btn svg,
    .vehicle-change-btn svg {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
        margin-right: 4px;
    }
    
    .product-groups-title {
        font-size: 15px;
        margin: 0 0 10px 0;
    }
    
    .product-group-filters {
        gap: 10px;
        margin: 0 -8px;
        padding-left: 8px;
        padding-right: 8px;
        width: calc(100% + 16px);
        min-width: 0;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
    }
    
    .product-group-filter-btn {
        width: 80px;
        height: 80px;
        padding: 6px 3px;
        font-size: 9px;
        gap: 5px;
    }
    
    .product-group-icon {
        width: 24px;
        height: 24px;
    }
    
    .product-group-label {
        font-size: 9px;
        line-height: 1.2;
    }
    
    .assembly-card-header {
        padding: 12px;
    }
    
    .assembly-card-body {
        padding: 12px;
    }
    
    .assemblies-controls {
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .assemblies-grid {
        gap: 12px;
    }
}

/* ============================================================================
   SKELETON LOADERS
============================================================================ */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton-base {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* Vehicle Header Skeleton */
.vehicle-header-skeleton {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}

@media (max-width: 768px) {
    .vehicle-header-skeleton {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .vehicle-header-skeleton .skeleton-icon {
        width: 48px;
        height: 48px;
        align-self: flex-start;
    }
    
    .vehicle-header-skeleton .skeleton-text {
        width: 100%;
    }
    
    .vehicle-header-skeleton .skeleton-actions {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }
    
    .vehicle-header-skeleton .skeleton-button {
        flex: 1;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .vehicle-header-skeleton {
        gap: 12px;
        padding: 12px;
    }
    
    .vehicle-header-skeleton .skeleton-icon {
        width: 40px;
        height: 40px;
    }
    
    .vehicle-header-skeleton .skeleton-button {
        flex: 1;
        height: 36px;
    }
}

.skeleton-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 4px;
}

.skeleton-text {
    flex: 1;
    min-width: 0;
}

.skeleton-line {
    height: 20px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-line-short {
    width: 60%;
}

.skeleton-actions {
    flex-shrink: 0;
    display: flex;
    gap: 8px;
}

.skeleton-button {
    width: 120px;
    height: 36px;
    border-radius: 6px;
}

.skeleton-icon,
.skeleton-line,
.skeleton-button {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

/* Product Groups Skeleton */
.product-groups-skeleton {
    display: flex;
    gap: 12px;
    flex-wrap: nowrap;
    overflow-x: hidden;
    padding-bottom: 8px;
}

@media (max-width: 768px) {
    .product-groups-skeleton {
        gap: 12px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .product-groups-skeleton .skeleton-button-square {
        width: 85px;
        height: 85px;
    }
}

@media (max-width: 480px) {
    .product-groups-skeleton {
        gap: 10px;
        margin: 0 -8px;
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .product-groups-skeleton .skeleton-button-square {
        width: 80px;
        height: 80px;
    }
}

.skeleton-button-square {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Hide skeletons when content loads */
.vehicle-header-content {
    display: flex;
    gap: 12px;
    align-items: center;
    width: 100%;
}
