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

html {
    background-color: transparent !important;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background-color: transparent !important;
    color: #1A1A1A;
    line-height: 1.6;
    font-size: 14px;
}

/* Container - Single Column Layout */
.container {
    display: block;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: transparent;
}

/* Main Calculator */
.calculator {
    width: 100%;
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 40px;
}

/* 가로 배너 광고 (728x90) */
.ad-banner {
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 30px auto;
    padding: 0;
    text-align: center;
    background: transparent;
    overflow: hidden;
}

.ad-banner .adsbygoogle {
    margin: 0 auto;
}

/* PC에서만 광고 표시 */
@media (min-width: 768px) {
    .ad-banner {
        display: block;
    }
}

/* 모바일에서 광고 숨김 */
@media (max-width: 767px) {
    .ad-banner {
        display: none;
    }
}

/* Inline AdSense - 제거됨 */
.ad-inline {
    display: none;
}

/* Header */
.calculator-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #E5E5E5;
}

.calculator-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    color: #666666;
    font-weight: 400;
}

/* Form Section */
.form-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #E5E5E5;
}

/* Income Type Selection Grid */
.income-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.radio-card,
.checkbox-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid #E5E5E5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #FFFFFF;
}

.radio-card:hover,
.checkbox-card:hover {
    border-color: #0066FF;
    background-color: #F0F7FF;
}

.radio-card input[type="radio"],
.checkbox-card input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-card input[type="radio"]:checked + .radio-label,
.checkbox-card input[type="checkbox"]:checked + .checkbox-label {
    color: #0066FF;
    font-weight: 600;
}

.radio-card input[type="radio"]:checked ~ *,
.checkbox-card input[type="checkbox"]:checked ~ * {
    color: #0066FF;
}

.radio-card:has(input[type="radio"]:checked),
.checkbox-card:has(input[type="checkbox"]:checked) {
    border-color: #0066FF;
    background-color: #F0F7FF;
}

.radio-label,
.checkbox-label {
    font-size: 15px;
    font-weight: 500;
    color: #1A1A1A;
    margin-bottom: 4px;
}

.radio-desc,
.checkbox-desc {
    font-size: 12px;
    color: #666666;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.number-input,
.select-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #E5E5E5;
    border-radius: 4px;
    background-color: #FFFFFF;
    transition: border-color 0.2s ease;
}

.number-input:focus,
.select-input:focus {
    outline: none;
    border-color: #0066FF;
}

.number-input:disabled {
    background-color: #F5F5F5;
    color: #999999;
    cursor: not-allowed;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: #999999;
    margin-top: 6px;
}

/* Input Row */
.input-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* Expense Rate Buttons */
.expense-rate-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

/* Subsection */
.subsection {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #FAFAFA;
    border-radius: 6px;
    border: 1px solid #E5E5E5;
}

.subsection-title {
    font-size: 15px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 16px;
}

/* Income Detail Section */
.income-detail-section {
    margin-bottom: 20px;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #0066FF;
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: #0052CC;
}

.btn-secondary {
    background-color: #FFFFFF;
    color: #1A1A1A;
    border: 1px solid #E5E5E5;
}

.btn-secondary:hover {
    background-color: #F5F5F5;
    border-color: #0066FF;
}

/* Result Section */
.result-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #E5E5E5;
}

.result-table {
    background-color: #FAFAFA;
    border: 1px solid #E5E5E5;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 30px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #E5E5E5;
}

.result-row:last-child {
    border-bottom: none;
}

.result-row.highlight {
    background-color: #F0F7FF;
    font-weight: 600;
}

.result-row.final {
    background-color: #F5F5F5;
    padding: 20px;
}

.result-label {
    font-size: 14px;
    color: #666666;
}

.result-row.highlight .result-label,
.result-row.final .result-label {
    color: #1A1A1A;
    font-weight: 600;
}

.result-value {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
}

.result-value.large {
    font-size: 24px;
    font-weight: 700;
}

.result-value.payment {
    color: #E74C3C;
}

.result-value.refund {
    color: #27AE60;
}

/* Tips Box */
.tips-box {
    background-color: #FFF9E6;
    border: 1px solid #FFD700;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.tips-title {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 12px;
}

.tips-list {
    list-style: none;
    padding-left: 0;
}

.tips-list li {
    font-size: 14px;
    color: #666666;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.tips-list li:before {
    content: "•";
    position: absolute;
    left: 6px;
    color: #FFD700;
    font-weight: bold;
}

/* Info Box */
.info-box {
    background-color: #F0F7FF;
    border: 1px solid #0066FF;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.info-title {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 12px;
}

.info-list {
    list-style: none;
    padding-left: 0;
}

.info-list li {
    font-size: 14px;
    color: #666666;
    margin-bottom: 8px;
    padding-left: 20px;
    position: relative;
}

.info-list li:before {
    content: "•";
    position: absolute;
    left: 6px;
    color: #0066FF;
    font-weight: bold;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.action-buttons button {
    flex: 1;
    min-width: 140px;
}

/* Toast Message */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #1A1A1A;
    color: #FFFFFF;
    padding: 14px 24px;
    border-radius: 6px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    opacity: 0.95;
    visibility: visible;
}

/* Tablet Styles (768px - 1199px) */
@media (max-width: 1199px) {
    .container {
        padding: 20px 16px;
    }

    .calculator {
        max-width: 100%;
        width: 100%;
        padding: 30px 24px;
    }

    .income-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Styles (max-width: 767px) */
@media (max-width: 767px) {
    body {
        font-size: 13px;
    }

    .container {
        padding: 12px;
    }

    .calculator {
        padding: 24px 16px;
        border-radius: 6px;
    }

    .ad-banner {
        display: none;
        height: 0;
        margin: 0;
        overflow: hidden;
    }

    .calculator-header {
        margin-bottom: 30px;
    }

    .calculator-header h1 {
        font-size: 22px;
    }

    .subtitle {
        font-size: 12px;
    }

    .section-title {
        font-size: 16px;
    }

    .income-type-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .radio-card {
        padding: 14px 10px;
    }

    .radio-label {
        font-size: 14px;
    }

    .radio-desc {
        font-size: 11px;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .number-input,
    .select-input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .expense-rate-buttons {
        flex-direction: column;
    }

    .expense-rate-buttons button {
        width: 100%;
    }

    .subsection {
        padding: 16px;
    }

    .result-row {
        padding: 12px 16px;
        flex-direction: row;
    }

    .result-label {
        font-size: 13px;
    }

    .result-value {
        font-size: 14px;
        text-align: right;
    }

    .result-value.large {
        font-size: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
        min-width: auto;
    }

    .tips-box,
    .info-box {
        padding: 16px;
    }

    .tips-title,
    .info-title {
        font-size: 15px;
    }

    .tips-list li,
    .info-list li {
        font-size: 13px;
    }
}

/* Small Mobile (max-width: 374px) */
@media (max-width: 374px) {
    .income-type-grid {
        grid-template-columns: 1fr;
    }

    .calculator-header h1 {
        font-size: 20px;
    }

    .result-value.large {
        font-size: 18px;
    }
}

/* Print Styles */
@media print {
    .ad-left,
    .ad-right,
    .action-buttons {
        display: none !important;
    }

    .calculator {
        box-shadow: none;
        border: 1px solid #E5E5E5;
    }

    body {
        background-color: #FFFFFF;
    }
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Focus Visible for Accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #0066FF;
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background-color: #0066FF;
    color: #FFFFFF;
}