/**
 * BNC 책자 인쇄 계산기 CSS
 * v4.1.2 - 포스터/전단 스타일 통일 (여백 정리)
 */

/* ========================================
   전체 컨테이너 - 포스터와 동일하게
   ======================================== */
.bnc-booklet-calculator {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin: 0 0 20px 0;
    border: none;
    max-width: 1200px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 'Noto Sans KR', sans-serif;
    font-size: 14px;
}

/* ========================================
   섹션 - 회색 바탕 (포스터/전단과 통일)
   ======================================== */
.bnc-section {
    background: #efefef;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
}

.bnc-section-compact {
    padding: 12px 15px;
}

/* 섹션 제목 - 회색 바탕 흰색 글자 (표지/내지 사양) */
.bnc-section-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 14px 0;
    padding: 12px 14px;
    background: #9fa0a0;
    border-radius: 6px;
    text-align: center;
    color: #fff;
}

/* ========================================
   가로형 레이아웃
   ======================================== */
.bnc-horizontal-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.bnc-horizontal-row label {
    min-width: 70px;
    font-weight: 500;
    color: #555;
    font-size: 13px;
}

.bnc-horizontal-row select,
.bnc-horizontal-row input {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    min-width: 100px;
}

.bnc-horizontal-row select:focus,
.bnc-horizontal-row input:focus {
    border-color: #2271b1;
    outline: none;
}

/* 인라인 필드 그룹 */
.bnc-inline-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bnc-inline-group select {
    min-width: 90px;
}

/* ========================================
   접기 (Collapsible) UI
   ======================================== */
.bnc-collapsible {
    padding: 0;
    overflow: hidden;
}

.bnc-collapsible-header {
    display: flex;
    align-items: center;
    padding: 14px 15px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.bnc-collapsible-header:hover {
    background: #f5f5f5;
}

.bnc-toggle-icon {
    font-size: 11px;
    margin-right: 10px;
    transition: transform 0.2s;
    color: #666;
}

.bnc-collapsible.open .bnc-toggle-icon,
.bnc-collapsible-header.open .bnc-toggle-icon {
    transform: rotate(90deg);
}

.bnc-collapsible-title {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.bnc-collapsible-summary {
    margin-left: auto;
    font-size: 13px;
    color: #888;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 12px;
}

.bnc-collapsible-content {
    display: none;
    padding: 0 15px 15px 15px;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.bnc-collapsible.open .bnc-collapsible-content,
.bnc-collapsible-content.open {
    display: block;
}

/* ========================================
   필드 그룹 / 행
   ======================================== */
.bnc-field-group {
    margin-bottom: 14px;
}

.bnc-field-group:last-child {
    margin-bottom: 0;
}

.bnc-field-group > label,
.bnc-field > label,
.bnc-collapsible-content label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.bnc-row {
    display: flex;
    gap: 10px;
}

.bnc-row-2 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
}

.bnc-row-1 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
}

.bnc-row-3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
}

.bnc-field {
    flex: 1;
}

/* 필드 힌트 (제본 안내 등) */
.bnc-field-hint {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #d32f2f;
}

.bnc-field-hint.bnc-warning {
    font-weight: bold;
    animation: bncWarningPulse 0.3s ease-in-out 2;
}

@keyframes bncWarningPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   입력 요소
   ======================================== */
.bnc-booklet-calculator select,
.bnc-booklet-calculator input[type="number"] {
    width: 100%;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 0 32px 0 14px !important;
    margin: 0 !important;
    border: 1px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    line-height: 42px !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px 12px !important;
    cursor: pointer;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    -webkit-border-radius: 6px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.bnc-booklet-calculator input[type="number"] {
    padding: 0 14px !important;
    background-image: none !important;
}

/* Firefox select 높이 수정 */
@-moz-document url-prefix() {
    .bnc-booklet-calculator select {
        padding-top: 11px !important;
        padding-bottom: 11px !important;
        line-height: normal !important;
    }
}

/* Safari specific fix */
@media not all and (min-resolution:.001dpcm) { 
    @supports (-webkit-appearance:none) {
        .bnc-booklet-calculator select {
            height: 44px !important;
            line-height: 44px !important;
            padding-top: 0 !important;
            padding-bottom: 0 !important;
        }
    }
}

.bnc-booklet-calculator select:hover {
    border-color: #aaa !important;
}

.bnc-booklet-calculator select:focus,
.bnc-booklet-calculator input[type="number"]:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15) !important;
}

