/**
 * 추가 옵션 시스템 전용 CSS
 * 
 * Wall Street 프로페셔널 스타일 기반
 * 정숙한 사무실 분위기의 기품있는 디자인
 * 
 * @version 1.0
 * @date 2025-01-08
 */

/* ================================
   옵션 섹션 기본 스타일 (초컴팩트 테이블형)
   ================================ */

/* ================================
   2x2+1 그리드 레이아웃 시스템
   ================================ */

.form-row {
    display: flex;
    gap: 10px; /* 4개 옵션이므로 간격을 좁게 */
    margin-bottom: 8px;
    align-items: center;
}

.form-row .option-group {
    flex: 1;
    min-width: 0; /* 텍스트 오버플로우 방지 */
}

/* 4그리드 레이아웃 전용 스타일 */
.form-row.four-grid {
    gap: 8px; /* 4개가 들어가므로 더 좁은 간격 */
}

.form-row.four-grid .option-group {
    flex: 1;
    min-width: 120px; /* 최소 너비 보장 */
}

.form-row.four-grid .option-label {
    font-size: 13px; /* 4그리드에서는 라벨을 약간 작게 */
    min-width: 45px; /* 라벨 너비를 줄여서 공간 확보 */
}

.form-row.four-grid .option-select {
    font-size: 13px; /* 4그리드에서는 셀렉트도 약간 작게 */
    padding: 3px 6px; /* 패딩도 줄여서 공간 확보 */
}

/* 마지막 줄 (편집디자인)은 전체 너비 사용 */
.form-row.full-width .option-group {
    flex: none;
    width: 100%;
}

/* 2x2 그리드 내에서의 라벨-셀렉트 정렬 */
.form-row .form-group-horizontal {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.form-row .option-label {
    flex-shrink: 0;
    min-width: 60px;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
}

.form-row .option-select {
    flex: 1;
    min-width: 120px;
    padding: 4px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 14px;
}

.additional-options-section {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 3px 6px;
    margin: 3px 0;
    box-shadow: none;
}

/* 한 줄 체크박스 헤더 (테이블형) */
.option-headers-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 8px;
    margin-bottom: 2px;
    padding: 1px 0;
}

.option-checkbox-group {
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: auto;
}

.option-price-display {
    margin-left: auto;
    flex-shrink: 0;
}

.option-price-total {
    color: #1E4E79;
    font-weight: 500;
    font-size: 14px;
}

/* ================================
   체크박스 및 라벨 스타일 (컴팩트)
   ================================ */

/* ================================
   체크박스 스타일 (정숙한 사무실 분위기)
   ================================ */

.option-toggle {
    width: 12px;
    height: 12px;
    accent-color: #4299e1;
    cursor: pointer;
    margin: 0;
}

.toggle-label {
    color: #2d3748;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    padding: 0;
    line-height: 1.1;
}

.toggle-label:hover {
    color: #4299e1;
}

/* ================================
   옵션 세부 선택 영역 (컴팩트)
   ================================ */

.option-details {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 0;
    margin: 1px 0;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.option-details.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.option-details.hide {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding: 0 10px;
    }
    to {
        opacity: 1;
        max-height: 100px;
        padding: 10px;
    }
}

/* ================================
   셀렉트 박스 스타일
   ================================ */

.option-details .option-select {
    width: 100%;
    max-width: 100%;
    padding: 3px 6px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    background: #ffffff;
    color: #2d3748;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    line-height: 1.1;
    margin: 0;
    box-sizing: border-box;
}

.option-details .option-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.option-details .option-select:hover {
    border-color: #a0aec0;
}

/* 양식지 전용 셀렉트 크기 조정 */
.ncrflambeau-page .option-details .option-select {
    width: 90%;
}

/* ================================
   가격 표시 통합 스타일
   ================================ */

.price-display.has-options {
    border-top: 2px solid #e2e8f0;
    padding-top: 15px;
}

.price-breakdown .additional-options-row {
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 4px;
    padding: 8px;
    margin: 5px 0;
}

.additional-options-row .price-item-label {
    color: #1E4E79;
    font-weight: 500;
}

.additional-options-row .price-item-value {
    color: #1E4E79;
    font-weight: 500;
}

/* ================================
   반응형 디자인 (모바일 대응)
   ================================ */

@media (max-width: 768px) {
    /* 옵션 체크박스 한 줄 표시 (코팅/접지/오시 등) - 구체적 선택자로 우선순위 확보 */
    .product-calculator .leaflet-premium-options-section .option-headers-row,
    .product-calculator .premium-options-section .option-headers-row,
    .product-calculator .additional-options-section .option-headers-row,
    .inline-form-container .option-headers-row,
    div.option-headers-row {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        gap: 6px 15px;
    }

    .product-calculator .leaflet-premium-options-section .option-checkbox-group,
    .product-calculator .premium-options-section .option-checkbox-group,
    .product-calculator .additional-options-section .option-checkbox-group,
    .inline-form-container .option-checkbox-group,
    div.option-checkbox-group {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        gap: 4px;
        flex-shrink: 0;
    }

    .option-price-display {
        margin-left: auto;
        flex-shrink: 0;
    }

    .option-details {
        margin: 5px 0;
        padding: 6px;
    }

    .option-toggle {
        width: 14px;
        height: 14px;
    }

    .toggle-label {
        font-size: 12px;
        white-space: nowrap;
    }
}

/* ================================
   로딩 상태 스타일
   ================================ */

.option-details.loading {
    opacity: 0.6;
    pointer-events: none;
}

.option-details.loading::after {
    content: "계산 중...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    color: #4a5568;
}

/* ================================
   오류 상태 스타일
   ================================ */

.option-group.error .option-details {
    border: none;
    background: transparent;
}

.option-group.error .option-select {
    border-color: #fc8181;
    background: #fff5f5;
}

.option-group.error .toggle-label {
    color: #e53e3e;
}

.option-error-message {
    color: #e53e3e;
    font-size: 14px;
    margin-top: 5px;
    margin-left: 28px;
    font-style: italic;
}