/* ====================================================
   큐브 기댓값 계산기 스타일
   ==================================================== */

.cube-calc-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 20px 80px;
}

/* ===== 헤더 ===== */
.cube-calc-header {
    text-align: center;
    margin-bottom: 26px;
}
.cube-calc-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #3C3744;
    margin: 0 0 8px;
}
.cube-calc-sub {
    color: #555;
    font-size: 14px;
    margin: 0 0 6px;
}
.cube-calc-hint {
    color: #888;
    font-size: 12px;
    margin: 0;
}

/* ===== 모드 토글 ===== */
.mode-toggle {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 0 0 22px;
}
.mode-toggle-btn {
    padding: 8px 30px;
    border: 2px solid #ccd3e0;
    border-radius: 24px;
    background: #fff;
    font-size: 14px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.mode-toggle-btn:hover {
    border-color: #3C3744;
    color: #3C3744;
    background: #f7f8fb;
}
.mode-toggle-btn.active {
    background: #3C3744;
    border-color: #3C3744;
    color: #fff;
}

/* ===== 입력 영역 ===== */
.input-card {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    padding: 22px 24px;
    margin-bottom: 20px;
}
.field-group {
    margin-bottom: 18px;
}
.field-group:last-child { margin-bottom: 0; }
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #3C3744;
    margin-bottom: 8px;
}
.field-hint {
    font-size: 11px;
    color: #888;
    margin: 4px 0 0;
}
.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* 큐브 선택 탭 */
.cube-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cube-tab {
    padding: 8px 16px;
    border: 2px solid #e6e8ef;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.cube-tab .cube-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cube-color, #aaa);
}
.cube-tab:hover {
    border-color: #3C3744;
    color: #3C3744;
}
.cube-tab.active {
    border-color: var(--cube-color, #3C3744);
    background: var(--cube-color, #3C3744);
    color: #fff;
}
.cube-tab.active .cube-dot {
    background: #fff;
}

/* 셀렉트/인풋 */
.cube-calc-container select,
.cube-calc-container input[type="number"],
.cube-calc-container input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccd3e0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #3C3744;
    box-sizing: border-box;
}
.cube-calc-container select:focus,
.cube-calc-container input:focus {
    outline: none;
    border-color: #3C3744;
}

/* 가격 입력 (단위 표시) */
.price-input-wrap {
    position: relative;
}
.price-input-wrap input {
    padding-right: 48px;
}
.price-input-wrap .price-unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #aab0c0;
    font-weight: 600;
    pointer-events: none;
}

/* 시뮬레이션 횟수 버튼 */
.sim-count-bar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.sim-count-btn {
    padding: 6px 16px;
    border: 1px solid #ccd3e0;
    border-radius: 16px;
    background: #fff;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.sim-count-btn:hover {
    border-color: #3C3744;
    color: #3C3744;
}
.sim-count-btn.active {
    background: #3C3744;
    border-color: #3C3744;
    color: #fff;
}

/* 계산 버튼 */
.calc-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #3C3744 0%, #5a536b 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.05s;
}
.calc-btn:hover {
    opacity: 0.92;
}
.calc-btn:active {
    transform: translateY(1px);
}
.calc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== 진행률 바 ===== */
.progress-wrap {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 20px;
}
.progress-label {
    font-size: 13px;
    font-weight: 600;
    color: #3C3744;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.progress-bar {
    width: 100%;
    height: 10px;
    background: #f0f1f5;
    border-radius: 5px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #B4C5E4, #3C3744);
    width: 0%;
    transition: width 0.1s linear;
}

