/**
 * MH Product Personalization - Frontend Styles (Phase 4)
 * @package MH_Personalization
 */

/* ── Section ───────────────────────────────────────── */

.mh-pers-section {
    margin: 1.5em 0;
    padding: 1.5em;
    background: #fafaf8;
    border: 1px solid #e8e6e1;
    border-radius: 8px;
}

.mh-pers-section__header {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 1.25em;
    padding-bottom: 0.75em;
    border-bottom: 1px solid #e8e6e1;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #3a3a3a;
}

.mh-pers-section__icon { font-size: 1.1em; }

.mh-pers-section__body {
    display: flex;
    flex-direction: column;
    gap: 1.25em;
}

.mh-pers-section__form { width: 100%; }
.mh-pers-section__preview { width: 100%; }

/* ── Fields ────────────────────────────────────────── */

.mh-pers-field {
    margin-bottom: 1.25em;
    transition: opacity 0.2s ease;
}

.mh-pers-field__label {
    display: block;
    margin-bottom: 0.5em;
    font-size: 0.9em;
    font-weight: 500;
    color: #444;
}

.mh-pers-field__required { color: #c9302c; }

/* ── Text Input ────────────────────────────────────── */

.mh-pers-field__text-input {
    display: block;
    width: 100%;
    padding: 0.65em 0.75em;
    border: 1px solid #d0cec9;
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
    background: #fff;
    color: #333;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.mh-pers-field__text-input:focus {
    outline: none;
    border-color: #c9a96e;
    box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.15);
}

.mh-pers-field__char-count {
    display: block;
    margin-top: 0.25em;
    font-size: 0.78em;
    color: #999;
    text-align: right;
    transition: color 0.15s ease;
}

.mh-pers-field__char-count--limit {
    color: #c9302c;
    font-weight: 600;
}

/* ── Image Select ──────────────────────────────────── */

.mh-pers-field__image-select {
    display: flex;
    gap: 0.75em;
    flex-wrap: wrap;
}

.mh-pers-image-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35em;
    cursor: pointer;
    padding: 0.5em;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: border-color 0.15s ease;
    text-align: center;
    min-width: 72px;
}

.mh-pers-image-option:hover { border-color: #d0cec9; }

.mh-pers-image-option__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mh-pers-image-option__input:checked + .mh-pers-image-option__visual {
    box-shadow: 0 0 0 2px #c9a96e;
}

.mh-pers-image-option__input:checked ~ .mh-pers-image-option__label {
    font-weight: 600;
}

.mh-pers-image-option__input:focus-visible + .mh-pers-image-option__visual {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

.mh-pers-image-option__visual {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: 1px solid #e0ddd8;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.15s ease;
}

.mh-pers-image-option__visual img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mh-pers-image-option__label {
    font-size: 0.78em;
    color: #555;
    line-height: 1.2;
}

.mh-pers-image-option__price {
    font-size: 0.72em;
    color: #888;
}

/* ── Color Swatches ────────────────────────────────── */

.mh-pers-field__color-swatches {
    display: flex;
    gap: 0.65em;
    flex-wrap: wrap;
}

.mh-pers-swatch {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3em;
    cursor: pointer;
}

.mh-pers-swatch__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.mh-pers-swatch__circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mh-pers-swatch--bordered .mh-pers-swatch__circle {
    border-color: #d0cec9;
}

.mh-pers-swatch__input:checked + .mh-pers-swatch__circle {
    border-color: #c9a96e;
    box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.3);
}

.mh-pers-swatch__input:focus-visible + .mh-pers-swatch__circle {
    outline: 2px solid #4a90d9;
    outline-offset: 2px;
}

.mh-pers-swatch__label {
    font-size: 0.72em;
    color: #777;
}

/* ── Dropdown ──────────────────────────────────────── */

.mh-pers-field__dropdown {
    display: block;
    width: 100%;
    padding: 0.6em 2em 0.6em 0.75em;
    border: 1px solid #d0cec9;
    border-radius: 4px;
    font-size: 0.95em;
    font-family: inherit;
    background: #fff;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75em center;
    cursor: pointer;
}

.mh-pers-field__dropdown:focus {
    outline: none;
    border-color: #c9a96e;
    box-shadow: 0 0 0 2px rgba(201, 169, 110, 0.15);
}

/* ── Surcharge ─────────────────────────────────────── */

.mh-pers-surcharge {
    margin-top: 1em;
    padding: 0.75em;
    background: #f0ede6;
    border-radius: 4px;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mh-pers-surcharge__label { color: #555; }
.mh-pers-surcharge__amount { font-weight: 600; color: #333; }

/* ── Preview ───────────────────────────────────────── */

.mh-pers-preview {
    background: #fff;
    border: 1px solid #e8e6e1;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.mh-pers-preview__label {
    padding: 0.5em 0.75em;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #999;
    border-bottom: 1px solid #f0ede6;
}

.mh-pers-preview__canvas {
    display: block;
    width: 100%;
    max-width: 400px;
    height: auto;
    margin: 0 auto;
    padding: 0.75em;
    box-sizing: border-box;
}

/* ── Accordion (collapsed mode) ─────────────────────── */

.mh-pers-section__header--toggle {
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    transition: background-color 0.15s ease;
    margin: -1.5em -1.5em 0;
    padding: 1em 1.5em;
    border-radius: 8px;
}

.mh-pers-section--collapsed .mh-pers-section__header--toggle {
    margin-bottom: 0;
    padding-bottom: 1em;
    border-bottom: none;
}

.mh-pers-section__header--toggle:hover {
    background: rgba(201, 169, 110, 0.06);
}

.mh-pers-section__chevron {
    font-size: 0.65em;
    color: #bbb;
    transition: transform 0.2s ease;
}

/* ── Reset Button ──────────────────────────────────── */

.mh-pers-reset {
    display: block;
    width: 100%;
    padding: 0.6em 1em;
    margin-top: 0.25em;
    background: none;
    border: 1px solid #d0cec9;
    border-radius: 4px;
    font-size: 0.82em;
    font-family: inherit;
    color: #888;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    text-align: center;
}

.mh-pers-reset:hover {
    color: #555;
    border-color: #bbb;
}

/* ── Validation Errors ─────────────────────────────── */

.mh-pers-field--error .mh-pers-field__text-input,
.mh-pers-field--error .mh-pers-field__dropdown {
    border-color: #c9302c;
}

.mh-pers-field--error .mh-pers-field__label { color: #c9302c; }

.mh-pers-field__error {
    display: block;
    margin-top: 0.25em;
    margin-bottom: 0.5em;
    font-size: 0.82em;
    color: #c9302c;
}

/* ── Price Note ────────────────────────────────────── */

.mh-pers-price-note {
    font-size: 0.85em;
    color: #888;
    margin-top: 0.25em;
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 480px) {
    .mh-pers-section { padding: 1em; }
    .mh-pers-preview__canvas { max-width: 100%; }
    .mh-pers-field__image-select { gap: 0.5em; }
}
