* { box-sizing: border-box; }
:root {
    --green: #00c805;
    --green-dark: #00a000;
    --green-light: #e8f5e9;
    --gray: #6b7280;
    --gray-light: #f3f4f6;
    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --bg-white: #ffffff;
    --bg-light: #f9fafa;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

body {
    font-family: 'Rubik', sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    min-height: 100vh;
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 50px 30px 40px;
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e9 100%);
    border-bottom: 1px solid var(--border);
}
.hero h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px 0;
}
.hero p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin: 0 auto;
    max-width: 450px;
}

/* --- Section Headers --- */
h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
    padding: 0;
}
h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 15px 0;
}

/* --- Input Section --- */
.input-section {
    padding: 30px;
}

/* --- Input Groups --- */
.input-group {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
}
.input-group:hover {
    border-color: #c5ccd4;
    box-shadow: var(--shadow-sm);
}
.input-group:focus-within {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,200,5,0.1);
}
.input-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: block;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.label-with-tooltip {
    display: flex;
    align-items: center;
    gap: 6px;
}
.tooltip-trigger {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--gray-light);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    position: relative;
    transition: all 0.3s ease;
}
.tooltip-trigger:hover {
    background: var(--green);
    border-color: var(--green);
    color: white;
    transform: scale(1.2);
    box-shadow: 0 0 0 4px rgba(0, 200, 5, 0.2);
}
.tooltip-trigger::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    right: 50%;
    transform: translateX(50%) scale(0.8);
    background: var(--text-primary);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 400;
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}
.tooltip-trigger::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    right: 50%;
    transform: translateX(50%);
    border: 6px solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}
.tooltip-trigger:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(50%) scale(1);
}
.tooltip-trigger:hover::before {
    opacity: 1;
    visibility: visible;
}
input, select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Rubik', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all 0.2s ease;
}
.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}
.input-with-unit input {
    padding-left: 30px;
}
.input-with-unit.unit-right input {
    padding-left: 14px;
    padding-right: 50px;
}
.input-unit {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
}
.input-with-unit.unit-right .input-unit {
    left: auto;
    right: 10px;
}
input:hover, select:hover {
    border-color: #c5ccd4;
}
input:focus, select:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,200,5,0.15);
}
input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* --- Buttons --- */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Rubik', sans-serif;
}
.btn-primary {
    background: var(--green);
    color: white;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(0,200,5,0.3);
}
.btn-primary:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,200,5,0.35);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-secondary {
    background: var(--bg-white);
    border: 2px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
}
.btn-link {
    background: none;
    border: none;
    color: var(--green-dark);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
}
.btn-link:hover {
    color: var(--green);
}

/* --- Results Section --- */
#resultsArea {
    display: none;
    padding: 30px;
    background: var(--bg-light);
    animation: slideIn 0.4s ease;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Winner Banner */
.winner-banner {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid var(--green);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}
.winner-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.winner-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green-dark);
    margin-bottom: 8px;
    position: relative;
}
.winner-summary {
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
}

/* Result Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 25px;
}
@media (max-width: 600px) {
    .summary-cards { grid-template-columns: 1fr; }
}
.card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.card-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    direction: ltr;
}
.card-winner {
    border-color: var(--green);
    background: linear-gradient(135deg, #ffffff 0%, #f0fff0 100%);
    box-shadow: 0 4px 15px rgba(0,200,5,0.15);
}
.card-winner .card-value {
    color: var(--green-dark);
}
.card-winner .card-label {
    color: var(--green-dark);
}

/* Action Buttons Row */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}
.action-buttons .btn-secondary {
    flex: 1;
    padding: 12px;
    font-size: 0.9rem;
    border-radius: 8px;
}

/* --- Charts & Tables --- */
.charts-wrapper {
    margin-top: 25px;
    background: var(--bg-white);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}
@media (min-width: 600px) {
    .chart-container { height: 350px; }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: 10px;
    max-height: 350px;
    overflow-y: auto;
    background: var(--bg-white);
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 550px;
}
th, td {
    padding: 12px 14px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}
th {
    background: var(--gray-light);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}
td { color: var(--text-primary); }
tr:hover td {
    background: var(--bg-light);
}

/* --- Table Winner Highlighting --- */
.table-buy-winner { background: rgba(0, 200, 5, 0.08); }
.table-rent-winner { background: rgba(100, 100, 100, 0.05); }
.value-winner { color: var(--green-dark); font-weight: 600; }

/* --- Formulas/Info Area --- */
#formulasArea {
    display: none;
    margin-top: 15px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    animation: slideIn 0.3s ease;
}
.formula-box {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border);
}
.formula-box:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.formula-box strong {
    color: var(--green-dark);
    font-size: 0.95rem;
}
.math-expr {
    font-family: 'Courier New', monospace;
    background: var(--gray-light);
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 6px;
    display: inline-block;
    direction: ltr;
    margin: 10px 0;
    font-size: 0.9rem;
}
.formula-note {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Sensitivity Analysis --- */
.sensitivity-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px dashed var(--border);
}
.grid-ui-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.criteria-box {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    transition: all 0.2s;
}
.criteria-box:hover {
    border-color: #c5ccd4;
}
.criteria-row-top {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}
.criteria-row-top input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--green);
    cursor: pointer;
}
.criteria-row-top select {
    flex: 1;
    padding: 10px;
    font-size: 0.85rem;
}
.criteria-row-bottom {
    display: flex;
    align-items: center;
    gap: 10px;
}
.criteria-row-bottom input {
    padding: 10px;
    font-size: 0.9rem;
}
.dash {
    color: var(--text-muted);
    font-weight: 600;
}

