/* Temporary - add padding to cart and checkout page */
button,
.button {
    margin: 0;
    font-weight: normal;
}
.product-title.product_title {
    font-size: 2.5rem;
}
/* Modern configurator styling based on Swedish design */
#sd-configurator {
}

.sd-conf-wrapper {
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.6);
}

.sd-conf-steps {
}

/* Step Header */
.sd-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--color-black);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.sd-step-indicator {
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Step Content */
.sd-step-content {
}

/* Hide all steps by default to prevent FOUC */
.sd-conf-step {
    display: none;
}

/* Show first step immediately on page load */
.sd-conf-step[data-step="0"] {
    display: block;
}

/* Dropdowns Row */
.sd-dropdowns-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.sd-dropdown-container {
    display: flex;
    flex-direction: column;
    position: relative;
}

.sd-dropdown-label {
    font-size: 0.8rem;
    line-height: 0.8rem;
    position: absolute;
    top: -0.4rem;
    left: 0.5rem;
    z-index: 1;
    background-color: #f1ece6;
    padding: 0 0.5rem;
}

.sd-description-image img {
    max-width: 50%;
    object-fit: contain !important;
    aspect-ratio: 1 / 1;
}

/* Legacy select styling - keep for fallback */

/* Custom Dropdown Styling */
.sd-custom-dropdown {
    position: relative;
    width: 100%;
}

.sd-dropdown-button {
    padding: 0.5rem 1rem;
    width: 100%;
    border: 1px solid var(--color-black);
    font-size: var(--font-size-sm);
    background-color: var(--color-linen);
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sd-dropdown-button:hover {
    background-color: #f1f1f1;
}

.sd-dropdown-button:focus,
.sd-custom-dropdown.open .sd-dropdown-button {
    outline: 0;
}

.sd-dropdown-text {
    flex-grow: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.sd-dropdown-arrow {
    color: black;
    transition: transform 0.2s ease;
    user-select: none;
    font-size: 0.6rem;
    position: absolute;
    right: 0.7rem;
    line-height: 1;
}

.sd-custom-dropdown.open .sd-dropdown-arrow {
    transform: rotate(180deg);
}

.sd-dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: white;
    border: 1px solid var(--color-black);
    border-top: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.sd-dropdown-option {
    font-size: var(--font-size-sm);
    padding: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

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

.sd-dropdown-option:hover {
    background-color: color-mix(in srgb, var(--color-linen), transparent 75%);
}

.sd-dropdown-option.selected {
    background-color: var(--color-linen);
    color: var(--color-black);
}

.sd-dropdown-option.selected:hover {
    background-color: color-mix(in srgb, var(--color-linen), transparent 50%);
}

#sd-config-summary {
    margin-top: 1rem;
}
#sd-add-to-quote {
    display: none;
} /* toggled by JS */

.sd-swatches-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;

    & .sd-swatches-title {
        margin: 0;
    }
}

.sd-order-sample {
    font-size: 0.8rem;
    text-decoration: none;
    flex-shrink: 0;
    text-align: right;
}

.sd-order-sample:hover {
    text-decoration: underline;
}

/* Color Swatches Grid */
.sd-color-swatches-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    align-items: start;
    gap: 0.25rem;
    min-width: 0; /* allow shrinking inside flex/grid parents */
    width: 100%;
}

@media (max-width: 849px) {
    .sd-color-swatches-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.sd-swatch-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    border: 1px solid;
    border-color: transparent;
    transition: all 0.2s ease-in-out;
}

.sd-swatch-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sd-swatch-item:has(.sd-swatch-image.active) {
    border-color: var(--color-black);
    position: relative;
}

.sd-swatch-item:has(.sd-swatch-image.active)::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    background: var(--color-black);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 1;
    pointer-events: none;
    border: 1px solid white;
}

.sd-color-swatch-large {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 12;
    transition: all 0.2s ease;
    position: relative;
}