.bnc-booklet-calculator select:disabled,
.bnc-booklet-calculator input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* ========================================
   페이지 입력
   ======================================== */
.bnc-page-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.bnc-page-input-wrap input[type="number"] {
    width: 100px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

.bnc-page-hint {
    font-size: 13px;
    color: #888;
}

.bnc-total-pages {
    font-size: 14px;
    color: #1565c0;
}

.bnc-total-pages strong {
    font-weight: 700;
    font-size: 16px;
}

/* ========================================
   가격 표시
   ======================================== */
.bnc-price-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    overflow: hidden;
    color: #fff;
}

.bnc-price-header {
    padding: 18px 24px;
}

/* hover 시에도 배경 유지 */
.bnc-price-display .bnc-collapsible-header:hover {
    background: transparent !important;
}

.bnc-price-header .bnc-toggle-icon {
    color: rgba(255,255,255,0.8);
}

.bnc-price-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
    /* 총 합계 라인을 한 줄로 유지 (총합계 + 금액 + (공급가/부가세)) */
    flex-wrap: nowrap;
}

.bnc-total-label {
    font-size: 16px;
    opacity: 0.9;
    font-weight: 400;
    white-space: nowrap;
}

.bnc-total-amount {
    font-size: 23px;
    font-weight: 700;
    white-space: nowrap;
}

.bnc-total-unit {
    font-size: 18px;
    opacity: 0.9;
    font-weight: 400;
    white-space: nowrap;
}

.bnc-vat-info {
    /* 기존에는 width:100%로 강제 줄바꿈 되었음 → 한 줄 표시 */
    font-size: 12px;
    opacity: 0.8;
    width: auto;
    margin-top: 0;
    white-space: nowrap;
}

/* 가격 세부내역 */
.bnc-price-display .bnc-collapsible-content {
    background: rgba(0,0,0,0.15);
    border-top: 1px solid rgba(255,255,255,0.15);
    padding: 18px 24px;
}

.bnc-price-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bnc-price-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    opacity: 0.95;
}

/* 예상 무게 */
.bnc-weight-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: rgba(0,0,0,0.2);
    font-size: 14px;
}

.bnc-weight-icon {
    font-size: 18px;
}

.bnc-weight-label {
    opacity: 0.85;
}

.bnc-weight-value {
    margin-left: auto;
}

/* ========================================
   Coming Soon
   ======================================== */
.bnc-coming-soon {
    text-align: center;
    padding: 14px;
    background: #fff3cd;
    border-radius: 6px;
    color: #856404;
    font-size: 13px;
    margin-top: 14px;
}

/* ========================================
   반응형
   ======================================== */
@media (max-width: 480px) {
    .bnc-booklet-calculator {
        padding: 0;
        font-size: 14px;
    }
    
    .bnc-total-amount {
        font-size: 23px;
    }
    
    .bnc-page-input-wrap {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .bnc-booklet-calculator select,
    .bnc-booklet-calculator input[type="number"] {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* 에러 상태 */
.bnc-field-hint.bnc-error {
    color: #d32f2f;
    background: #ffebee;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 3px solid #d32f2f;
}

.bnc-input-error {
    border-color: #d32f2f !important;
    background: #fff5f5 !important;
}

/* 비활성화된 옵션 */
.bnc-booklet-calculator select option:disabled {
    color: #999;
    background: #f5f5f5;
}

/* 제본 정보 영역 */
.bnc-binding-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

/* 책등 두께 표시 */
.bnc-spine-thickness {
    color: #d32f2f;
    font-weight: 600;
    font-size: 15px;
}

.bnc-spine-thickness strong {
    font-size: 18px;
}

/* 중철 제본 두께 경고 */
.bnc-saddle-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 10px;
    color: #856404;
    font-size: 13px;
    line-height: 1.5;
}

.bnc-saddle-warning strong {
    color: #d32f2f;
}
