/* UVI PC Builder - Builder Styles */

/* ── Builder Layout ───────────────────────── */
.builder-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
    align-items: start;
}

/* ── Hero Section ─────────────────────────── */
.builder-hero {
    text-align: center;
    padding: var(--space-2xl) 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.builder-hero h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.builder-hero p {
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    max-width: 600px;
    margin: 0 auto;
}

/* ── Budget Wizard ────────────────────────── */
.budget-wizard {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-xl);
    display: flex;
    gap: var(--space-lg);
    align-items: flex-end;
    flex-wrap: wrap;
}

.budget-wizard .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 150px;
}

.budget-wizard .budget-presets {
    display: flex;
    gap: var(--space-sm);
}

.budget-preset-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--font);
    transition: all var(--transition);
}

.budget-preset-btn:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.budget-preset-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #fff;
}

/* ── Section Steps ────────────────────────── */
.builder-sections {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.section-step {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.section-step.active {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-glow);
}

.section-step.completed {
    border-color: var(--success);
}

.section-step-header {
    display: flex;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    user-select: none;
    gap: var(--space-md);
    transition: background var(--transition);
}

.section-step-header:hover {
    background: var(--bg-card-hover);
}

.section-step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: 600;
    background: var(--border-color);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.section-step.active .section-step-number {
    background: var(--accent-gradient);
    color: #fff;
}

.section-step.completed .section-step-number {
    background: var(--success);
    color: #fff;
}

.section-step-info {
    flex: 1;
}

.section-step-name {
    font-weight: 600;
    font-size: var(--font-size-base);
}

.section-step-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.section-step-selected {
    text-align: right;
    font-size: var(--font-size-sm);
}

.section-step-selected .product-name {
    color: var(--accent-blue);
    font-weight: 500;
}

.section-step-selected .product-price {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.section-step-chevron {
    color: var(--text-muted);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.section-step.active .section-step-chevron {
    transform: rotate(180deg);
}

/* ── Section Content (products grid) ──────── */
.section-step-content {
    display: none;
    padding: 0 var(--space-lg) var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.section-step.active .section-step-content {
    display: block;
}

.section-filters {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    flex-wrap: wrap;
    align-items: center;
}

.section-filters .form-input,
.section-filters .form-select {
    width: auto;
    min-width: 120px;
    padding: 6px 10px;
    font-size: var(--font-size-xs);
}

.price-range-filter {
    display: flex;
    align-items: center;
    gap: 4px;
}

.price-range-filter .form-input {
    min-width: 72px;
    max-width: 90px;
}

.price-range-sep {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
}

/* ── Product Card ─────────────────────────── */
.product-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.product-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.product-card.selected {
    border-color: var(--accent-blue);
    background: rgba(56, 146, 214, 0.06);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.product-card.incompatible {
    opacity: 0.4;
    pointer-events: none;
}

.product-card-badges {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    display: flex;
    gap: var(--space-xs);
}

.product-card-image {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-sm);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    overflow: hidden;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-card-image .placeholder-text {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-sm);
}

.product-card-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    margin-bottom: var(--space-xs);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-sm);
}

.product-card-price {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--accent-blue);
}

.product-card-price .old-price {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-decoration: line-through;
    font-weight: 400;
    margin-left: var(--space-xs);
}

.product-card-stock {
    font-size: var(--font-size-xs);
}

.product-card-actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.product-card-actions .btn {
    flex: 1;
    justify-content: center;
    font-size: var(--font-size-xs);
    padding: 6px 10px;
}

/* ── Build Summary Sidebar ────────────────── */
.build-summary {
    position: sticky;
    top: calc(var(--header-height) + var(--space-lg));
}

.build-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.build-summary-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.build-summary-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.build-summary-items {
    padding: var(--space-md) var(--space-lg);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-size-sm);
}

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

