/* 적금·예금 계산기 스타일 - Project 33 기반 구조 복원 + Sophisticated Refinements */

/* ===== 1. CSS Variables & Reset ===== */
:root {
    /* Colors - Project 33의 신뢰감 있는 블루 테마 유지 */
    --primary-color: #1976D2;
    --primary-hover: #1565C0;
    --secondary-color: #6C757D;

    /* Backgrounds */
    --bg-body: #F8F9FA;
    --bg-card: #FFFFFF;
    --bg-hover: #F1F3F5;

    /* Text */
    --text-primary: #212529;
    --text-secondary: #6C757D;
    --text-muted: #ADB5BD;

    /* Spacing System (Refined) */
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    /* Increased from 12px */
    --spacing-md: 24px;
    /* Increased from 16px */
    --spacing-lg: 32px;
    /* Increased from 24px */
    --spacing-xl: 48px;
    /* High impact */

    /* Structure */
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-color: #DEE2E6;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    /* Softer, deeper shadow */
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);

    /* Typography */
    --font-heading: 'Noto Sans KR', sans-serif;
    --font-body: 'Noto Sans KR', sans-serif;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

ul,
ol {
    list-style: none;
    /* [CRITICAL] Prevent Double Bullets */
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    /* [REFINEMENT] Better readability */
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
}

/* ===== 2. Layout Structure (Project 33 Style) ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

.layout-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    /* [RESTORE] Project 33 Exact Grid */
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
    align-items: start;
}

.main-column {
    min-width: 0;
}



/* ===== 3. Header (Project 33 Gradient Style) ===== */
.main-header {
    text-align: center;
    padding: var(--spacing-xl) 0;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 50%, #0D47A1 100%);
    /* [RESTORE] Gradient */
    color: white;
    border-radius: var(--border-radius);
    margin-top: var(--spacing-lg);
    position: relative;
    box-shadow: var(--shadow-md);
}

.main-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
    color: white;
    /* Ensure text is white on gradient */
}

.main-header .subtitle {
    font-size: 1.125rem;
    opacity: 0.95;
    margin-bottom: var(--spacing-md);
    color: rgba(255, 255, 255, 0.9);
}

.btn-share-header {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-share-header:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
    transform: translateY(-2px);
}

/* ===== 4. Card Component (Refined) ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    /* [REFINEMENT] Larger padding */
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
    border: 1px solid rgba(0, 0, 0, 0.03);
    /* Subtle border */
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xl);
    /* [INCREASED] More space */
    color: var(--primary-color);
    border-bottom: 2px solid #F1F3F5;
    padding-bottom: var(--spacing-sm);
}

/* Section Titles (h3) */
.section-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
}

/* Subsection Cards (💡 lightbulb sections) */
.subsection-card {
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    /* LEFT BORDER */
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.subsection-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.subsection-card p {
    margin-bottom: var(--spacing-md);
    line-height: 1.9;
    /* Increased spacing */
}

.subsection-card ul {
    margin-left: 24px;
    line-height: 2.0;
}

.subsection-card ul li {
    margin-bottom: 14px;
    /* More space between items */
}

/* ===== 5. Sidebar (Project 33 Standard) ===== */
.app-sidebar {
    position: sticky;
    top: var(--spacing-lg);
    max-height: calc(100vh - var(--spacing-lg));
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.app-sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.sidebar-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.sidebar-list a {
    display: flex;
    /* Flex required for alignment */
    align-items: flex-start;
    /* Align top */
    gap: 12px;
    padding: 10px;
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    transition: background 0.2s;
}

.sidebar-list a:hover {
    background: var(--bg-hover);
    color: var(--primary-color);
}

.link-title {
    font-weight: 500;
    display: block;
    line-height: 1.4;
}

.link-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* ===== 6. Forms & Inputs ===== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: all 0.2s;
    background: #FDFDFD;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

/* ===== 15. Footer ===== */
.main-footer {
    text-align: center;
    padding: var(--spacing-lg) 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    margin-top: var(--spacing-xl);
}

/* ===== 16. Bank Links Grid ===== */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.link-card {
    background: white;
    border: 1px solid #E8E8E8;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(25, 118, 210, 0.15);
    border-color: var(--primary-color);
}

.link-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.link-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.featured-link {
    background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
    border: 2px solid #FFD700;
}

.featured-link:hover {
    background: linear-gradient(135deg, #FFF3CC 0%, #FFEB99 100%);
}

.bank-category-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: var(--spacing-xl);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid #F1F3F5;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: var(--spacing-xs);
    background: #F1F3F5;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-lg);
}

.mode-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s;
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.2);
}

.btn-block {
    width: 100%;
    font-size: 1.1rem;
    padding: 16px;
}

/* ===== 7. History Section (Enhanced) ===== */
.history-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.history-section h2 {
    margin-bottom: var(--spacing-lg);
}

.history-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    /* Increased gap */
    margin-bottom: var(--spacing-lg);
}

.history-item {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.history-item:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.15);
    border-left-width: 6px;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.history-info {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.6;
}

