/**
 * PC Builder Styles
 * Responsive design for PC builder form and results
 */

/* Container */
.pc-builder-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
}

.pc-builder-form-wrapper,
.pc-build-results-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Header */
.pc-builder-header {
    text-align: center;
    margin-bottom: 50px;
}

.pc-builder-header h1 {
    font-size: 2.5rem;
    color: #1a1a1a;
    margin-bottom: 15px;
    font-weight: 700;
}

.pc-builder-header p {
    font-size: 1.1rem;
    color: #666;
    max-width: 600px;
    margin: 0 auto;
}

/* Form Sections */
.form-section {
    margin-bottom: 50px;
}

.form-section h2 {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 25px;
    font-weight: 600;
}

/* Budget Options */
.budget-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.budget-option {
    cursor: pointer;
    display: block;
}

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

.budget-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 25px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.budget-option input[type="radio"]:checked + .budget-card {
    border-color: var(--primary-color);
    background: #fef5ed;
    box-shadow: 0 2px 8px rgba(245, 143, 57, 0.15);
}

.budget-card:hover {
    border-color: var(--primary-color);
    background: #fef5ed;
}

.budget-amount {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.budget-label {
    font-size: 0.9rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Usage Options */
.usage-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.usage-option {
    cursor: pointer;
    display: block;
}

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

.usage-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.usage-option input[type="radio"]:checked + .usage-card {
    border-color: var(--primary-color);
    background: #fef5ed;
    box-shadow: 0 2px 8px rgba(245, 143, 57, 0.15);
}

.usage-card:hover {
    border-color: var(--primary-color);
    background: #fef5ed;
}

.usage-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.usage-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
}

/* Preferences */
.preferences-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.preference-checkbox {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.preference-checkbox:hover {
    border-color: var(--primary-color);
    background: #fef5ed;
}

.preference-checkbox input[type="checkbox"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.preference-checkbox input[type="checkbox"]:checked + .checkbox-label {
    color: var(--primary-color);
    font-weight: 600;
}

.checkbox-label {
    font-size: 1rem;
    color: #333;
}

/* Submit Button */
.form-submit {
    text-align: center;
    margin-top: 50px;
}

.btn-submit,
.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 18px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-submit:hover,
.btn-primary:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 143, 57, 0.3);
}

.btn-submit:disabled,
.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #fff;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 16px 35px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
    margin-left: 15px;
}

.btn-secondary:hover {
    background: #fef5ed;
}

.btn-large {
    padding: 20px 50px;
    font-size: 1.2rem;
}

