/* ========================================
   금융계산기.kr - 복리 수익률 계산기
   Green accent theme
   ======================================== */

:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #ecfdf5;
    --primary-mid: #d1fae5;

    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8faff;
    --border: #e2e8f4;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --blue: #1a56e8;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, .10), 0 2px 6px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14), 0 4px 12px rgba(15, 23, 42, .08);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

ul {
    list-style: none;
}

.container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== HEADER ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-accent {
    color: var(--primary);
}

.header-nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

/* ===== AD ===== */
.ad-banner-top,
.ad-banner-middle,
.ad-banner-bottom {
    background: var(--surface);
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.ad-banner-middle {
    border-top: 1px solid var(--border);
}

.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .75rem;
    letter-spacing: .1em;
}

.ad-slot--horizontal {
    height: 90px;
    width: 100%;
}

.ad-slot--sidebar {
    height: 260px;
    margin-bottom: 20px;
}

/* ===== TOP DESC ===== */
.top-description {
    background: linear-gradient(135deg, #059669 0%, #047857 50%, #065f46 100%);
    padding: 36px 0 32px;
    color: white;
}

.breadcrumb {
    font-size: .8rem;
    color: rgba(255, 255, 255, .65);
    margin-bottom: 12px;
}

.bc-sep {
    margin: 0 6px;
}

.bc-current {
    color: rgba(255, 255, 255, .9);
}

.main-title {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.3;
}

.main-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, .85);
    max-width: 640px;
    margin-bottom: 20px;
}

.main-subtitle strong {
    color: #a7f3d0;
}

.top-desc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .25);
    color: rgba(255, 255, 255, .9);
    padding: 4px 12px;
    border-radius: 100px;
    font-size: .8rem;
    font-weight: 500;
}

/* ===== GRID ===== */
.main-content {
    padding: 32px 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-areas: "calculator sidebar";
    gap: 28px;
    align-items: start;
}

.calculator-section {
    grid-area: calculator;
}

.sidebar {
    grid-area: sidebar;
}

/* ===== CALC CARD ===== */
.calc-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 20px;
}

.calc-card-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.calc-card-desc {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-bottom: 28px;
}

.calc-card-desc strong {
    color: var(--primary);
}

/* ===== FORM ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.optional-badge {
    background: #f1f5f9;
    color: var(--text-muted);
    font-size: .7rem;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: none;
    letter-spacing: 0;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: 13px 52px 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface-2);
    transition: all var(--transition);
    outline: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

.form-input::-webkit-outer-spin-button,
.form-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, .12);
}

.form-input.error {
    border-color: var(--danger);
}

.input-unit {
    position: absolute;
    right: 14px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-muted);
    pointer-events: none;
}

.form-hint {
    font-size: .78rem;
    color: var(--text-muted);
    min-height: 16px;
}

.form-hint.formatted {
    color: var(--primary);
    font-weight: 500;
}

/* ===== RADIO ===== */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    font-size: .88rem;
    color: var(--text-secondary);
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    user-select: none;
}

.radio-label:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.radio-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all var(--transition);
}

.radio-label:has(input:checked) .radio-custom {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: inset 0 0 0 3px white;
}

/* ===== BUTTON ===== */
.calc-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(5, 150, 105, .4);
}

.calc-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(5, 150, 105, .5);
}

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

.btn-icon {
    font-size: 1.1rem;
}

/* ===== RESULT CARD ===== */
.result-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary);
    margin-bottom: 20px;
    animation: fadeSlideIn .4s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.result-summary-box {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    color: white;
    text-align: center;
    margin-bottom: 20px;
}

.summary-label {
    font-size: .85rem;
    opacity: .8;
    margin-bottom: 4px;
}

.summary-amount {
    font-size: clamp(1.8rem, 5vw, 2.6rem);
    font-weight: 800;
    line-height: 1.2;
}

.summary-sub {
    font-size: .85rem;
    opacity: .75;
    margin-top: 8px;
}

/* Compare */
.compare-section {
    margin-bottom: 24px;
}