.summary-item-section {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

.summary-item-name {
    font-weight: 500;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-item-price {
    font-weight: 600;
    color: var(--accent-blue);
    white-space: nowrap;
}

.summary-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    transition: color var(--transition);
}

.summary-item-remove:hover {
    color: var(--danger);
}

.summary-empty {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.build-summary-total {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.build-summary-total .total-label {
    font-weight: 600;
    font-size: var(--font-size-base);
}

.build-summary-total .total-price {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.build-summary-actions {
    padding: 0 var(--space-lg) var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

/* ── Warnings ─────────────────────────────── */
.build-warnings {
    padding: 0 var(--space-lg) var(--space-lg);
}

.build-warning {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-size: var(--font-size-xs);
    margin-bottom: var(--space-xs);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.build-warning.warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(255, 159, 10, 0.2);
}

.build-warning.info {
    background: var(--info-bg);
    color: var(--info);
    border: 1px solid rgba(56, 146, 214, 0.2);
}

/* ── Share Modal ──────────────────────────── */
.share-url-box {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.share-url-box input {
    flex: 1;
}

/* ── Product Detail Modal ─────────────────── */
.product-detail-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: var(--space-xl);
}

.product-detail-image {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    overflow: hidden;
}

.product-detail-image img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.product-detail-info h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.product-detail-price {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: var(--space-md);
}

.product-detail-specs {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xs) var(--space-lg);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-lg);
}

.product-detail-specs dt {
    color: var(--text-secondary);
}

.product-detail-specs dd {
    font-weight: 500;
}

.product-detail-compat {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.product-detail-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.7;
    max-height: 250px;
    overflow: hidden;
}

/* ── Load More Button ────────────────────── */
.btn-load-more {
    min-width: 180px;
}

/* ── Responsive Builder ───────────────────── */
@media (max-width: 1024px) {
    .builder-layout {
        display: flex;
        flex-direction: column;
        gap: var(--space-xl);
    }

    .builder-sections {
        order: 1;
    }

    .build-summary {
        position: static;
        order: 2;
    }

    .build-summary-card {
        border-radius: var(--radius-lg);
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 600px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .budget-wizard {
        flex-direction: column;
        align-items: stretch;
    }

    .budget-wizard .budget-presets {
        flex-wrap: wrap;
    }

    .budget-preset-btn {
        flex: 1;
        min-width: 0;
        text-align: center;
        padding: 8px 10px;
        font-size: var(--font-size-xs);
    }

    .budget-wizard .btn {
        width: 100%;
        justify-content: center;
    }

    .product-detail-desc {
        max-height: 150px;
    }

    /* Mobile section headers: wrap to two rows */
    .section-step-header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
        padding: var(--space-sm) var(--space-md);
        gap: 2px var(--space-sm);
    }

    .section-step-number {
        width: 26px;
        height: 26px;
        font-size: var(--font-size-xs);
        grid-row: 1 / -1;
        align-self: center;
    }

    .section-step-info {
        grid-column: 2;
        grid-row: 1;
        min-width: 0;
    }

    .section-step-desc {
        display: none;
    }

    .section-step-name {
        font-size: var(--font-size-sm);
    }

    .section-step-selected {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        font-size: var(--font-size-xs);
        min-width: 0;
    }

    .section-step-selected .product-name {
        display: inline;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .section-step-chevron {
        grid-column: 3;
        grid-row: 1 / -1;
        align-self: center;
    }

    /* Filters: stack vertically on mobile */
    .section-filters {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .price-range-filter {
        width: 100%;
    }

    .price-range-filter .form-input {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .section-filters .form-input,
    .section-filters .form-select {
        width: 100%;
        min-width: 0;
    }

    .section-filters .form-checkbox {
        align-self: flex-start;
    }

    .section-step-content {
        padding: 0 var(--space-md) var(--space-md);
    }

    /* Services: better mobile layout */
    .service-option {
        flex-wrap: wrap;
        gap: var(--space-sm);
        padding: var(--space-sm) var(--space-md);
    }

    .service-option-price {
        margin-left: auto;
    }

    /* Mobile bottom bar padding so content doesn't hide behind it */
    .builder-layout {
        padding-bottom: 70px;
    }
}

/* ── Mobile Sticky Bottom Bar ────────────── */
.mobile-build-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: var(--space-sm) var(--space-lg);
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-build-bar.visible {
    display: flex;
}

.mobile-build-bar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-build-bar-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.mobile-build-bar-price {
    font-size: var(--font-size-lg);
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 1025px) {
    .mobile-build-bar {
        display: none !important;
    }
}

/* ── Payment Method Options ──────────────── */
.payment-methods {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

.payment-method-option input[type="radio"] {
    display: none;
}

.payment-method-card {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.payment-method-card:hover {
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.payment-method-option input[type="radio"]:checked + .payment-method-card {
    border-color: var(--accent-blue);
    background: rgba(56, 146, 214, 0.1);
    color: var(--text-primary);
}

/* ── Selected Note ────────────────────────── */
.summary-item-note {
    font-size: var(--font-size-xs);
    color: var(--accent-blue);
    background: rgba(56, 146, 214, 0.1);
    border-left: 2px solid var(--accent-blue);
    padding: 4px 8px;
    margin-top: 4px;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
}

/* ── Services Section ────────────────────── */
.services-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.service-option {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.2s;
}

.service-option.unavailable {
    opacity: 0.5;
}

.service-option.selected {
    border-color: var(--accent-blue);
    background: rgba(56, 146, 214, 0.05);
}

.service-option-info {
    flex: 1;
}

.service-option-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.service-option-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 2px;
}

.service-option-price {
    font-weight: 700;
    color: var(--accent-blue);
    white-space: nowrap;
}

@media (max-width: 600px) {
    .payment-methods {
        grid-template-columns: 1fr;
    }
}