/* ===== 결과 영역 ===== */
.result-wrap {
    margin-top: 8px;
}
.result-section-title {
    font-size: 18px;
    font-weight: 800;
    color: #3C3744;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.result-section-title .ok-badge {
    background: #27ae60;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

/* 요약 카드 */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}
.summary-card {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    padding: 16px 18px;
}
.summary-card .label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 6px;
}
.summary-card .value {
    font-size: 22px;
    font-weight: 800;
    color: #3C3744;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.summary-card .sub {
    font-size: 11px;
    color: #aab0c0;
    margin-top: 4px;
}
.summary-card.highlight {
    background: linear-gradient(135deg, #3C3744, #5a536b);
    border-color: #3C3744;
}
.summary-card.highlight .label { color: #c5c1cf; }
.summary-card.highlight .value { color: #fff; }
.summary-card.highlight .sub   { color: #B4C5E4; }

/* 백분위 테이블 */
.percentile-card {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 22px;
}
.percentile-card-header {
    padding: 12px 18px;
    border-bottom: 1px solid #eef0f5;
    font-size: 14px;
    font-weight: 700;
    color: #3C3744;
}
.percentile-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.percentile-table th {
    background: #f7f8fb;
    color: #555;
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
}
.percentile-table th.num,
.percentile-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.percentile-table td {
    padding: 9px 14px;
    border-top: 1px solid #f0f1f5;
    color: #444;
}
.percentile-table tr:hover td { background: #fafbfd; }
.percentile-table .pct-label {
    font-weight: 700;
    color: #3C3744;
}

/* 차트 */
.chart-card {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 22px;
}
.chart-card-header {
    font-size: 14px;
    font-weight: 700;
    color: #3C3744;
    margin-bottom: 12px;
}
.chart-box {
    position: relative;
    height: 320px;
}

/* 메소 환산 안내 */
.cost-breakdown {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 22px;
}
.cost-breakdown-title {
    font-size: 13px;
    font-weight: 700;
    color: #3C3744;
    margin: 0 0 10px;
}
.cost-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px dashed #f0f1f5;
}
.cost-row:last-child { border-bottom: none; }
.cost-row .key { color: #666; }
.cost-row .val { color: #3C3744; font-weight: 700; font-variant-numeric: tabular-nums; }
.cost-row.total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 2px solid #3C3744;
    border-bottom: none;
}
.cost-row.total .key { font-weight: 700; color: #3C3744; }
.cost-row.total .val { font-size: 16px; color: #e53935; }

/* 빈 상태 / 안내 */
.empty-state {
    background: #fff;
    border: 1px dashed #d0d3dc;
    border-radius: 12px;
    padding: 50px 24px;
    text-align: center;
    color: #777;
}
.empty-state .empty-icon {
    font-size: 36px;
    margin-bottom: 10px;
}
.empty-state .empty-title {
    font-size: 15px;
    font-weight: 700;
    color: #3C3744;
    margin: 0 0 6px;
}
.empty-state .empty-desc {
    font-size: 13px;
    color: #777;
    margin: 0;
    line-height: 1.6;
}

/* 인포 알림 */
.info-banner {
    background: #fff8e6;
    border: 1px solid #f5d97a;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: #8a6d10;
    margin-bottom: 16px;
}
.info-banner strong { color: #5a4607; }

.error-banner {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: #991b1b;
    margin-bottom: 16px;
}

/* ===== 옵션 띄우기 모드 — 조건 결합 OR/AND 토글 ===== */
.opt-match-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.opt-match-label {
    font-size: 12px;
    color: #666;
    font-weight: 600;
}
.opt-match-toggle {
    display: inline-flex;
    border: 1px solid #ccd3e0;
    border-radius: 6px;
    overflow: hidden;
}
.opt-match-btn {
    padding: 5px 14px;
    background: #fff;
    border: 0;
    font-size: 12px;
    font-weight: 700;
    color: #666;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.opt-match-btn + .opt-match-btn { border-left: 1px solid #ccd3e0; }
.opt-match-btn:hover { background: #f4f5f9; color: #3C3744; }
.opt-match-btn.active { background: #3C3744; color: #fff; }
.opt-match-hint {
    font-size: 11px;
    color: #aab0c0;
}
.add-option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
.add-option-btn:disabled:hover {
    background: #f4f5f9;
    color: #666;
    border-color: #ccd3e0;
}

/* ===== 옵션 띄우기 모드 — 목표 옵션 추가 UI ===== */
.option-target-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.option-target-row {
    display: grid;
    grid-template-columns: 1fr 110px 30px;
    gap: 8px;
    align-items: center;
}
.option-target-row select,
.option-target-row input {
    margin: 0;
}
.option-target-row .remove-btn {
    background: #fff;
    border: 1px solid #e6e8ef;
    border-radius: 6px;
    color: #999;
    cursor: pointer;
    height: 32px;
    font-size: 16px;
    line-height: 1;
}
.option-target-row .remove-btn:hover {
    border-color: #e53935;
    color: #e53935;
}
.add-option-btn {
    background: #f4f5f9;
    border: 1px dashed #ccd3e0;
    border-radius: 8px;
    padding: 8px;
    color: #666;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
}
.add-option-btn:hover {
    background: #ebedf4;
    color: #3C3744;
    border-color: #3C3744;
}

/* ===== 모바일 ===== */
@media (max-width: 720px) {
    .cube-calc-container { padding: 22px 12px 60px; }
    .cube-calc-header h1 { font-size: 22px; }
    .cube-calc-sub { font-size: 13px; }
    .input-card { padding: 16px 14px; }
    .field-row { grid-template-columns: 1fr; gap: 12px; }
    .mode-toggle-btn { padding: 7px 20px; font-size: 13px; }
    .cube-tab { padding: 7px 12px; font-size: 12px; }
    .summary-card .value { font-size: 18px; }
    .chart-box { height: 240px; }
    .option-target-row { grid-template-columns: 1fr 90px 30px; }
}
