/* ===== ROI Calculator Page Styles ===== */

/* Page Layout */
.roi-page {
    background: #f5f7f5;
    min-height: 100vh;
}

.roi-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 48px;
}

.roi-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: #1a1a2e;
    margin: 12px 0 16px;
    line-height: 1.2;
}

.roi-subtitle {
    font-size: 1.05rem;
    color: #666;
    line-height: 1.7;
}

/* Legend */
.roi-legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 48px;
    flex-wrap: wrap;
    padding: 16px 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.input-color {
    background: #E3F2FD;
    border: 2px solid #2196F3;
}

.select-color {
    background: #FFF3E0;
    border: 2px solid #FF9800;
}

.calc-color {
    background: #F5F5F5;
    border: 2px solid #9E9E9E;
}

.result-color {
    background: #E8F5E9;
    border: 2px solid #4CAF50;
}

.legend-text {
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
}

/* ROI Sections */
.roi-section {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.roi-section-header {
    margin-bottom: 32px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.roi-section-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #2E7D32;
    color: #fff;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.roi-section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
    line-height: 1.3;
}

.roi-section-header p {
    font-size: 0.9rem;
    color: #888;
    margin: 0;
}

/* Sub-sections */
.roi-subsection {
    margin-bottom: 32px;
}

.roi-subsection:last-child {
    margin-bottom: 0;
}

.roi-subsection-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2E7D32;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #E8F5E9;
}

