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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-titles {
    text-align: left;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 600;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.95;
}

/* Share Button */
.share-button {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.share-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.share-button.copied {
    background: #27ae60;
    border-color: #27ae60;
}

.share-icon {
    font-size: 1.1rem;
}

/* Print Button */
.print-button {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.print-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
}

.print-icon {
    font-size: 1.1rem;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    min-height: 600px;
}

/* Left Column - Input Section */
.input-section {
    padding: 30px;
    background: #f8f9fa;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.input-group {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.input-group h2 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c3e50;
}

.accordion-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.3s;
    margin-bottom: 15px;
}

.accordion-header:hover {
    color: #34495e;
}

.accordion-icon {
    font-size: 0.8rem;
    transition: transform 0.3s;
    color: #7f8c8d;
}

.input-group.closed .accordion-icon {
    transform: rotate(0deg);
}

.accordion-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.toggle-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.toggle-label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 1rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #2c3e50;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.input-group h3 {
    font-size: 1rem;
    color: #34495e;
    margin: 15px 0 10px 0;
}

.form-field {
    margin-bottom: 15px;
}

.form-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.95rem;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-field input:focus,
.form-field select:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44, 62, 80, 0.1);
}

.info-field {
    margin-bottom: 15px;
}

.info-field label {
    display: block;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
    font-size: 0.95rem;
}

.info-text {
    padding: 10px;
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    color: #1565c0;
    font-size: 0.95rem;
    border-radius: 4px;
}

.calculate-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(44, 62, 80, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Right Column - Results Section */
.results-section {
    padding: 30px;
    background: white;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.results-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    color: #999;
    font-size: 1.1rem;
}

.validation-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    padding: 40px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    margin: 20px;
}

.validation-error .error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.validation-error h3 {
    font-size: 1.5rem;
    color: #856404;
    margin-bottom: 15px;
}

.validation-error p {
    color: #856404;
    font-size: 1.1rem;
    margin-bottom: 10px;
    max-width: 500px;
}

.validation-error .hint {
    font-size: 0.95rem;
    opacity: 0.8;
    font-style: italic;
}

/* Results Display */
.results-content {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2c3e50;
}

.result-card h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
}

.result-card h3 {
    font-size: 1.1rem;
    color: #667eea;
    margin-bottom: 10px;
}

.weekly-cost {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: center;
}

.weekly-cost h2 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    opacity: 0.9;
}

.weekly-cost .amount {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 10px 0;
}

.weekly-cost .amount.positive {
    color: #d4edda;
}

.weekly-cost .amount.negative {
    color: #f8d7da;
}

.weekly-cost .per-person {
    font-size: 1rem;
    opacity: 0.9;
}

.weekly-cost .weekly-detail {
    margin-top: 8px;
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    opacity: 0.95;
}

.rent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.rent-year {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.rent-year label {
    display: block;
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 5px;
    font-weight: 500;
}

.rent-year input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.rent-year input:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.1);
}

.scenario-section {
    background: white;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.scenario-section.low {
    border-top: 4px solid #f39c12;
}

.scenario-section.base {
    border-top: 4px solid #27ae60;
}

.scenario-section.high {
    border-top: 4px solid #2980b9;
}

.scenario-section h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.scenario-section.low h3 {
    color: #f39c12;
}

.scenario-section.base h3 {
    color: #27ae60;
}

.scenario-section.high h3 {
    color: #2980b9;
}

.profit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
}

.profit-row:last-child {
    margin-bottom: 0;
}

.profit-row .label {
    font-weight: 500;
    color: #555;
}

.profit-row .value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.profit-row .value.positive {
    color: #4caf50;
}

.profit-row .value.negative {
    color: #f44336;
}

.summary-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #2c3e50;
}

