/**
 * ACVW frontend component styles (swatches, add-to-cart, messages).
 */

/* Color Variation widget */
.acvw-color-variation {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.acvw-selected-name-wrap {
    font-size: 14px;
    color: #444;
}

.acvw-selected-name {
    font-weight: 600;
}

.acvw-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.acvw-layout-vertical .acvw-swatches {
    flex-direction: column;
    flex-wrap: nowrap;
}

.acvw-swatch-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.acvw-swatch {
    position: relative;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 2px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.acvw-shape-circle {
    border-radius: 50%;
}

.acvw-shape-square {
    border-radius: 4px;
}

.acvw-swatch-color {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.acvw-swatch:hover {
    border-color: #7952b3;
    transform: scale(1.1);
}

.acvw-swatch.is-selected {
    border-color: #7952b3;
    border-width: 3px;
    box-shadow: 0 0 0 2px rgba(121, 82, 179, 0.25);
}

.acvw-swatch.is-unavailable {
    cursor: not-allowed;
}

.acvw-swatch.is-unavailable .acvw-swatch-color {
    opacity: 0.35;
    filter: grayscale(1);
}

.acvw-swatch-unavailable-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: 700;
    color: #c0392b;
    line-height: 1;
    pointer-events: none;
}

.acvw-swatch-label {
    font-size: 12px;
    color: #666;
    text-align: center;
}

.acvw-other-attributes {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.acvw-other-attribute {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 260px;
}

.acvw-other-attribute-label {
    font-size: 13px;
    color: #444;
    font-weight: 500;
}

.acvw-other-attribute-select {
    padding: 8px 10px;
    border: 1px solid #d3d3d3;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    min-width: 160px;
}

.acvw-variation-error {
    font-size: 13px;
    color: #c62828;
}

/* Add to Cart widget */
.acvw-add-to-cart {
    display: flex;
    flex-direction: column;
}

.acvw-add-to-cart-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.acvw-add-to-cart.acvw-btn-full-width .acvw-add-to-cart-inner {
    width: 100%;
}

.acvw-add-to-cart.acvw-btn-full-width .acvw-add-to-cart-btn {
    flex-grow: 1;
}

.acvw-quantity-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.acvw-quantity-label {
    font-size: 14px;
    color: #444;
}

.acvw-quantity-input {
    width: 64px;
    padding: 8px 10px;
    border: 1px solid #d3d3d3;
    border-radius: 4px;
    font-size: 14px;
}

.acvw-add-to-cart-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 24px;
    background-color: #7f54b3;
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    line-height: 1.2;
}

.acvw-add-to-cart-btn:hover:not(:disabled) {
    background-color: #6b46a1;
    color: #fff;
}

.acvw-add-to-cart-btn:focus-visible {
    outline: 2px solid #7f54b3;
    outline-offset: 2px;
}

.acvw-add-to-cart-btn:disabled {
    background-color: #cccccc;
    color: #888;
    cursor: not-allowed;
}

/* View Cart button transformed state */
.acvw-add-to-cart-btn.acvw-view-cart-btn {
    background-color: #2e7d32 !important;
}
.acvw-add-to-cart-btn.acvw-view-cart-btn:hover {
    background-color: #1b5e20 !important;
}

.acvw-btn-size-sm {
    padding: 8px 18px;
    font-size: 13px;
}

.acvw-btn-size-md {
    padding: 12px 24px;
    font-size: 15px;
}

.acvw-btn-size-lg {
    padding: 16px 32px;
    font-size: 17px;
}

.acvw-btn-size-xl {
    padding: 20px 40px;
    font-size: 19px;
}

.acvw-cart-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.acvw-btn-icon-left {
    margin-right: 10px;
}

.acvw-btn-icon-right {
    margin-left: 10px;
}

.acvw-cart-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    margin-left: 10px;
    background-color: #ff6900;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 20px;
}

.acvw-cart-spinner {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.acvw-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(127, 84, 179, 0.3);
    border-top-color: #7f54b3;
    border-radius: 50%;
    animation: acvw-spin 0.7s linear infinite;
}

@keyframes acvw-spin {
    to {
        transform: rotate(360deg);
    }
}

.acvw-cart-message {
    font-size: 14px;
    font-weight: 500;
    width: 100%;
}

.acvw-cart-message.is-success {
    color: #2e7d32;
}

.acvw-cart-message.is-error {
    color: #c62828;
}

/* Responsive */
@media (max-width: 767px) {
    .acvw-add-to-cart-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .acvw-quantity-wrap {
        justify-content: space-between;
    }

    .acvw-swatch {
        width: 32px;
        height: 32px;
    }

    .acvw-layout-vertical .acvw-swatches {
        flex-direction: row;
        flex-wrap: wrap;
    }
}