/* ==========================================================================
   HL Custom Addons — Frontend Product Page Styles
   All selectors nested under .hlca-wrap for theme-proof specificity
   ========================================================================== */

/* --- Reset: prevent theme from styling our elements --- */
.hlca-wrap,
.hlca-wrap *,
.hlca-wrap *::before,
.hlca-wrap *::after {
    box-sizing: border-box;
}

.hlca-wrap {
    margin: 20px 0;
    padding: 0;
}

.hlca-wrap .hlca-form-group {
    margin-bottom: 10px;
}

/* Field */
.hlca-wrap .hlca-field {
    margin-bottom: 18px;
}

.hlca-wrap .hlca-field__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.hlca-wrap .hlca-required {
    color: #e74c3c;
    margin-left: 2px;
}

.hlca-wrap .hlca-selected-label {
    font-weight: 400;
    color: var(--hlca-label-color, var(--hlca-accent, #666));
}

/* ==========================================================================
   BUTTON SWATCH — Base
   ========================================================================== */
.hlca-wrap .hlca-swatch-group--button {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding: 6px 0;
}

.hlca-wrap .hlca-swatch--button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    height: var(--hlca-size, auto);
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
    line-height: 1.4;
    position: relative;
    overflow: hidden;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    text-decoration: none;
    outline: none;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.hlca-wrap .hlca-swatch--button:hover {
    border-color: var(--hlca-accent, #2eaa56);
    color: var(--hlca-accent, #2eaa56);
    background: #fff;
}

.hlca-wrap .hlca-swatch--button.active {
    border-color: var(--hlca-accent, #2eaa56);
    background: #fff;
    color: var(--hlca-accent, #2eaa56);
    font-weight: 600;
}

/* Corner triangle fold */
.hlca-wrap .hlca-swatch--button.active::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 24px 24px 0;
    border-color: transparent var(--hlca-accent, #2eaa56) transparent transparent;
    z-index: 1;
}

/* Checkmark on the triangle */
.hlca-wrap .hlca-swatch--button.active::before {
    content: '';
    position: absolute;
    top: 3px;
    right: 2px;
    width: 10px;
    height: 10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / contain no-repeat;
    z-index: 2;
}

/* --- Button Style: Pill / Default (circle) --- */
.hlca-wrap .hlca-swatch-group--pill .hlca-swatch--button,
.hlca-wrap .hlca-swatch-group--default .hlca-swatch--button {
    width: var(--hlca-size, 48px);
    height: var(--hlca-size, 48px);
    min-width: var(--hlca-size, 48px);
    padding: 0;
    border-radius: 50%;
}

.hlca-wrap .hlca-swatch-group--pill .hlca-swatch--button.active,
.hlca-wrap .hlca-swatch-group--default .hlca-swatch--button.active {
    background: var(--hlca-accent, #2eaa56);
    color: #fff;
}

.hlca-wrap .hlca-swatch-group--pill .hlca-swatch--button.active::after,
.hlca-wrap .hlca-swatch-group--default .hlca-swatch--button.active::after {
    border-color: transparent #fff transparent transparent;
}

.hlca-wrap .hlca-swatch-group--pill .hlca-swatch--button.active::before,
.hlca-wrap .hlca-swatch-group--default .hlca-swatch--button.active::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232eaa56' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
}

/* --- Button Style: Chip (Apple Store) --- */
.hlca-wrap .hlca-swatch-group--chip .hlca-swatch--button {
    border-radius: 10px;
    border: 1px solid #d2d2d7;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 400;
    color: #1d1d1f;
    background: #fff;
}

.hlca-wrap .hlca-swatch-group--chip .hlca-swatch--button:hover {
    border-color: #0071e3;
    color: #0071e3;
}

.hlca-wrap .hlca-swatch-group--chip .hlca-swatch--button.active {
    border-color: #0071e3;
    background: #fff;
    color: #0071e3;
    box-shadow: 0 0 0 1px #0071e3;
    font-weight: 600;
}

.hlca-wrap .hlca-swatch-group--chip .hlca-swatch--button.active::after {
    border-color: transparent #0071e3 transparent transparent;
}

/* --- Button Style: Outline --- */
.hlca-wrap .hlca-swatch-group--outline .hlca-swatch--button {
    border-radius: 4px;
    border: 1px solid #ccc;
    font-weight: 400;
    padding: 8px 18px;
    background: transparent;
}

.hlca-wrap .hlca-swatch-group--outline .hlca-swatch--button:hover {
    border-color: var(--hlca-accent, #2eaa56);
    color: var(--hlca-accent, #2eaa56);
}

.hlca-wrap .hlca-swatch-group--outline .hlca-swatch--button.active {
    border-color: var(--hlca-accent, #2eaa56);
    color: var(--hlca-accent, #2eaa56);
    background: transparent;
    box-shadow: none;
    font-weight: 600;
    border-width: 2px;
}

.hlca-wrap .hlca-price-badge {
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
    opacity: .8;
}

/* ==========================================================================
   COLOR SWATCH — Base
   ========================================================================== */
.hlca-wrap .hlca-swatch-group--color {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hlca-wrap .hlca-swatch--color {
    width: var(--hlca-size, 36px);
    height: var(--hlca-size, 36px);
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all .2s ease;
    position: relative;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
    min-width: 0;
    min-height: 0;
    display: inline-block;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    text-decoration: none;
    margin: 0;
    line-height: 0;
    font-size: 0;
    background: none;
}

.hlca-wrap .hlca-swatch--color:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.hlca-wrap .hlca-swatch--color.active {
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: none;
    outline: 2px solid var(--hlca-accent, #2eaa56);
    outline-offset: 3px;
}

.hlca-wrap .hlca-swatch--color.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 5px;
    border: solid #fff;
    border-width: 0 0 2.5px 2.5px;
    transform: translate(-50%, -65%) rotate(-45deg);
    display: block;
}

.hlca-wrap .hlca-swatch--color .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Color Style: Square --- */
.hlca-wrap .hlca-swatch-group--square .hlca-swatch--color {
    border-radius: 6px;
    width: var(--hlca-size, 40px);
    height: var(--hlca-size, 40px);
}

.hlca-wrap .hlca-swatch-group--square .hlca-swatch--color.active {
    outline: 2px solid var(--hlca-accent, #2eaa56);
    outline-offset: 3px;
    box-shadow: none;
}

/* --- Color Style: Circle + Label --- */
.hlca-wrap .hlca-swatch-group--circle-label {
    gap: 16px;
}

.hlca-wrap .hlca-swatch-group--circle-label .hlca-color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.hlca-wrap .hlca-swatch-group--circle-label .hlca-swatch--color {
    width: var(--hlca-size, 32px);
    height: var(--hlca-size, 32px);
}

.hlca-wrap .hlca-swatch-group--circle-label .hlca-color-label {
    font-size: 11px;
    color: #666;
    text-align: center;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hlca-wrap .hlca-swatch-group--circle-label .hlca-swatch--color.active + .hlca-color-label {
    color: var(--hlca-accent, #2eaa56);
    font-weight: 600;
}

/* ==========================================================================
   TEXT INPUT — Base
   ========================================================================== */
.hlca-wrap .hlca-text-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all .2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
    background: #fff;
}

.hlca-wrap .hlca-text-input:focus {
    border-color: #2eaa56;
    outline: none;
    box-shadow: 0 0 0 2px rgba(46, 170, 86, .1);
}

/* --- Text Style: Underline --- */
.hlca-wrap .hlca-text-input--underline {
    border: none;
    border-bottom: 2px solid #ddd;
    border-radius: 0;
    padding: 10px 4px;
    background: transparent;
}

.hlca-wrap .hlca-text-input--underline:focus {
    border-color: #2eaa56;
    box-shadow: none;
}

.hlca-wrap .hlca-price-note {
    display: inline-block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

/* ==========================================================================
   Validation
   ========================================================================== */
.hlca-wrap .hlca-field__error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
}

.hlca-wrap .hlca-field.hlca-field--invalid .hlca-swatch--button {
    border-color: #f5c6cb;
}

.hlca-wrap .hlca-field.hlca-field--invalid .hlca-swatch--color {
    box-shadow: 0 0 0 2px #f5c6cb;
}

.hlca-wrap .hlca-field.hlca-field--invalid .hlca-text-input {
    border-color: #e74c3c;
}

/* ==========================================================================
   Cart color preview
   ========================================================================== */
.hlca-cart-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 4px;
    border: 1px solid #ccc;
}

/* ==========================================================================
   IMAGE SWATCH — Base
   ========================================================================== */
.hlca-wrap .hlca-swatch-group--image {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hlca-wrap .hlca-image-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.hlca-wrap .hlca-swatch--image {
    display: block;
    cursor: pointer;
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    outline: none;
    text-decoration: none;
}

.hlca-wrap .hlca-image-wrap {
    display: block;
    position: relative;
    overflow: hidden;
    width: var(--hlca-size, 80px);
    height: var(--hlca-size, 80px);
    border: 2px solid transparent;
    transition: all .2s ease;
}

.hlca-wrap .hlca-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    padding: 0;
}

/* Active state — border only */
.hlca-wrap .hlca-swatch--image.active .hlca-image-wrap {
    border-color: var(--hlca-accent, #2649ff);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Hover */
.hlca-wrap .hlca-swatch--image:hover .hlca-image-wrap {
    border-color: var(--hlca-accent, #2649ff);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* Image label */
.hlca-wrap .hlca-image-label {
    font-size: 12px;
    color: #555;
    text-align: center;
    max-width: var(--hlca-size, 80px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hlca-wrap .hlca-swatch--image.active + .hlca-image-label {
    color: var(--hlca-accent, #2649ff);
    font-weight: 600;
}

/* --- Image Style: Squircle (default — rounded corners) --- */
.hlca-wrap .hlca-swatch-group--squircle .hlca-image-wrap {
    border-radius: 8px;
}

/* --- Image Style: Circle --- */
.hlca-wrap .hlca-swatch-group--circle .hlca-image-wrap {
    border-radius: 50%;
}

/* --- Image Style: Square --- */
.hlca-wrap .hlca-swatch-group--square .hlca-image-wrap {
    border-radius: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 480px) {
    .hlca-wrap .hlca-text-input {
        max-width: 100%;
    }
}
