/* =================================================================
   Car Insurance Calculator (cic-) - ToolZipper Finance
   ================================================================= */

/* =====================================================================
   LAYOUT - 2-column sticky grid
   ===================================================================== */
.cic-main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    align-items: start;
    max-width: 100%;
    margin: 0 auto;
}

.cic-input-col {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}

.cic-result-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* =====================================================================
   SECTION CONTAINERS
   ===================================================================== */
.cic-section {
    background: #ffffff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-sizing: border-box;
}

.cic-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cic-section-title i {
    color: #d4af37;
    font-size: 14px;
}

/* =====================================================================
   MODE TABS (2 tabs)
   ===================================================================== */
.cic-mode-tabs {
    display: flex;
    gap: 4px;
    background: #f5f3f0;
    border-radius: 8px;
    padding: 4px;
}

.cic-mode-tab {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    text-align: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cic-mode-tab:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #2d2a26;
}

.cic-mode-tab.active {
    background: #ffffff;
    color: #d4af37;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* =====================================================================
   INPUT GROUPS
   ===================================================================== */
.cic-input-group {
    margin-bottom: 12px;
    max-width: 100%;
    box-sizing: border-box;
}

.cic-input-group:last-child {
    margin-bottom: 0;
}

.cic-input-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #5f5a56;
    margin-bottom: 6px;
}

.cic-input-label .required {
    color: #d4af37;
    margin-left: 2px;
}

/* =====================================================================
   FORM INPUTS
   ===================================================================== */
.cic-amount-input,
.cic-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    height: 40px;
    padding: 0 12px;
    font-size: 14px;
    color: #2d2a26;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.cic-amount-input {
    text-align: right;
    font-weight: 600;
}

.cic-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%235f5a56' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.cic-amount-input:focus,
.cic-select:focus {
    outline: none;
    border-color: #d4af37;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.cic-amount-input::placeholder {
    color: #c4c0bc;
    font-weight: 400;
}

/* =====================================================================
   KOREAN AMOUNT DISPLAY
   ===================================================================== */
.cic-korean-amount {
    font-size: 11px;
    color: #d4af37;
    margin-top: 4px;
    text-align: right;
    min-height: 16px;
}

/* =====================================================================
   RADIO GROUP (Pill-style)
   ===================================================================== */
.cic-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cic-radio-label {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cic-radio-label:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.05);
}

.cic-radio-label input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0 6px 0 0;
    accent-color: #d4af37;
    cursor: pointer;
    flex-shrink: 0;
}

.cic-radio-label.active {
    border-color: #d4af37;
    background: #fdfbf5;
    color: #2d2a26;
    font-weight: 500;
}

/* =====================================================================
   CHECKBOX GROUP (2-column grid for special discounts)
   ===================================================================== */
.cic-checkbox-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.cic-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    font-size: 12px;
    font-weight: 500;
    color: #2d2a26;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.cic-checkbox-label:hover {
    border-color: #d4af37;
    background: rgba(212, 175, 55, 0.05);
}

.cic-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #d4af37;
}

.cic-checkbox-text {
    flex: 1;
    font-size: 12px;
    line-height: 1.4;
}

.cic-checkbox-label .cic-checkbox-desc {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: #9e9a96;
    margin-top: 2px;
}

.cic-checkbox-label.checked,
.cic-checkbox-label:has(input:checked) {
    border-color: #d4af37;
    background: #fdfbf5;
}

/* =====================================================================
   GRADE TOGGLE (Checkbox label style)
   ===================================================================== */
.cic-grade-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #5f5a56;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cic-grade-toggle:hover {
    border-color: #d4af37;
}

.cic-grade-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #d4af37;
    flex-shrink: 0;
}

.cic-grade-toggle:has(input:checked) {
    border-color: #d4af37;
    background: #fdfbf5;
    color: #2d2a26;
    font-weight: 500;
}

/* =====================================================================
   GRADE ESTIMATE DISPLAY
   ===================================================================== */
.cic-grade-estimate {
    margin-top: 10px;
    padding: 10px 12px;
    background: #fdfbf5;
    border: 1px solid #e8dfc0;
    border-radius: 8px;
    font-size: 13px;
    color: #5f5a56;
    text-align: center;
}

.cic-grade-estimate strong {
    color: #d4af37;
    font-weight: 700;
}

/* =====================================================================
   CALCULATE BUTTON
   ===================================================================== */
