/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #00b894;
    /* Mint/Teal */
    --primary-hover: #00a884;
    --secondary-color: #636e72;
    --background-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: #ffffff;
    /* White background as per new guidelines */
    color: var(--text-color);
    line-height: 1.6;
    word-break: keep-all;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Layout - Block Layout (No Flex on Route to prevent Ad collapse) */
.app-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    /* Sidebar layout needs flex */
    flex-wrap: wrap;
    /* Allow wrapping for mobile */
    gap: 2rem;
    /* IMPORTANT: Ensure Ad containers inside main are NOT flex items if possible, 
       or handle them carefully. Here, top-ad is inside main, main is flex item.
       Project 17 had .container { display: block }. 
       Here .app-wrapper is flex. 
       .app-main must be block. 
    */
}

/* Main Content */
.app-main {
    flex: 3;
    min-width: 0;
    /* Prevent overflow */
    display: block;
    /* Ensure block layout for ads inside */
}

/* Sidebar - Golden Standard */
.app-sidebar {
    flex: 1;
    min-width: 300px;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;

    /* Hidden Scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

/* Responsive Sidebar */
@media (max-width: 900px) {
    .app-wrapper {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
}

/* Header (Matched with Project 18) */
.main-header {
    text-align: center;
    padding: 3rem 1rem;
    margin: 2rem auto;
    background: var(--card-bg);
    /* Card style */
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 1200px;
    position: relative;
    border: 1px solid #eaeaea;
}

.main-header h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    word-break: keep-all;
}

.main-header h1 .logo-link {
    color: inherit;
    text-decoration: none;
    /* Use solid color as per Project 18 default unless gradient preferred. Kept gradient for now but refined */
    background: linear-gradient(120deg, #00b894 0%, #0984e3 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.main-header h1 .logo-link:hover {
    opacity: 0.8;
}

.main-header .subtitle {
    font-size: 1.1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.btn-share-header {
    margin-top: 1.5rem;
    background: white;
    border: 1px solid #ddd;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-share-header:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Ad Containers - Golden Standard */
.ad-container {
    text-align: center;
    margin: 2rem auto;
    max-width: 1200px;
    width: 100%;
}

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

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

/* Larger for middle */
.bottom-ad {
    margin-top: 2rem;
}

/* Sidebar Component Styles */
.sidebar-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.sidebar-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-list li {
    margin-bottom: 1rem;
}

.sidebar-list li:last-child {
    margin-bottom: 0;
}

.sidebar-list a {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    transition: transform 0.2s;
    color: #555;
}

.sidebar-list a:hover {
    transform: translateX(3px);
    color: var(--primary-color);
}

.link-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.link-content {
    display: flex;
    flex-direction: column;
}

.link-title {
    font-weight: 500;
    font-size: 0.95rem;
    color: #333;
}

.link-desc {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
    line-height: 1.4;
}

/* Calculator Card */
.calculator-section {
    margin-bottom: 2rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    /* Premium shadow */
    border: 1px solid #eaeaea;
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input,
select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.helper-btns {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.btn-chip {
    padding: 0.4rem 0.8rem;
    background: #e9ecef;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-chip:hover {
    background: #dee2e6;
}

.info-text {
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-top: 0.3rem;
    font-weight: 500;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    width: 100%;
    padding: 0.8rem;
    margin-top: 0.5rem;
    background: transparent;
    border: 1px solid #bbb;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
}

/* Result Section */
.result-section {
    margin-top: 2rem;
}

.result-card {
    background: #e3f9f3;
    /* Very light mint */
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--primary-color);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.result-card h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.result-detail {
    color: #555;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.btn-action {
    background: #0984e3;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 20px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(9, 132, 227, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(9, 132, 227, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(9, 132, 227, 0);
    }
}

/* Content Sections */
.content-section {
    margin: 2.5rem 0;
    /* Reduced from 3rem */
    padding: 0;
    /* Removing padding to align with card */
}

.content-section h2 {
    font-size: 1.4rem;
    border-left: 5px solid var(--primary-color);
    padding-left: 0.8rem;
    margin-bottom: 1.2rem;
    color: #2d3436;
    font-weight: 700;
}

.content-desc {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
}

/* Comparison Table */
.comparison-table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.comparison-table th,
.comparison-table td {
    padding: 1rem;
    border-bottom: 1px solid #ddd;
    text-align: center;
    min-width: 100px;
}

.comparison-table th {
    background: #f1f8ff;
    font-weight: 700;
    color: #333;
}

.comparison-table td.highlight {
    background: #e3f9f3;
    font-weight: 700;
    color: var(--primary-color);
}

/* Guide Steps */
.guide-steps .step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.step-num {
    background: var(--primary-color);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
}

.step p {
    margin: 0;
    padding-top: 2px;
}

/* History */
.history-section {
    margin: 2rem 0;
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #eee;
    cursor: pointer;
    transition: transform 0.2s;
}

.history-item:hover {
    transform: translateX(5px);
    border-color: var(--primary-color);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.3rem;
}

.history-main-text {
    font-weight: bold;
    color: #333;
}

.history-sub-text {
    font-size: 0.9rem;
    color: var(--primary-color);
}

.btn-text {
    background: none;
    border: none;
    font-size: 0.8rem;
    color: #999;
    cursor: pointer;
    text-decoration: underline;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #999;
    font-size: 0.9rem;
    margin-top: 3rem;
    border-top: 1px solid #eee;
}

/* Floating Button */
.btn-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    display: none;
    /* JS will toggle */
    z-index: 100;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 200;
}

/* Tips Section */
.tip-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 3rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tip-card h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.tip-card p {
    color: #555;
    font-size: 0.95rem;
    margin: 0;
}

/* FAQ Accordion */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.2rem;
    text-align: left;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.faq-question:hover {
    background: #f8f9fa;
}

.faq-question .icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    transition: transform 0.3s;
}

.faq-item.active .faq-question .icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f8f9fa;
}

.faq-answer p {
    padding: 1.2rem;
    margin: 0;
    color: #555;
    line-height: 1.6;
    border-top: 1px solid #eee;
}

.toast.show {
    opacity: 1;
}