/* Global Styles */
:root {
    /* Color Palette */
    --primary-color: #4a90e2;
    /* Trustworthy Blue */
    --primary-hover: #357abd;
    --secondary-bg: #f0f2f5;
    /* Light Gray/Beige for background */
    --card-bg: #ffffff;
    --text-main: #333333;
    --text-sub: #666666;
    --border-color: #dddddd;

    /* Profit/Loss Colors (User Requested: Green=Profit, Red=Loss) */
    --profit-color: #28a745;
    --loss-color: #dc3545;
    --neutral-color: #6c757d;

    /* Spacing & Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--secondary-bg);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

header h1 {
    margin: 0 0 10px 0;
    color: var(--text-main);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-sub);
    margin: 0;
    font-size: 1rem;
}

/* Home Button */
.btn-home {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-bottom: 15px;
    color: var(--text-sub);
    text-decoration: none;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-home:hover {
    background-color: #f1f3f5;
    color: var(--text-main);
    border-color: #ced4da;
}

.btn-home i {
    font-size: 0.85rem;
}

/* Section Styles */
section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header h2 i {
    color: var(--primary-color);
}

/* Card Style */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 25px;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Inputs */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-sub);
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #fff;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Highlight Input (Current Price) */
.input-group.highlight input {
    background-color: #f8fbff;
    border-color: #cce5ff;
}

/* Buttons */
button {
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Reset Buttons (Small) */
.btn-sm-reset {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-sm-reset:hover {
    background-color: #f1f3f5;
    color: var(--text-main);
    border-color: #ced4da;
}

/* Action Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

#btn-add-row {
    flex: 1;
    padding: 14px;
    background-color: white;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
}

#btn-add-row:hover {
    background-color: #f0f7ff;
}

#btn-calculate {
    flex: 2;
    padding: 14px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 6px rgba(74, 144, 226, 0.2);
}

#btn-calculate:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(74, 144, 226, 0.3);
}

.btn-remove {
    background-color: #fff0f0;
    color: var(--loss-color);
    border: 1px solid #ffc9c9;
    padding: 0 15px;
    border-radius: var(--radius-md);
    font-weight: 500;
    margin-top: 29px;
    /* Align with inputs */
    height: 47px;
    /* Match input height approx */
}

.btn-remove:hover {
    background-color: #ffe3e3;
}

/* Dynamic Rows */
.buy-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: flex-start;
}

.buy-row .input-group {
    flex: 1;
}

/* Results Display */
.current-status-result {
    display: flex;
    justify-content: space-between;
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-top: 10px;
    border: 1px solid #eee;
}

.status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-item .label {
    font-size: 0.85rem;
    color: var(--text-sub);
    margin-bottom: 5px;
}

.status-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Strategy Footer */
.strategy-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.total-investment {
    text-align: right;
    margin-bottom: 15px;
    font-size: 1rem;
    color: var(--text-main);
}

.total-investment .value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-left: 8px;
}

/* Ad Container */
#ad-container {
    width: 100%;
    min-height: 120px;
    background-color: #f1f3f5;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    border-radius: var(--radius-md);
    color: #adb5bd;
    font-size: 0.9rem;
    border: 1px dashed #ced4da;
}

/* Comparison Grid (Section 3) */
.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.compare-item h3 {
    text-align: center;
    font-size: 1rem;
    color: var(--text-sub);
    margin-bottom: 10px;
    font-weight: 600;
}

.compare-values {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid #eee;
}

.old-value,
.new-value {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.old-value .value {
    color: var(--text-sub);
    font-size: 1.1rem;
    text-decoration: line-through;
    opacity: 0.7;
}

.new-value .value {
    color: var(--text-main);
    font-size: 1.3rem;
    font-weight: 700;
}

.arrow {
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* Break Even Section */
.break-even-section {
    text-align: center;
    background-color: #e3f2fd;
    /* Very light blue */
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid #bbdefb;
    margin-bottom: 20px;
}

.break-even-section h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    color: #1565c0;
}

.break-even-section p {
    margin: 0;
    font-size: 1rem;
    color: #0d47a1;
}

.highlight-text {
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--primary-color);
}

/* Share Button */
#btn-share {
    width: 100%;
    padding: 16px;
    background-color: #20c997;
    /* Teal */
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px rgba(32, 201, 151, 0.2);
}

#btn-share:hover {
    background-color: #12b886;
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(32, 201, 151, 0.3);
}

/* Footer */
footer {
    text-align: center;
    margin-top: 50px;
    color: #adb5bd;
    font-size: 0.85rem;
}

/* Utility Classes for Colors */
.profit {
    color: var(--profit-color) !important;
}

.loss {
    color: var(--loss-color) !important;
}

/* Responsive Design */
@media (max-width: 600px) {
    .buy-row {
        flex-direction: column;
        gap: 10px;
    }

    .btn-remove {
        width: 100%;
        margin-top: 0;
        height: 40px;
    }

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

    .button-group {
        flex-direction: column;
    }

    #btn-add-row,
    #btn-calculate {
        width: 100%;
    }

    header h1 {
        font-size: 1.8rem;
    }
}

/* SEO Content Section */
.seo-content {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.seo-box {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 4px solid var(--primary-color);
}

.seo-box h3 {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.seo-box p {
    color: #555;
    font-size: 1rem;
    line-height: 1.7;
    margin: 0;
    word-break: keep-all;
}

.seo-box strong {
    color: #333;
    font-weight: 700;
}