.cic-calc-btn {
    width: 100%;
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37, #c9a030);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cic-calc-btn:hover {
    background: linear-gradient(135deg, #c9a030, #b8922a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(212, 175, 55, 0.3);
}

.cic-calc-btn:active {
    transform: translateY(0);
}

.cic-calc-btn i {
    font-size: 16px;
}

/* =====================================================================
   WAITING SECTION
   ===================================================================== */
.cic-waiting {
    text-align: center;
    padding: 48px 24px;
    background: #faf9f7;
}

.cic-waiting-icon {
    margin-bottom: 8px;
}

.cic-waiting-icon i,
.cic-waiting > i {
    font-size: 40px;
    color: #d4af37;
    opacity: 0.5;
    display: inline-block;
}

.cic-waiting-title {
    font-size: 16px;
    font-weight: 600;
    color: #2d2a26;
    margin: 12px 0 8px 0;
}

.cic-waiting-desc {
    font-size: 13px;
    color: #5f5a56;
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.cic-waiting-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 260px;
    margin: 0 auto;
    text-align: left;
}

.cic-waiting-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #5f5a56;
}

.cic-waiting-feature i {
    font-size: 14px;
    color: #d4af37;
    opacity: 1;
    flex-shrink: 0;
}

/* =====================================================================
   RESULT SUMMARY (Highlight card)
   ===================================================================== */
.cic-result-summary {
    background: #fdfbf5;
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 24px;
    box-sizing: border-box;
}

.cic-result-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #d4af37;
    background: rgba(212, 175, 55, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.cic-result-total {
    font-size: 32px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 4px;
    line-height: 1.2;
}

.cic-result-monthly {
    font-size: 13px;
    color: #7a756d;
    margin-bottom: 16px;
}

.cic-result-monthly span {
    font-weight: 600;
    color: #5f5a56;
}

/* --- Mini Breakdown inside Result Summary --- */
.cic-result-breakdown-mini {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #e8e4dc;
    padding-top: 12px;
}

.cic-result-breakdown-mini .cic-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
}

.cic-result-breakdown-mini .cic-breakdown-label {
    color: #7a756d;
}

.cic-result-breakdown-mini .cic-breakdown-value {
    font-weight: 600;
    color: #2d2a26;
}

.cic-result-breakdown-mini .cic-breakdown-item.cic-discount .cic-breakdown-value {
    color: #4dabf7;
}

/* =====================================================================
   COVERAGE TABLE (담보별 보험료 - JS generates <table> inside div)
   ===================================================================== */
.cic-coverage-table {
    width: 100%;
}

.cic-coverage-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cic-coverage-table thead th {
    padding: 10px 10px;
    background: #faf9f7;
    border-bottom: 2px solid #e8e4dc;
    font-weight: 600;
    color: #5f5a56;
    text-align: center;
    font-size: 12px;
}

.cic-coverage-table thead th:first-child {
    text-align: left;
}

.cic-coverage-table tbody td {
    padding: 10px 10px;
    border-bottom: 1px solid #f0ede8;
    text-align: center;
    color: #2d2a26;
    font-size: 13px;
}

.cic-coverage-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
    color: #5f5a56;
}

.cic-coverage-table tbody td.cic-amount {
    text-align: right;
    font-weight: 600;
    color: #d4af37;
}

.cic-coverage-table tbody tr:last-child td {
    border-bottom: none;
}

.cic-coverage-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.03);
}

/* =====================================================================
   DISCOUNT LIST (적용된 할인 - JS generates <ul> inside div)
   ===================================================================== */
.cic-discount-items {
    width: 100%;
}

.cic-discount-items ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cic-discount-items li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(212, 175, 55, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 6px;
    font-size: 13px;
    color: #2d2a26;
}

.cic-discount-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #d4af37;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.cic-discount-label {
    flex: 1;
    font-weight: 500;
}

.cic-discount-amount {
    font-weight: 600;
    color: #d4af37;
    white-space: nowrap;
}

/* =====================================================================
   TIPS (절약 팁 - JS generates <ul> inside div)
   ===================================================================== */
.cic-tips-list {
    width: 100%;
}

.cic-tips-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cic-tips-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: #faf9f7;
    border-radius: 8px;
    font-size: 13px;
    color: #2d2a26;
    line-height: 1.5;
}

.cic-tips-list li i {
    color: #d4af37;
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* =====================================================================
   SIMULATION TABLE (사고 시뮬레이션 - JS generates <table> inside div)
   ===================================================================== */
.cic-simulation-table {
    width: 100%;
}

.cic-simulation-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cic-simulation-table thead th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: #2d2a26;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    font-size: 12px;
}

.cic-simulation-table tbody td {
    padding: 10px 8px;
    text-align: center;
    color: #5f5a56;
    border: 1px solid #e8e4dc;
}

