/* Tulpcalc screen layout */
.tulpcalc-wrapper {
    max-width: 1100px;
    margin: 20px auto;
    padding: 24px;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
    background: #fff;
}

.tulpcalc-inputs-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    align-items: end;
}

.tulpcalc-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tulpcalc-input-group label {
    font-weight: 600;
}

.tulpcalc-input-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
}

.tulpcalc-btn {
    border: 0;
    padding: 11px 18px;
    cursor: pointer;
    font-weight: 600;
    background: #0073aa;
    color: #fff;
}

.tulpcalc-btn.secondary {
    background: #555;
}

.tulpcalc-results {
    margin: 24px 0;
    font-size: 20px;
    font-weight: 700;
}

.tulpcalc-graphs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 20px 0 30px;
}

.tulpcalc-chart-wrapper {
    position: relative;
    height: 360px;
    min-height: 360px;
}

.tulpcalc-chart-wrapper canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.tulpcalc-table-section {
    margin-top: 25px;
}

.tulpcalc-table {
    width: 100%;
    border-collapse: collapse;
}

.tulpcalc-table th,
.tulpcalc-table td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: right;
}

.tulpcalc-table th:first-child,
.tulpcalc-table td:first-child {
    text-align: left;
}

/*
 * Print layout.
 * Chart.js uses responsive canvases, so give the chart containers a
 * fixed print height and force the canvas to occupy that space.
 * This prevents the print renderer from seeing a zero-height canvas.
 */
@media print {
    @page {
        size: A4 portrait;
        margin: 12mm;
    }

    html,
    body {
        background: #fff !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .tulpcalc-wrapper {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .tulpcalc-inputs-section {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 10px !important;
    }

    .tulpcalc-input-group input {
        border: 1px solid #999 !important;
        background: #fff !important;
    }

    .tulpcalc-btn,
    .tulpcalc-print-action {
        display: none !important;
    }

    .tulpcalc-results {
        margin: 12px 0 !important;
        font-size: 18px !important;
    }

    .tulpcalc-graphs-row {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .tulpcalc-chart-wrapper {
        position: relative !important;
        width: 100% !important;
        height: 300px !important;
        min-height: 300px !important;
        overflow: hidden !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .tulpcalc-chart-wrapper canvas {
        display: block !important;
        width: 100% !important;
        height: 300px !important;
        max-height: 300px !important;
    }

    .tulpcalc-table-section {
        page-break-before: auto;
        break-before: auto;
    }

    .tulpcalc-table {
        font-size: 10px;
    }

    .tulpcalc-table th,
    .tulpcalc-table td {
        padding: 5px;
    }
}

@media screen and (max-width: 800px) {
    .tulpcalc-inputs-section {
        grid-template-columns: 1fr 1fr;
    }

    .tulpcalc-graphs-row {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 520px) {
    .tulpcalc-inputs-section {
        grid-template-columns: 1fr;
    }
}

/* Car Finance Calculator */
.tulpcalc-calculator-title {
    margin: 0 0 6px;
    font-size: 28px;
}

.tulpcalc-calculator-intro {
    margin: 0 0 24px;
    color: #555;
}

.tulpcalc-car-inputs {
    grid-template-columns: repeat(3, 1fr);
}

.tulpcalc-optional {
    font-size: 12px;
    font-weight: 400;
    color: #666;
}

.tulpcalc-error {
    display: none;
    margin-top: 16px;
    padding: 10px 12px;
    border: 1px solid #d63638;
    background: #fff5f5;
    color: #b32d2e;
}

.tulpcalc-car-results {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin: 24px 0;
}

.tulpcalc-car-result-card {
    border: 1px solid #ddd;
    padding: 14px;
    box-sizing: border-box;
}

.tulpcalc-car-result-card span {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    color: #555;
}

.tulpcalc-car-result-card strong {
    display: block;
    font-size: 20px;
}

@media print {
    .tulpcalc-car-results {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }

    .tulpcalc-car-result-card {
        padding: 9px !important;
    }

    .tulpcalc-car-result-card strong {
        font-size: 15px !important;
    }
}

@media screen and (max-width: 900px) {
    .tulpcalc-car-inputs {
        grid-template-columns: repeat(2, 1fr);
    }

    .tulpcalc-car-results {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 520px) {
    .tulpcalc-car-inputs,
    .tulpcalc-car-results {
        grid-template-columns: 1fr;
    }
}