.compare-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.compare-item {
    background: var(--surface-2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.compare-item.compound-type {
    border-color: var(--primary);
    background: var(--primary-light);
}

.compare-type {
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.compare-item.compound-type .compare-type {
    color: var(--primary);
}

.compare-final {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.compare-profit {
    font-size: .8rem;
    color: var(--success);
    font-weight: 600;
}

.compare-diff {
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Result grid */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.result-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.result-item-label {
    font-size: .78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 4px;
}

.result-item-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-item-value.positive {
    color: var(--success);
}

.result-item-value.accent {
    color: var(--primary);
}

.result-item-value.large {
    font-size: 1.3rem;
    color: var(--primary-dark);
}

/* 72의 법칙 박스 */
.rule72-box {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f2444 100%);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    color: white;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.rule72-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.rule72-text {
    flex: 1;
}

.rule72-title {
    font-size: .8rem;
    opacity: .7;
    margin-bottom: 2px;
}

.rule72-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #7dd3fc;
}

.rule72-desc {
    font-size: .8rem;
    opacity: .75;
    margin-top: 2px;
}

/* Line chart */
.chart-section {
    margin-bottom: 24px;
}

.chart-section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
}

.line-chart-wrap {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    height: 280px;
}

.line-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Donut chart */
.chart-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.chart-wrap canvas {
    max-width: 200px;
    max-height: 200px;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .85rem;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
    flex-shrink: 0;
}

.legend-info {
    display: flex;
    flex-direction: column;
}

.legend-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.legend-val {
    font-weight: 700;
    color: var(--text-primary);
}

.result-notice {
    font-size: .78rem;
    color: var(--text-muted);
    background: #f8faff;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border);
    margin-top: 16px;
}

/* ===== GROWTH TABLE ===== */
.schedule-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    animation: fadeSlideIn .5s ease;
}

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

.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

.schedule-table th {
    background: var(--text-primary);
    color: white;
    padding: 12px 14px;
    text-align: right;
    font-weight: 600;
    font-size: .8rem;
    white-space: nowrap;
}

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

.schedule-table td {
    padding: 10px 14px;
    text-align: right;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.schedule-table td:first-child {
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary);
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:nth-child(even) td {
    background: var(--surface-2);
}

.schedule-table tr:hover td {
    background: var(--primary-light);
}

.schedule-table .milestone-row td {
    background: #d1fae5;
    font-weight: 700;
    color: var(--primary-dark);
    border-top: 2px solid var(--primary);
}

.profit-cell {
    color: var(--success);
    font-weight: 700;
}

.simple-cell {
    color: var(--text-muted);
}

/* ===== SIDEBAR ===== */
.sidebar {
    display: flex;
    flex-direction: column;
}

.sidebar-widget {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.widget-title {
    font-size: .95rem;
    font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-light);
}

.widget-desc {
    font-size: .83rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: .875rem;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.sidebar-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(5, 150, 105, .15);
    transform: translateX(4px);
}

.sidebar-link.active-link {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(5, 150, 105, .2);
    font-weight: 600;
    cursor: default;
}

.link-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.link-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.link-info strong {
    font-weight: 600;
}

.link-info small {
    font-size: .73rem;
    color: var(--text-muted);
}

/* 72의 법칙 위젯 */
.rule72-widget {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 14px;
    border: 1px solid var(--border);
}

.rule72-formula {
    text-align: center;
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.rule72-formula strong {
    color: var(--primary);
    font-size: 1rem;
}

.rule72-examples {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.r72-row {
    display: flex;
    justify-content: space-between;
    font-size: .83rem;
    color: var(--text-secondary);
}

.r72-row span:last-child {
    font-weight: 600;
    color: var(--primary);
}

/* ref table */
.tax-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.tax-table th,
.tax-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.tax-table th {
    background: var(--surface-2);
    font-weight: 700;
    font-size: .78rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.rate-highlight {
    font-weight: 700;
    color: var(--primary);
}

.widget-note {
    font-size: .73rem;
    color: var(--text-muted);
    margin-top: 10px;
    line-height: 1.5;
}

/* ===== BOTTOM DESC ===== */
.bottom-description {
    background: var(--surface);
    padding: 52px 0;
    border-top: 1px solid var(--border);
}

.info-section {
    margin-bottom: 44px;
}

.info-section:last-child {
    margin-bottom: 0;
}

.info-section>h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
}

.info-section>p {
    color: var(--text-secondary);
    margin-bottom: 14px;
    max-width: 780px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.three-col {
    grid-template-columns: repeat(3, 1fr);
}

.info-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
}

.info-card.highlight-card {
    border-color: var(--primary);
    background: var(--primary-light);
}

.info-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.info-card p {
    font-size: .9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 10px;
}

.formula-box {
    background: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-top: 10px;
}

.formula-box p {
    color: rgba(255, 255, 255, .7);
    font-size: .78rem;
    margin-bottom: 3px;
}

.formula-box code {
    display: block;
    color: #a7f3d0;
    font-size: .8rem;
    font-family: 'Consolas', monospace;
    line-height: 1.6;
}

.mt-8 {
    margin-top: 10px !important;
}

.comparison-note {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-top: 10px;
}

.comparison-note p {
    font-size: .85rem;
    margin-bottom: 6px;
}

.comparison-note ul {
    padding-left: 16px;
    list-style: disc;
}

.comparison-note li {
    font-size: .82rem;
    color: var(--text-secondary);
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.feature-list li {
    font-size: .85rem;
    color: var(--text-secondary);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.faq-item summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: .95rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.3rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-left: 12px;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item summary:hover {
    background: var(--primary-light);
}

.faq-item p {
    padding: 12px 20px 16px;
    font-size: .9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    border-top: 1px solid var(--border);
}

/* ===== FOOTER ===== */
.ad-banner-bottom {
    border-bottom: none;
    border-top: 1px solid var(--border);
}

.site-footer {
    background: var(--text-primary);
    color: rgba(255, 255, 255, .6);
    padding: 36px 0;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 800;
    color: white;
}

.footer-logo .logo-accent {
    color: #7dd3fc;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: rgba(255, 255, 255, .55);
    font-size: .85rem;
    transition: color var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-disclaimer {
    font-size: .78rem;
    max-width: 620px;
    line-height: 1.6;
}

.footer-copy {
    font-size: .78rem;
    color: rgba(255, 255, 255, .3);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "calculator" "sidebar";
    }

    .sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .ad-slot--sidebar {
        display: none;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .three-col {
        grid-template-columns: 1fr;
    }

    .compare-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .header-nav {
        display: none;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .calc-card,
    .result-card,
    .schedule-card {
        padding: 20px;
    }

    .sidebar {
        display: flex;
        flex-direction: column;
    }
}