.cic-simulation-table tbody td.cic-amount {
    font-weight: 500;
    color: #2d2a26;
}

.cic-simulation-table tbody tr:hover {
    background: rgba(212, 175, 55, 0.03);
}

.cic-simulation-table .cic-simulation-total {
    background: #fdfbf5;
}

.cic-simulation-table .cic-simulation-total td {
    font-weight: 600;
    color: #2d2a26;
    border-top: 2px solid #e8e4dc;
}

.cic-simulation-table .cic-simulation-total td.cic-amount {
    color: #d4af37;
}

/* --- Simulation Summary --- */
.cic-simulation-summary {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff5f5;
    border: 1px solid #fdd;
    border-radius: 8px;
    font-size: 13px;
    color: #c0392b;
    text-align: center;
}

.cic-simulation-summary strong {
    color: #e74c3c;
    font-weight: 700;
}

/* =====================================================================
   DISCLAIMER
   ===================================================================== */
.cic-disclaimer {
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    padding: 12px;
    box-sizing: border-box;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-size: 12px;
    color: #5f5a56;
    line-height: 1.6;
}

.cic-disclaimer i {
    color: #d4af37;
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.cic-disclaimer strong {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 4px;
}

.cic-disclaimer p {
    margin: 0;
    font-size: 11px;
    color: #9e9a96;
    line-height: 1.6;
}

/* =====================================================================
   UTILITY CLASSES
   ===================================================================== */
.cic-hidden {
    display: none !important;
}

/* =====================================================================
   RESPONSIVE - Tablet (900px)
   ===================================================================== */
@media (max-width: 900px) {
    .cic-main-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .cic-input-col {
        position: static;
        width: 100%;
        gap: 12px;
    }

    .cic-result-col {
        width: 100%;
        gap: 14px;
    }

    .cic-input-col {
        max-width: 100%;
        overflow: hidden;
    }

    /* CRITICAL: Exclude radio/checkbox from width: 100% (Rule 32) */
    .cic-input-group input:not([type="radio"]):not([type="checkbox"]),
    .cic-input-group select {
        width: 100% !important;
        max-width: 100% !important;
    }

    .cic-checkbox-group {
        grid-template-columns: 1fr;
    }

    .cic-result-total {
        font-size: 26px;
    }

    .cic-coverage-table table,
    .cic-simulation-table table {
        font-size: 12px;
    }
}

/* =====================================================================
   RESPONSIVE - Mobile (600px)
   ===================================================================== */
@media (max-width: 600px) {
    .cic-section {
        padding: 14px;
    }

    .cic-section-title {
        font-size: 12px;
    }

    .cic-mode-tab {
        font-size: 12px;
        padding: 9px 10px;
    }

    .cic-input-label {
        font-size: 11px;
    }

    .cic-amount-input,
    .cic-select {
        height: 38px;
        font-size: 13px;
    }

    .cic-calc-btn {
        height: 42px;
        font-size: 14px;
    }

    .cic-result-summary {
        padding: 16px;
    }

    .cic-result-total {
        font-size: 24px;
    }

    .cic-coverage-table thead th,
    .cic-coverage-table tbody td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .cic-simulation-table thead th,
    .cic-simulation-table tbody td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .cic-discount-items li {
        padding: 8px 10px;
        font-size: 12px;
    }

    .cic-tips-list li {
        padding: 10px;
        font-size: 12px;
    }
}

/* =====================================================================
   RESPONSIVE - Small mobile (480px)
   ===================================================================== */
@media (max-width: 480px) {
    .tool-section,
    .cic-main-layout {
        max-width: 100%;
        overflow-x: hidden;
    }

    .cic-section {
        padding: 12px;
    }

    .cic-result-summary {
        padding: 14px;
    }

    .cic-result-total {
        font-size: 22px;
    }

    .cic-waiting {
        padding: 32px 16px;
    }

    .cic-waiting-icon i,
    .cic-waiting > i {
        font-size: 32px;
    }

    .cic-waiting-title {
        font-size: 14px;
    }

    .cic-radio-group {
        gap: 4px;
    }

    .cic-radio-label {
        padding: 7px 12px;
        font-size: 12px;
    }

    .cic-checkbox-label {
        padding: 8px;
        font-size: 11px;
    }

    .cic-checkbox-label .cic-checkbox-desc {
        font-size: 10px;
    }

    .cic-grade-toggle {
        font-size: 12px;
        padding: 8px 10px;
    }

    .cic-grade-estimate {
        font-size: 12px;
    }
}