/* Spinners */
.spinner,
.spinner-large {
    animation: rotate 2s linear infinite;
    width: 24px;
    height: 24px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.spinner-large {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
}

.spinner .path,
.spinner-large .path {
    stroke: var(--primary-color);
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Error Messages */
.error-message {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
}

/* Loading State */
.build-loading {
    text-align: center;
    padding: 80px 40px;
}

.build-loading h2 {
    font-size: 1.8rem;
    color: #1a1a1a;
    margin-bottom: 10px;
}

.build-loading p {
    font-size: 1.1rem;
    color: #666;
}

/* Error State */
.build-error {
    text-align: center;
    padding: 80px 40px;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.build-error h2 {
    font-size: 1.8rem;
    color: #c33;
    margin-bottom: 15px;
}

.build-error p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 30px;
}

/* Results */
.build-header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.build-header h1 {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 20px;
}

.build-summary {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
}

.summary-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* Components Table */
.components-list {
    margin-bottom: 40px;
    overflow-x: auto;
}

.components-table {
    width: 100%;
    border-collapse: collapse;
}

.components-table thead th {
    background: #f5f5f5;
    padding: 2px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

.components-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
}

.components-table tbody td {
    padding: 2px;
    font-size: 0.7rem;
}

.col-select {
    width: 40px;
    text-align: center;
}

.col-select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.col-select input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.component-row-alternative {
    background: #f9f9f9;
}

.component-row-alternative td {
    padding-left: 20px;
    font-style: italic;
}

.col-status {
    width: 150px;
    text-align: left;
}

.col-type {
    width: 150px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #333;
}

.col-product {
    color: #1a1a1a;
    font-size: 0.9rem;
}

.col-product .product-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.col-product .product-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.col-price {
    width: 120px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
    color: #1a1a1a;
}

.col-actions {
    width: 100px;
    text-align: center;
}

.btn-view-component {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.btn-view-component:hover {
    background: #0052a3;
}

/* Stock Badges */
.stock-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-available {
    color: #2e7d32;
}

.badge-backorder {
    color: #1976d2;
}

.badge-alternative {
    color: #e65100;
}

.badge-unavailable {
    color: #c62828;
}

.alternative-badge {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
}

/* Pricing Summary */
.pricing-summary {
    background: #f5f5f5;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid #e0e0e0;
}

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

.summary-row.total {
    border-top: 2px solid #333;
    margin-top: 10px;
    padding-top: 12px;
    font-size: 1rem;
    font-weight: 700;
}

.summary-row .summary-value.price {
    color: #1a1a1a;
    font-weight: 700;
}

/* Build Actions */
.build-actions {
    text-align: center;
    margin: 40px 0;
}

/* AI Disclaimer */
.ai-disclaimer {
    background: #fff8e1;
    border: 2px solid #ffa726;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.ai-disclaimer .disclaimer-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.ai-disclaimer .disclaimer-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #5d4037;
}

.ai-disclaimer .disclaimer-content strong {
    color: #e65100;
    font-weight: 600;
}

/* Info Messages */
.info-messages {
    margin-bottom: 20px;
}

.info-message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.info-message.info {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    color: #1565c0;
}

.info-message.warning {
    background: #fff3e0;
    border-left: 4px solid #ff9800;
    color: #e65100;
}

.info-message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

/* Component Modal */
.component-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-content h2 {
    font-size: 1.2rem;
    color: #1a1a1a;
    margin-bottom: 15px;
    padding-right: 40px;
}

.modal-body p {
    margin-bottom: 12px;
    line-height: 1.6;
    font-size: 0.9rem;
}

.modal-reasoning {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.modal-reasoning h3 {
    font-size: 0.95rem;
    color: #333;
    margin-bottom: 8px;
}

.modal-reasoning p {
    color: #333;
    font-size: 0.9rem;
    margin: 0;
}

#modal-product-link {
    display: inline-block;
    margin-top: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pc-builder-form-wrapper,
    .pc-build-results-wrapper {
        padding: 25px 20px;
    }

    .pc-builder-header h1 {
        font-size: 1.8rem;
    }

    .budget-options {
        grid-template-columns: 1fr;
    }

    .budget-card {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
        padding: 5px 20px;
    }

    .budget-amount {
        margin-bottom: 0;
    }

    .usage-options {
        grid-template-columns: 1fr;
    }

    .usage-card {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        padding: 5px 20px;
        gap: 15px;
    }

    .usage-icon {
        margin-bottom: 0;
    }

    .preferences-options {
        grid-template-columns: 1fr;
    }

    .build-summary {
        flex-direction: column;
        gap: 15px;
    }

    .components-table {
        font-size: 0.9rem;
    }

    .components-table thead {
        display: none;
    }

    .components-table tbody tr {
        display: grid;
        grid-template-columns: 50px 1fr auto;
        grid-template-rows: auto auto auto;
        padding: 15px 0;
        gap: 10px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .col-status {
        grid-row: 1 / 3;
    }

    .col-type {
        grid-column: 2;
        font-size: 0.85rem;
        color: #666;
    }

    .col-product {
        grid-column: 2;
        font-weight: 600;
    }

    .col-price {
        grid-column: 2;
        text-align: left;
        margin-top: 5px;
    }

    .btn-secondary {
        margin-left: 0;
        margin-top: 15px;
        display: block;
    }
}

@media (max-width: 480px) {
    .pc-builder-container {
        padding: 0 10px;
        margin: 20px auto;
    }

    .btn-submit,
    .btn-primary,
    .btn-secondary {
        width: 100%;
        display: block;
    }
}
