/**
 * 镜片选择样式
 */

/* 镜片选项容器 */
.lens-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 660px;
    margin: 0 auto;
    padding-right: 4px;
}

/* 加载指示器 */
.lens-recommendation-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 48px 20px;
    color: var(--ep-muted);
    text-align: center;
}

.lens-recommendation-loading p {
    margin: 0;
    font-size: 14px;
}

.ep-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--ep-brand-soft);
    border-top-color: var(--ep-brand);
    border-radius: 50%;
    animation: ep-spin 0.8s linear infinite;
}

/* 无镜片 */
.no-lenses {
    text-align: center;
    padding: 40px 0;
    color: var(--ep-muted);
    font-style: italic;
}

/* 推荐标题 */
.recommendation-header {
    margin: 0 auto 12px;
    max-width: 660px;
}

.recommendation-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--ep-ink);
    padding-left: 12px;
    border-left: 3px solid var(--ep-brand);
    letter-spacing: 0.2px;
}

/* 单个镜片选项 */
.lens-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 2px solid var(--ep-border);
    border-radius: var(--ep-radius);
    padding: 16px;
    transition: all var(--ep-transition);
    cursor: pointer;
    background: var(--ep-surface);
    box-shadow: var(--ep-shadow-sm);
}

.lens-option:hover {
    border-color: var(--ep-brand);
    box-shadow: var(--ep-shadow);
    transform: translateY(-1px);
}

.lens-option.selected {
    border-color: var(--ep-brand);
    background-color: var(--ep-brand-softer);
    box-shadow: inset 3px 0 0 var(--ep-brand), var(--ep-ring);
}

.lens-option.selected:after {
    content: "✓";
    position: absolute;
    top: 12px;
    right: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ep-brand);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

/* 推荐徽章 */
.recommendation-badge {
    position: absolute;
    top: -10px;
    left: 16px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--ep-accent-deep);
    background: var(--ep-accent-soft);
    border: 1px solid var(--ep-accent);
    border-radius: 999px;
}

/* 镜片图片 */
.lens-option-image {
    flex: 0 0 84px;
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ep-radius-sm);
    background: var(--ep-bg);
    overflow: hidden;
}

.lens-option-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.placeholder-image {
    width: 100%;
    height: 100%;
    background-color: var(--ep-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ep-muted);
    font-size: 12px;
}

.placeholder-image:after {
    content: "No Image";
}

/* 镜片信息 */
.lens-option-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.lens-name {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--ep-ink);
    padding-right: 20px;
    letter-spacing: 0.2px;
}

.lens-instruction {
    margin: 0 0 8px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--ep-text);
}

.lens-refractive-index {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--ep-text);
}

.lens-refractive-index span {
    font-weight: 600;
    margin-right: 4px;
    color: var(--ep-ink);
}

/* 星级 */
.lens-rating {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 8px;
}

.lens-rating .star {
    color: var(--ep-border-strong);
    font-size: 16px;
    line-height: 1;
}

.lens-rating .star.filled {
    color: var(--ep-accent);
}

/* 价格 */
.lens-price {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--ep-brand-dark);
}

/* 推荐错误信息 */
.recommendation-error {
    text-align: center;
    padding: 24px;
    color: var(--ep-danger);
    font-size: 14px;
}

/* 加入购物车错误提示 */
.ep-add-to-cart-error {
    flex: 0 0 100%;
    order: -1;
    padding: 8px 12px;
    border-radius: var(--ep-radius-sm);
    background: var(--ep-danger-soft);
    color: #b91c1c;
    font-size: 13px;
    text-align: center;
    box-sizing: border-box;
}

/* 后备镜片列表 */
.fallback-lens-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-recommendation-message {
    text-align: center;
    color: var(--ep-muted);
    font-size: 13px;
    margin: 0 0 8px;
}

/* Step 3: give each lens choice more breathing room. */
#ep-lens-modal .lens-options,
#ep-lens-modal .fallback-lens-options,
.lens-options,
.fallback-lens-options {
    row-gap: 18px;
}
#ep-lens-modal .lens-options > .lens-option,
#ep-lens-modal .fallback-lens-options > .lens-option,
.lens-options > .lens-option,
.fallback-lens-options > .lens-option {
    margin-bottom: 0;
}
@media (max-width: 600px) {
    #ep-lens-modal .lens-options,
    #ep-lens-modal .fallback-lens-options,
    .lens-options,
    .fallback-lens-options { row-gap: 14px; }
}

/* Reliable spacing for dynamically rendered lens cards, regardless of wrapper. */
#step3-lens-selection .lens-option,
#step3-select-lenses .lens-option,
#ep-lens-modal .lens-option,
.lens-options .lens-option,
.fallback-lens-options .lens-option {
    margin-top: 0 !important;
    margin-bottom: 16px !important;
}
#step3-lens-selection .lens-option:last-child,
#step3-select-lenses .lens-option:last-child,
#ep-lens-modal .lens-option:last-child,
.lens-options .lens-option:last-child,
.fallback-lens-options .lens-option:last-child {
    margin-bottom: 0 !important;
}
@media (max-width: 600px) {
    #ep-lens-modal .lens-option,
    .lens-options .lens-option,
    .fallback-lens-options .lens-option {
        margin-bottom: 14px !important;
    }
}