.stats-box {
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e9 100%);
    border: 2px solid var(--green);
    border-radius: 12px;
    padding: 20px;
    margin-top: 25px;
    text-align: center;
    font-size: 1rem;
}
.stats-box .win-buy { color: var(--green-dark); font-weight: 700; }
.stats-box .win-rent { color: var(--text-primary); font-weight: 600; }

.analysis-win-buy { color: var(--green-dark); font-weight: 700; }
.analysis-win-rent { color: var(--text-secondary); font-weight: 600; }
.analysis-table-row:nth-child(even) { background-color: var(--bg-light); }
.analysis-table-row.buy-winner td { background: rgba(0, 200, 5, 0.05); }
.analysis-table-row.rent-winner td { background: rgba(156, 163, 175, 0.05); }

/* --- Sensitivity Analysis Charts --- */
.sensitivity-charts-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}
.sensitivity-chart-panel {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px;
}
.sensitivity-chart-panel .chart-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 10px;
}
.sensitivity-chart-panel .chart-container {
    height: 280px;
}
.sensitivity-charts-grid.one-chart .sensitivity-chart-panel .chart-container {
    height: 320px;
}

/* --- FAQ Section --- */
.faq-section {
    padding: 30px;
    border-top: 1px solid var(--border);
}
.faq-item {
    border: 2px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: all 0.2s;
}
.faq-item:hover {
    border-color: #c5ccd4;
}
.faq-question {
    font-weight: 600;
    color: var(--text-primary);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    transition: all 0.2s;
}
.faq-question:hover {
    background: var(--bg-light);
}
.faq-question::after {
    content: '+';
    font-size: 1.4rem;
    color: var(--green);
    font-weight: 300;
    transition: transform 0.3s;
}
.faq-question.open::after {
    transform: rotate(45deg);
}
.faq-answer {
    display: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.8;
    padding: 0 20px 16px;
    background: var(--bg-white);
}
.faq-answer.open {
    display: block;
    animation: slideIn 0.3s ease;
}

/* --- Advanced Settings --- */
.advanced-toggle {
    margin-top: 12px;
}
.advanced-content {
    display: none;
    margin-top: 12px;
    padding: 16px;
    background: var(--gray-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    animation: slideIn 0.3s ease;
}
.advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.tax-brackets-toggle {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}
.tax-brackets-content {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.bracket-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.bracket-row input {
    padding: 8px;
    font-size: 0.85rem;
}
.bracket-row span {
    color: var(--text-secondary);
    white-space: nowrap;
}
.purchase-tax-display {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--green-light);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--green-dark);
    font-weight: 500;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Table Area Hidden */
#tableArea {
    display: none;
    margin-top: 15px;
}

/* --- Partner Recommendations (Native Style) --- */
.partner-section {
    padding: 30px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
}
.partner-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
    text-align: center;
}
.partner-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 700px) {
    .partner-grid {
        grid-template-columns: 1fr;
    }
}

/* Native Recommendation Card */
.recommendation-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.recommendation-card:hover {
    border-color: var(--green);
    box-shadow: 0 8px 25px rgba(0,200,5,0.12);
    transform: translateY(-3px);
}
.recommendation-header {
    display: flex;
    align-items: center;
    gap: 15px;
}
.recommendation-icon {
    width: 50px;
    height: 50px;
    background: var(--green-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.recommendation-investment .recommendation-icon {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
}
.recommendation-info h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}
.recommendation-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}
.recommendation-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.recommendation-feature {
    background: var(--gray-light);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.recommendation-cta {
    display: inline-block;
    background: var(--green);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}
.recommendation-cta:hover {
    background: var(--green-dark);
    transform: translateY(-1px);
}
.recommendation-cta-investment {
    background: #1976d2;
}
.recommendation-cta-investment:hover {
    background: #1565c0;
}
.recommendation-disclosure {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 5px;
}

/* External Content Section (Google Ads placeholder) */
.external-content {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    margin: 20px 30px;
}
.external-content-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.external-content-placeholder {
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* --- Share Button --- */
.btn-share {
    background: var(--bg-white);
    border: 2px solid var(--border);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-share:hover {
    border-color: var(--green);
    background: var(--green-light);
    color: var(--green-dark);
}
.btn-share svg {
    width: 18px;
    height: 18px;
}
.share-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--text-primary);
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.share-toast.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* --- Feedback Section --- */
.feedback-section {
    padding: 30px;
    border-top: 1px solid var(--border);
    background: var(--bg-white);
}
.feedback-form {
    max-width: 500px;
    margin: 0 auto;
}
.feedback-form .form-group {
    margin-bottom: 16px;
}
.feedback-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Rubik', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all 0.2s ease;
    resize: vertical;
    min-height: 100px;
}
.feedback-form textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0,200,5,0.15);
}
.feedback-success {
    display: none;
    text-align: center;
    padding: 20px;
    background: var(--green-light);
    border-radius: 10px;
    color: var(--green-dark);
}
.feedback-success.show {
    display: block;
    animation: slideIn 0.3s ease;
}

/* --- Logo Animation --- */
.logo-container {
    margin-bottom: 20px;
}
.logo-svg {
    width: 80px;
    height: 80px;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}
.hero-enhanced {
    background: linear-gradient(135deg, #f8fffe 0%, #e8f5e9 50%, #d4edda 100%);
    position: relative;
    overflow: hidden;
}
.hero-enhanced::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 30%, rgba(0, 200, 5, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 70% 70%, rgba(0, 160, 0, 0.03) 0%, transparent 50%);
    pointer-events: none;
}
