/**
 * Compound Interest Calculator Styles
 * @package Zipper
 */

/* ===== 2-column layout (desktop) ===== */
.cci-main-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

.cci-input-col {
    position: sticky;
    top: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

/* ===== Section ===== */
.cci-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.cci-section + .cci-section {
    margin-top: 14px;
}

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

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

/* ===== Tabs ===== */
.cci-tab-group {
    display: flex;
    gap: 4px;
    background: #f5f3f0;
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 14px;
}

.cci-tab {
    flex: 1;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9e9a96;
    cursor: pointer;
    transition: all 0.2s;
}

.cci-tab:hover {
    color: #5f5a56;
}

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

.cci-tab-content {
    display: none;
}

.cci-tab-content.active {
    display: block;
}

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

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

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

.cci-label-hint {
    font-weight: 400;
    color: #9e9a96;
    margin-left: 4px;
}

.cci-amount-input,
.cci-number-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
    text-align: right;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #2d2a26;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.cci-amount-input::placeholder,
.cci-number-input::placeholder {
    font-weight: 400;
    color: #c4c0bc;
}

.cci-input-with-unit {
    position: relative;
}

.cci-input-with-unit input {
    padding-right: 36px;
}

.cci-input-unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    font-weight: 500;
    color: #9e9a96;
    pointer-events: none;
}

.cci-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 10px 12px;
    font-size: 13px;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    background: #faf9f7;
    color: #2d2a26;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    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;
}

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

.cci-korean-amount {
    font-size: 11px;
    color: #d4af37;
    margin-top: 4px;
    text-align: right;
    min-height: 16px;
}

.cci-hint {
    font-size: 11px;
    color: #9e9a96;
    margin-top: 4px;
}

/* ===== Checkbox ===== */
.cci-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.cci-checkbox-row:last-child {
    margin-bottom: 0;
}

.cci-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: #5f5a56;
    border: 1px solid #e8e4dc;
    border-radius: 6px;
    background: #faf9f7;
    cursor: pointer;
    transition: all 0.2s;
}

.cci-checkbox-label:hover {
    border-color: #d4af37;
}

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

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

/* ===== Buttons ===== */
.cci-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.cci-calculate-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #d4af37, #c9a030);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.25);
}

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

.cci-reset-btn {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #5f5a56;
    background: #f5f3f0;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.cci-reset-btn:hover {
    background: #eae7e3;
}

/* ===== Result: Waiting ===== */
.cci-waiting {
    text-align: center;
    padding: 40px 20px;
    color: #9e9a96;
}

.cci-waiting i {
    font-size: 32px;
    margin-bottom: 12px;
    display: block;
    color: #d4af37;
    opacity: 0.4;
}

.cci-waiting p {
    font-size: 13px;
    margin: 0;
}

/* ===== Result: Summary card ===== */
.cci-result-summary {
    background: #fdfbf5;
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 24px;
}

.cci-summary-title {
    font-size: 12px;
    color: #7a756d;
    margin-bottom: 8px;
}

.cci-summary-main {
    font-size: 32px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 4px;
    line-height: 1.2;
}

.cci-summary-sub {
    font-size: 13px;
    color: #5f5a56;
    margin-bottom: 16px;
}

.cci-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid #e8e4dc;
    font-size: 13px;
}

.cci-summary-row-label {
    color: #7a756d;
}

.cci-summary-row-value {
    font-weight: 600;
    color: #2d2a26;
}

.cci-summary-row-value.cci-profit {
    color: #e74c3c;
}

.cci-summary-row-value.cci-tax {
    color: #9e9a96;
}

/* ===== Result: Rule of 72 ===== */
.cci-rule72-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
}

.cci-rule72-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fdfbf5;
    border: 1px solid #e8dfc0;
    border-radius: 50%;
    flex-shrink: 0;
}

.cci-rule72-icon i {
    font-size: 18px;
    color: #d4af37;
}

.cci-rule72-body {
    flex: 1;
    min-width: 0;
}

.cci-rule72-text {
    font-size: 12px;
    color: #7a756d;
    margin-bottom: 2px;
}

.cci-rule72-value {
    font-size: 16px;
    font-weight: 700;
    color: #d4af37;
}

/* ===== Result: Chart sections ===== */
.cci-chart-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.cci-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cci-chart-title i {
    color: #d4af37;
}

.cci-chart-wrap {
    position: relative;
    width: 100%;
}

.cci-donut-wrap {
    max-width: 240px;
    margin: 0 auto;
}

.cci-chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 12px;
    font-size: 12px;
    color: #5f5a56;
}

.cci-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cci-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cci-legend-dot.cci-dot-principal { background: #e8dfc0; }
.cci-legend-dot.cci-dot-profit { background: #d4af37; }

.cci-bar-wrap {
    position: relative;
    width: 100%;
    height: 280px;
}

.cci-bar-wrap canvas {
    max-height: 280px;
}

/* ===== Result: Inflation comparison ===== */
.cci-inflation-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
}

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

.cci-inflation-title i {
    color: #d4af37;
}

.cci-inflation-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 6px;
}