.btn-clear-history {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: #F8F9FA;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-clear-history:hover {
    background: #E9ECEF;
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* ===== 8. Checklist (Interactive) ===== */
.checklist-container {
    display: grid;
    gap: var(--spacing-md);
}

.checklist-item {
    position: relative;
}

.checklist-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checklist-label {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: #F8F9FA;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.checklist-label:hover {
    background: #E9ECEF;
    transform: translateX(4px);
}

.checklist-checkbox:checked+.checklist-label {
    background: linear-gradient(135deg, #E7F4FF 0%, #F0F8FF 100%);
    border-color: var(--primary-color);
}

.checklist-checkbox:checked+.checklist-label .checklist-content strong {
    color: var(--primary-color);
}

.checklist-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.checklist-content {
    flex: 1;
}

.checklist-content strong {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.checklist-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.checklist-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.checklist-content a:hover {
    text-decoration: underline;
}

/* ===== 7. Results & Tables ===== */
.result-card {
    background: white;
    padding: var(--spacing-xl);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-lg);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 2px solid var(--primary-color);
}

.result-card h2 {
    color: var(--primary-color);
    border-bottom: 2px solid #F1F3F5;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    text-align: center;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.summary-item {
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid var(--primary-color);
}

.summary-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.tax-comparison h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.tax-comparison .comparison-table {
    background: white;
}

.tax-comparison .comparison-table td.highlight {
    background: #E7F4FF;
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.05rem;
}

.tax-comparison .comparison-table td.positive {
    color: #10B981;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-xl);
}

.btn-secondary {
    background: #6B7280;
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #4B5563;
    transform: translateY(-2px);
}

.btn-share {
    background: #10B981;
    color: white;
    padding: var(--spacing-sm) var(--spacing-lg);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-share:hover {
    background: #059669;
    transform: translateY(-2px);
}

.warning-box {
    background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid #F59E0B;
    margin-bottom: var(--spacing-xl);
    /* [ADDED] Space before next-steps */
}

.warning-box h4 {
    color: #92400E;
    margin-bottom: var(--spacing-sm);
    font-size: 1.1rem;
}

.warning-box p {
    color: #78350F;
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

.warning-box p:last-child {
    margin-bottom: 0;
}

/* General Tables */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
}

.comparison-table th,
.comparison-table td {
    padding: 14px 18px;
    border: 1px solid #E8E8E8;
    text-align: left;
}

.comparison-table th {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    font-weight: 600;
    text-align: center;
}

.comparison-table tbody tr:hover {
    background: #F8F9FA;
}

.comparison-table tbody tr:nth-child(even) {
    background: #FAFBFC;
}

.comparison-table tbody tr:nth-child(even):hover {
    background: #F0F2F5;
}

/* Calculation Tables (for examples) */
.calculation-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    font-size: 0.95rem;
}

.calculation-table th,
.calculation-table td {
    padding: 12px 14px;
    border: 1px solid #E8E8E8;
    text-align: center;
}

.calculation-table th {
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

.calculation-table tbody tr:hover {
    background: #F8F9FA;
}

.calculation-table .total-row {
    background: #E7F4FF;
    font-weight: 600;
}

.calculation-table .highlight-row {
    background: #FFF9E6;
}

.calculation-table .highlight-row:hover {
    background: #FFF3CC;
}

.formula-note {
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-md);
    background: #F0F8FF;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    border-left: 3px solid var(--primary-color);
}

/* ===== 8. Info Box & FAQ ===== */
.info-box {
    background: linear-gradient(135deg, #F8F9FA 0%, #FFFFFF 100%);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
    margin-bottom: var(--spacing-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.info-box h4 {
    margin-bottom: 12px;
    color: var(--primary-color);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-box h4::before {
    content: "💡";
    font-size: 1.2rem;
}

/* Related Tools Card Grid */
.related-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.tool-card {
    background: white;
    border: 1px solid #E8E8E8;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(25, 118, 210, 0.15);
    border-color: var(--primary-color);
}

.tool-card-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    display: block;
}

.tool-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tool-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Next Steps Enhanced */
.next-steps-box {
    background: linear-gradient(135deg, #E7F4FF 0%, #F0F8FF 100%);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    border: 2px solid #B3D9FF;
}

.next-steps-box h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
    font-size: 1.3rem;
}

.next-steps-box ul {
    display: grid;
    gap: var(--spacing-sm);
}

.next-steps-box li {
    background: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--primary-color);
    transition: all 0.2s;
}

.next-steps-box li:hover {
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.faq-item {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--spacing-sm);
    overflow: hidden;
}

.faq-question {
    padding: 16px;
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
}

.faq-question:hover {
    background: #F8F9FA;
    color: var(--primary-color);
}

.faq-answer {
    padding: 16px;
    background: #FAFAFA;
    border-top: 1px solid var(--border-color);
    line-height: 1.6;
}

/* ===== 9. Ads (Unified Guidelines Standard) ===== */
.ad-container {
    text-align: center;
    margin: 2rem auto;
    max-width: 100%;
    display: block;
    /* Ensure block-level for AdSense */
}

.top-ad {
    margin-bottom: 2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.bottom-ad {
    margin-top: 3rem;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.middle-ad {
    margin: 2rem 0;
    clear: both;
    width: 100%;
}

.bottom-ad {
    margin-top: 2rem;
}

/* ===== 10. Utilities & Mobile ===== */
.hidden {
    display: none !important;
}

@media (max-width: 960px) {
    .layout-container {
        grid-template-columns: 1fr;
        /* Stack sidebar below */
    }

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

    .card {
        padding: var(--spacing-md);
    }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(33, 37, 41, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 1000;
    transition: transform 0.3s ease-out;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}