.sd-color-swatch-large.sd-swatch-image::before {
    background-repeat: no-repeat;
    background: inherit;
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.sd-swatch-label {
    font-size: 0.65rem;
    padding: 0.25rem 0;
    line-height: 1;
    text-align: center;
}

/* Legacy small swatches - keep for compatibility */
.sd-color-swatches {
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.sd-color-swatch {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.sd-color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sd-color-swatch.active {
    border-color: #333;
    box-shadow: 0 0 0 2px #333;
    transform: scale(1.15);
}

/* Option buttons for other steps */
.sd-opt {
    padding: 8px 16px;
    margin: 4px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.sd-opt:hover {
    background: #f5f5f5;
    border-color: #999;
}

.sd-opt.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* Progress Indicator */
.sd-progress-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

.sd-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.sd-progress-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 15px;
    left: 60%;
    right: -40%;
    height: 2px;
    background: #ddd;
    z-index: 1;
}

.sd-progress-step.completed:not(:last-child)::after {
    background: #4caf50;
}

.sd-progress-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    z-index: 2;
    position: relative;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.sd-progress-step.active .sd-progress-dot {
    background: #2196f3;
    color: white;
}

.sd-progress-step.completed .sd-progress-dot {
    background: #4caf50;
    color: white;
}

.sd-progress-label {
    font-size: 12px;
    text-align: center;
    color: #666;
    max-width: 80px;
    line-height: 1.2;
}

.sd-progress-step.active .sd-progress-label {
    color: #2196f3;
    font-weight: 600;
}

.sd-progress-step.completed .sd-progress-label {
    color: #4caf50;
}

/* Navigation */
.sd-navigation {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.sd-navigation:not(:has(.sd-nav-button.inactive)) {
    justify-content: space-between;
}

.sd-nav-button {
    font-size: 0.8rem !important;
}

.sd-nav-button.inactive {
    opacity: 0.5;
    pointer-events: none;
}

.sd-nav-prev,
.sd-nav-next {
    color: black;
}

/* Summary Section */
.sd-summary {
    margin-top: 2rem;
}

.sd-lines {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sd-line-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.sd-total-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-black);
    gap: 2rem;
}

.sd-total {
    flex: 0 0 auto;
}

.sd-add-to-cart-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: opacity 0.3s ease;
}

.sd-add-to-cart-wrapper.sd-add-to-cart-disabled {
    opacity: 0.2;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sd-dropdowns-row {
        grid-template-columns: 1fr;
    }

    .sd-step-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }

    .sd-lines {
        grid-template-columns: 1fr;
    }

    .sd-total-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .sd-add-to-cart-wrapper {
        width: 100%;
    }
}

/* Loading States */
.sd-loading {
    position: relative;
    filter: blur(2px);
    opacity: 0.7;
    transition:
        filter 0.3s ease,
        opacity 0.3s ease;
    pointer-events: none;
}

.sd-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #333;
    border-radius: 50%;
    animation: sd-spin 1s linear infinite;
    z-index: 10;
}

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

/* Cart & Checkout Configuration Display */
.sd-cart-config-grid {
}

.sd-cart-config-item {
    display: flex;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.sd-cart-config-label {
    font-weight: 600;
}

.sd-cart-config-value {
    font-weight: normal;
}

@media (max-width: 768px) {
    .sd-cart-config-grid {
        grid-template-columns: 1fr;
    }
}

/* Swatch Magnifier */
.sd-swatch-magnifier {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    background-repeat: no-repeat;
    border: 2px solid var(--color-black);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Quote-Only Mode (Non-Purchasable Countries) */
.sd-cta {
    margin-top: 1rem;
}

/* YITH Quote List - Product Name with SKU */
#yith-ywrq-table-list .product-name a {
    display: block;
}

#yith-ywrq-table-list .product-name a span {
    display: block;
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
    font-family: monospace;
    margin-top: 0.25rem;
}

/* Prominent SKU display in YITH quote table */
.sd-dynamic-sku {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: #f8f9fa;
    border-left: 3px solid var(--color-black);
    font-family: monospace;
    font-size: 1rem;
}

/* Quote configuration display styling */
.sd-quote-config {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.sd-quote-config > div {
    margin-bottom: 0.25rem;
}

.sd-quote-config > div:last-child {
    margin-bottom: 0;
}

.sd-quote-config strong {
    font-weight: 600;
    color: var(--color-black);
}