/* Tables */
.roi-table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.roi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.roi-table thead th {
    background: #1a1a2e;
    color: #fff;
    font-weight: 600;
    padding: 14px 16px;
    text-align: left;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.roi-table thead th:first-child {
    border-top-left-radius: 8px;
}

.roi-table thead th:last-child {
    border-top-right-radius: 8px;
}

.roi-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.roi-table tbody tr:hover {
    background: #f9faf9;
}

.roi-table tbody tr:last-child {
    border-bottom: none;
}

.roi-table td {
    padding: 12px 16px;
    vertical-align: middle;
}

/* Column widths */
.col-label, .col-item, .col-desc { min-width: 180px; }
.col-value, .col-price, .col-total { min-width: 120px; text-align: right; }
.col-unit, .col-note, .col-source { min-width: 100px; }
.col-qty { width: 80px; text-align: center; }
.col-ratio { width: 80px; text-align: right; }
.col-no { width: 50px; text-align: center; }
.col-type { width: 100px; }

/* Input Fields */
.roi-input {
    width: 120px;
    padding: 8px 12px;
    border: 2px solid #2196F3;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: #1565C0;
    background: #E3F2FD;
    text-align: right;
    transition: all 0.2s;
    font-weight: 600;
}

.roi-input:focus {
    outline: none;
    border-color: #1565C0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(33,150,243,0.15);
}

.roi-input-sm {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid #2196F3;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: #1565C0;
    background: #E3F2FD;
    text-align: center;
    transition: all 0.2s;
    font-weight: 600;
}

.roi-input-sm:focus {
    outline: none;
    border-color: #1565C0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(33,150,243,0.15);
}

/* Select Fields */
.roi-select {
    width: 100%;
    min-width: 280px;
    padding: 8px 12px;
    border: 2px solid #FF9800;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    color: #E65100;
    background: #FFF3E0;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.roi-select:focus {
    outline: none;
    border-color: #E65100;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(255,152,0,0.15);
}

/* Input marker */
.input-marker {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #2196F3;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Cell Styles */
.param-label {
    font-weight: 600;
    color: #333;
}

.param-item {
    font-weight: 500;
    color: #333;
}

.param-unit {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

.param-note {
    font-size: 0.8rem;
    color: #aaa;
}

.param-source {
    font-size: 0.8rem;
    color: #999;
}

.param-no {
    text-align: center;
    color: #999;
    font-weight: 600;
}

.param-type {
    font-weight: 600;
    color: #555;
}

.param-desc {
    color: #444;
}

/* Calculated rows */
.calc-row {
    background: #fafafa;
}

.calc-value {
    font-weight: 600;
    color: #555;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Total rows */
.total-row {
    background: #E8F5E9;
    border-top: 2px solid #4CAF50;
}

.total-label {
    font-weight: 700;
    color: #1B5E20;
    text-align: right;
    padding-right: 24px;
}

.result-value {
    font-weight: 800;
    color: #1B5E20;
    text-align: right;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums;
}

/* Result rows */
.result-row {
    background: #F1F8E9;
    border-top: 1px solid #C5E1A5;
}

.result-row .param-label {
    color: #1B5E20;
    font-weight: 700;
}

/* Cost Breakdown Layout */
.roi-breakdown-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
    align-items: start;
}

/* Chart Container */
.roi-chart-container {
    text-align: center;
    padding: 24px;
    background: #f9faf9;
    border-radius: 12px;
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 16px;
}

.donut-chart {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.donut-label {
    font-size: 1.4rem;
    font-weight: 800;
    fill: #1a1a2e;
}

.donut-sublabel {
    font-size: 0.7rem;
    fill: #999;
}

.chart-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: #555;
}

.chart-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.metric-card {
    padding: 28px 24px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
    border: 1px solid #e0e0e0;
}

.highlight-card {
    background: linear-gradient(135deg, #fff 0%, #f0f7f0 100%);
    border: 1px solid #C5E1A5;
}

.highlight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(46,125,50,0.12);
    border-color: #4CAF50;
}

.metric-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    color: #2E7D32;
}

.metric-icon svg {
    width: 100%;
    height: 100%;
}

.metric-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.metric-unit {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 4px;
}

/* Projection table */
.roi-table-projection .col-year {
    text-align: center;
    width: 80px;
}

.roi-table-projection .col-revenue,
.roi-table-projection .col-cost,
.roi-table-projection .col-profit,
.roi-table-projection .col-cumulative {
    text-align: right;
}

.year-0 {
    background: #FFF3E0;
    font-weight: 600;
}

.year-positive {
    color: #2E7D32;
    font-weight: 700;
}

.year-negative {
    color: #D32F2F;
    font-weight: 600;
}

/* Bar Chart */
.roi-chart-bar-container {
    margin-top: 32px;
    padding: 24px;
    background: #f9faf9;
    border-radius: 12px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 240px;
    padding: 20px 0;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.bar-item {
    flex: 1;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    height: 100%;
    justify-content: flex-end;
}

.bar-fill {
    width: 100%;
    max-width: 60px;
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease, background 0.3s;
    position: relative;
    min-height: 4px;
}

.bar-fill.positive {
    background: linear-gradient(180deg, #66BB6A 0%, #2E7D32 100%);
}

.bar-fill.negative {
    background: linear-gradient(180deg, #EF5350 0%, #C62828 100%);
}

.bar-value {
    font-size: 0.75rem;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
}

.bar-label {
    font-size: 0.8rem;
    color: #888;
    font-weight: 600;
}

/* Action Buttons */
.roi-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.roi-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.roi-btn-primary {
    background: #2E7D32;
    color: #fff;
}

.roi-btn-primary:hover {
    background: #1B5E20;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.3);
}

.roi-btn-secondary {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
}

.roi-btn-secondary:hover {
    border-color: #2196F3;
    color: #2196F3;
    transform: translateY(-2px);
}

.roi-btn-tertiary {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
}

.roi-btn-tertiary:hover {
    border-color: #FF9800;
    color: #FF9800;
    transform: translateY(-2px);
}

/* Disclaimer */
.roi-disclaimer {
    padding: 20px 24px;
    background: #FFF8E1;
    border: 1px solid #FFE082;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #795548;
    line-height: 1.6;
    margin-bottom: 40px;
}

.roi-disclaimer strong {
    color: #E65100;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .roi-breakdown-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .roi-section {
        padding: 24px 20px;
    }

    .roi-section-header {
        flex-direction: column;
        gap: 8px;
    }

    .roi-section-num {
        width: 40px;
        height: 40px;
        font-size: 0.95rem;
    }

    .roi-section-header h2 {
        font-size: 1.25rem;
    }

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

    .roi-legend {
        gap: 16px;
    }

    .roi-table {
        font-size: 0.82rem;
    }

    .roi-table td,
    .roi-table th {
        padding: 10px 8px;
    }

    .roi-input {
        width: 100px;
        font-size: 0.82rem;
    }

    .roi-input-sm {
        width: 50px;
    }

    .roi-select {
        min-width: 200px;
        font-size: 0.82rem;
    }
}

@media (max-width: 480px) {
    .roi-table-wrapper {
        overflow-x: scroll;
    }

    .metric-value {
        font-size: 1.4rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .roi-actions,
    .roi-legend,
    .footer {
        display: none !important;
    }

    .roi-page {
        background: #fff;
        padding-top: 20px;
    }

    .roi-section {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        padding: 20px;
    }

    .roi-input,
    .roi-input-sm,
    .roi-select {
        border: 1px solid #ccc;
        background: #fff;
        color: #000;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .calc-row,
    .total-row,
    .result-row,
    .highlight-card,
    .legend-color {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== CAPEX Equipment Notice ===== */
.capex-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    color: #78350f;
    font-size: 0.88rem;
    line-height: 1.6;
}

.capex-notice svg {
    flex-shrink: 0;
    color: #f59e0b;
    margin-top: 2px;
}

.capex-notice a {
    color: #1a1a2e;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted #78350f;
}

.capex-notice a:hover {
    color: #f59e0b;
    border-bottom-color: #f59e0b;
}

/* ===== SSLUCE Contact Notice ===== */
.ssluce-contact-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f3 100%);
    border-left: 4px solid #4caf50;
    border-radius: 6px;
    color: #2e5d31;
    font-size: 0.85rem;
    line-height: 1.6;
}

.ssluce-contact-notice svg {
    flex-shrink: 0;
    color: #4caf50;
    margin-top: 2px;
}

.ssluce-contact-notice a {
    color: #1a1a2e;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted #2e5d31;
}

.ssluce-contact-notice a:hover {
    color: #4caf50;
    border-bottom-color: #4caf50;
}

/* SSLUCE source marker */
.ssluce-source {
    color: #4caf50 !important;
    font-weight: 600;
    cursor: help;
    position: relative;
}

.ssluce-source:hover::after {
    content: "For accurate pricing, please contact SSLUCE sales team.";
    position: absolute;
    bottom: 100%;
    right: 0;
    background: #1a1a2e;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10;
    margin-bottom: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ===== Source Column Region Dropdown ===== */
.roi-source-select {
    font-size: 0.8rem;
    padding: 4px 6px;
    height: auto;
    min-height: auto;
}


/* Highlight effect when value applied */
.roi-input.applied-flash {
    animation: inputFlash 0.6s ease;
}

@keyframes inputFlash {
    0% { background: #fff9c4; box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.4); }
    100% { background: #fff; box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

@media (max-width: 768px) {
    .capex-notice,
    .ssluce-contact-notice {
        font-size: 0.82rem;
        padding: 10px 12px;
    }
}