.cci-inflation-row:last-child {
    margin-bottom: 0;
}

.cci-inflation-row:nth-child(odd) {
    background: #faf9f7;
}

.cci-inflation-label {
    color: #5f5a56;
}

.cci-inflation-value {
    font-weight: 600;
    color: #2d2a26;
}

.cci-inflation-value.cci-real {
    color: #d4af37;
}

.cci-inflation-diff {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #fdfbf5;
    border: 1px solid #e8dfc0;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
}

.cci-inflation-diff-label {
    color: #5f5a56;
}

.cci-inflation-diff-value {
    font-weight: 600;
    color: #e74c3c;
}

/* ===== Result: Schedule table ===== */
.cci-schedule-section {
    background: #fff;
    border: 1px solid #e8e4dc;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(45, 42, 38, 0.06);
}

.cci-schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.cci-schedule-title {
    font-size: 13px;
    font-weight: 600;
    color: #2d2a26;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cci-schedule-title i {
    color: #d4af37;
}

.cci-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background: #217346;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.cci-download-btn:hover {
    background: #1a5c38;
}

.cci-schedule-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.cci-schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.cci-schedule-table th {
    padding: 8px 6px;
    text-align: right;
    font-weight: 600;
    color: #5f5a56;
    border-bottom: 2px solid #e8e4dc;
    white-space: nowrap;
    background: #faf9f7;
}

.cci-schedule-table th:first-child {
    text-align: center;
}

.cci-schedule-table td {
    padding: 8px 6px;
    text-align: right;
    color: #2d2a26;
    border-bottom: 1px solid #f0ede8;
}

.cci-schedule-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: #5f5a56;
}

.cci-schedule-table tbody tr:hover {
    background: #fdfbf5;
}

/* ===== Result: Reverse result ===== */
.cci-reverse-result {
    background: #fdfbf5;
    border: 2px solid #d4af37;
    border-radius: 12px;
    padding: 24px;
}

.cci-reverse-result-title {
    font-size: 12px;
    color: #7a756d;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cci-reverse-result-title i {
    color: #d4af37;
}

.cci-reverse-result-main {
    font-size: 28px;
    font-weight: 700;
    color: #d4af37;
    margin-bottom: 4px;
    line-height: 1.2;
}

.cci-reverse-result-sub {
    font-size: 13px;
    color: #5f5a56;
    margin-bottom: 16px;
}

.cci-reverse-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid #e8e4dc;
    font-size: 13px;
}

.cci-reverse-detail-label {
    color: #7a756d;
}

.cci-reverse-detail-value {
    font-weight: 600;
    color: #2d2a26;
}

/* ===== Disclaimer ===== */
.cci-disclaimer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #faf9f7;
    border: 1px solid #e8e4dc;
    border-radius: 8px;
    font-size: 11px;
    color: #9e9a96;
    line-height: 1.5;
}

.cci-disclaimer i {
    color: #d4af37;
    flex-shrink: 0;
    margin-top: 2px;
}

/* ===== Utility ===== */
.cci-hidden {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .cci-main-layout {
        grid-template-columns: 1fr;
    }

    .cci-input-col {
        position: static;
        width: 100%;
    }

    .cci-result-col {
        width: 100%;
    }

    .tool-layout-input {
        max-width: 100%;
        overflow: hidden;
    }

    .cci-input-group input:not([type="radio"]):not([type="checkbox"]),
    .cci-input-group select {
        width: 100% !important;
        max-width: 100% !important;
    }

    .cci-summary-main {
        font-size: 26px;
    }

    .cci-reverse-result-main {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .tool-section,
    .tool-layout-split,
    .tool-layout-input,
    .tool-layout-result {
        max-width: 100%;
        overflow-x: hidden;
    }

    .cci-section {
        padding: 12px;
    }

    .cci-result-summary,
    .cci-reverse-result {
        padding: 16px;
    }

    .cci-summary-main {
        font-size: 22px;
    }

    .cci-reverse-result-main {
        font-size: 20px;
    }

    .cci-schedule-table {
        font-size: 11px;
    }

    .cci-schedule-table th,
    .cci-schedule-table td {
        padding: 6px 4px;
    }

    .cci-chart-legend {
        gap: 12px;
        font-size: 11px;
    }

    .cci-checkbox-row {
        flex-direction: column;
    }
}

/* Excel button guard */
.tool-btn-excel {
  background: #59ab79;
  border-color: #59ab79;
}

.tool-btn-excel:hover,
.tool-btn-excel:focus-visible {
  background: #4f9f70;
  border-color: #4f9f70;
}