.summary-card h3 {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 15px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.summary-item .label {
    font-weight: 500;
    color: #555;
    line-height: 1.4;
}

.summary-item .label small {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.8;
}

.summary-item .value {
    font-weight: 700;
    color: #2c3e50;
    font-size: 1.1rem;
}

.summary-item .value.highlight {
    color: #27ae60;
    font-size: 1.2rem;
}

.breakdown-section {
    margin-bottom: 25px;
}

.breakdown-section h4 {
    font-size: 1.1rem;
    color: #34495e;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border: 1px solid #ecf0f1;
}

.breakdown-item.total {
    background: #e8f5e8;
    border-color: #27ae60;
    font-weight: 600;
}

.breakdown-item .label {
    font-size: 0.9rem;
    color: #555;
}

.breakdown-item .value {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
    display: inline-block;
}

/* Add info icon indicator for mobile */
.tooltip::before {
    content: "ℹ️";
    font-size: 0.85em;
    margin-left: 4px;
    opacity: 0.6;
    display: none;
}

/* Show info icon on touch devices */
@media (hover: none) and (pointer: coarse) {
    .tooltip::before {
        display: inline;
    }
    
    .tooltip {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 280px;
    background-color: #2c3e50;
    color: #fff;
    text-align: left;
    border-radius: 6px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -140px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* Adjust tooltip positioning on mobile */
@media (max-width: 768px) {
    .tooltip .tooltiptext {
        width: 240px;
        margin-left: -120px;
        font-size: 0.8rem;
    }
}

.tooltip .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

/* Show tooltip on hover (desktop) */
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Show tooltip when active (mobile tap) */
.tooltip.active .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Cashflow Breakdown Styles */
.cashflow-breakdown {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.cashflow-breakdown h4 {
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.breakdown-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 6px;
    background: white;
    border-radius: 4px;
}

.breakdown-line.subtotal {
    border-top: 2px solid #e9ecef;
    margin-top: 8px;
    font-weight: 600;
}

.breakdown-line.total {
    border-top: 2px solid #2c3e50;
    margin-top: 8px;
    background: #e8f5e8;
    font-weight: 700;
}

.breakdown-label {
    font-size: 0.9rem;
    color: #555;
}

.breakdown-value {
    font-size: 0.95rem;
    font-weight: 600;
}

.breakdown-value.positive {
    color: #27ae60;
}

.breakdown-value.negative {
    color: #e74c3c;
}

.breakdown-value.neutral {
    color: #7f8c8d;
    font-style: italic;
}

.breakdown-value span {
    color: #2c3e50;
}

.breakdown-value span strong {
    font-weight: 600;
}

.breakdown-value span strong.positive {
    color: #27ae60;
}

.breakdown-value span strong.negative {
    color: #e74c3c;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .input-section,
    .results-section {
        max-height: none;
    }

    .results-section {
        border-top: 2px solid #eee;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .input-section,
    .results-section {
        padding: 20px;
    }

    .weekly-cost .amount {
        font-size: 2rem;
    }

    .profit-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* ============================================
   NON-TAX-DEDUCTIBLE SHORTFALL CARD
   ============================================ */

.shortfall-card {
    animation: slideInFade 0.4s ease-out;
}

@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.breakdown-section-header {
    user-select: none;
}

/* Shortfall warning pulse animation */
.shortfall-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 14px;
    background: linear-gradient(45deg, #ef5350, #ff8a80, #ef5350);
    opacity: 0;
    z-index: -1;
    animation: shortfallPulse 2s ease-in-out infinite;
}

@keyframes shortfallPulse {
    0%, 100% { opacity: 0; }
    50% { opacity: 0.3; }
}

/* Print report shortfall section */
.print-shortfall-section {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 6px;
    padding: 4mm;
    margin-bottom: 4mm;
    page-break-inside: avoid;
}

/* ============================================
   PRINT REPORT STYLES
   ============================================ */

.print-report-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 10000;
    overflow-y: auto;
    padding: 0;
}

.print-report-overlay.active {
    display: block;
}

.print-report {
    max-width: 210mm;
    margin: 0 auto;
    padding: 20mm 15mm;
    font-family: 'Georgia', 'Times New Roman', serif;
    color: #1a1a1a;
    line-height: 1.5;
    background: white;
}

.print-report h1 {
    font-size: 24pt;
    color: #1a365d;
    margin-bottom: 5mm;
    font-weight: 700;
    border-bottom: 3px solid #1a365d;
    padding-bottom: 3mm;
}

.print-report h2 {
    font-size: 14pt;
    color: #2c5282;
    margin: 8mm 0 4mm 0;
    font-weight: 600;
    border-bottom: 1px solid #cbd5e0;
    padding-bottom: 2mm;
}

.print-report h3 {
    font-size: 11pt;
    color: #4a5568;
    margin: 5mm 0 3mm 0;
    font-weight: 600;
}

.print-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8mm;
}

.print-header-info {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 9pt;
    color: #718096;
}

.print-close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #e53e3e;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.print-close-btn:hover {
    background: #c53030;
}

.print-actions {
    position: fixed;
    top: 20px;
    right: 120px;
    display: flex;
    gap: 10px;
    z-index: 10001;
}

.print-now-btn {
    background: #2b6cb0;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.print-now-btn:hover {
    background: #2c5282;
}

/* Executive Summary Box */
.print-summary-box {
    background: linear-gradient(135deg, #ebf8ff 0%, #e6fffa 100%);
    border: 2px solid #2b6cb0;
    border-radius: 8px;
    padding: 5mm;
    margin-bottom: 6mm;
}

.print-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4mm;
}

.print-summary-item {
    text-align: center;
    padding: 3mm;
    background: white;
    border-radius: 6px;
}

.print-summary-item .label {
    font-size: 8pt;
    color: #4a5568;
    margin-bottom: 1mm;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.print-summary-item .value {
    font-size: 14pt;
    font-weight: 700;
    color: #1a365d;
}

.print-summary-item .value.positive {
    color: #276749;
}

.print-summary-item .value.negative {
    color: #c53030;
}

/* Data Tables */
.print-table {
    width: 100%;
    border-collapse: collapse;
    margin: 4mm 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 9pt;
}

.print-table th {
    background: #2d3748;
    color: white;
    padding: 3mm 2mm;
    text-align: left;
    font-weight: 600;
}

.print-table th.right {
    text-align: right;
}

.print-table td {
    padding: 2.5mm 2mm;
    border-bottom: 1px solid #e2e8f0;
}

.print-table td.right {
    text-align: right;
}

.print-table tr:nth-child(even) {
    background: #f7fafc;
}

.print-table tr.highlight {
    background: #ebf8ff;
    font-weight: 600;
}

.print-table tr.total {
    background: #2d3748;
    color: white;
    font-weight: 700;
}

/* Comparison Section */
.print-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5mm;
    margin: 4mm 0;
}

.print-comparison-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 4mm;
}

.print-comparison-card.property {
    border-color: #48bb78;
    background: #f0fff4;
}

.print-comparison-card.super {
    border-color: #4299e1;
    background: #ebf8ff;
}

.print-comparison-card h4 {
    font-size: 10pt;
    margin: 0 0 3mm 0;
    padding-bottom: 2mm;
    border-bottom: 1px solid currentColor;
}

.print-comparison-card.property h4 {
    color: #276749;
}

.print-comparison-card.super h4 {
    color: #2b6cb0;
}

/* Footer */
.print-footer {
    margin-top: 10mm;
    padding-top: 5mm;
    border-top: 1px solid #cbd5e0;
    font-size: 8pt;
    color: #718096;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.print-disclaimer {
    font-style: italic;
    margin-top: 3mm;
}

/* Print-specific media query */
@media print {
    body {
        background: white !important;
        padding: 0 !important;
    }
    
    .container {
        display: none !important;
    }
    
    .print-report-overlay {
        display: block !important;
        position: static !important;
        overflow: visible !important;
    }
    
    .print-close-btn,
    .print-actions {
        display: none !important;
    }
    
    .print-report {
        padding: 10mm;
        max-width: none;
    }
    
    .print-summary-box,
    .print-comparison-card {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .print-table th {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .print-table tr:nth-child(even) {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    h2 {
        page-break-after: avoid;
    }
    
    .print-table {
        page-break-inside: avoid;
    }
    
    .print-comparison {
        page-break-inside: avoid;
    }
}
