/* Career Break Calculator - Styled to match geo-arbitrage plugin */

.cbs-container {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.cbs-calculator-root {
    background: #ffffff;
    border: 1px solid #083141;
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Header */
.cbs-header {
    margin-bottom: 1.5rem;
}

.cbs-header h1 {
    margin: 0 0 0.3rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #083141;
}

.cbs-subtitle {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
    color: #334155;
}

/* Steps */
.cbs-step {
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
    margin-top: 1.25rem;
}

.cbs-step:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.cbs-step h2 {
    margin: 0 0 0.2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #083141;
}

.cbs-step p {
    margin: 0 0 0.9rem;
    font-size: 0.9rem;
    color: #6b7280;
}

/* Grid */
.cbs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.9rem;
    align-items: stretch; /* Make all grid items the same height */
}

@media (max-width: 720px) {
    .cbs-grid {
        grid-template-columns: 1fr;
    }
}

/* Fields */
.cbs-input {
    display: grid;
    grid-template-rows: auto auto 1fr auto; /* label, help, input, error */
    gap: 0.25rem;
    height: 100%; /* Take full height of grid cell */
}

.cbs-input label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
    height: 1.25rem; /* Fixed single line label height */
    display: flex;
    align-items: center;
    line-height: 1.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cbs-help-text {
    font-size: 0.78rem;
    color: #6b7280;
    min-height: 2.5rem; /* Fixed help text height - allows for 2-3 lines */
    max-height: 2.5rem;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cbs-help-text:empty {
    display: block;
    visibility: hidden; /* Reserve space even when no help text */
    height: 2.5rem;
    margin: 0;
    padding: 0;
}

.cbs-input input {
    border-radius: 8px;
    border: 1px solid #d1d5db;
    padding: 0.4rem 0.55rem;
    font-size: 0.9rem;
    width: 100%;
    box-sizing: border-box;
    background: #f9fafb;
    color: #111827;
}

.cbs-input input:focus {
    outline: 2px solid #083141;
    outline-offset: 0;
    background: #ffffff;
    box-shadow: 0 0 0 1px rgba(8, 49, 65, 0.15);
}


.cbs-error {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 0.2rem;
    display: none;
}

.cbs-error--show {
    display: block;
}

.cbs-input input.cbs-input--error {
    border-color: #dc2626;
    background: #fef2f2;
}

/* Checkboxes */
.cbs-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cbs-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
}

.cbs-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

/* Results */
.cbs-results {
    margin-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
}

.cbs-badge-ok {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #4ade80;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.cbs-badge-fail {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
    border-radius: 999px;
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.cbs-warnings {
    margin-bottom: 1rem;
}

.cbs-warning {
    background: #fefce8;
    border: 1px solid #eab308;
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
    color: #92400e;
    font-size: 0.85rem;
}

/* FIRE summary panel */
.cbs-fire-summary {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.cbs-fire-summary strong {
    font-weight: 700;
    color: #083141;
}

.cbs-fire-summary p {
    margin: 0.25rem 0;
    color: #374151;
}

.cbs-fire-summary .cbs-fire-impact {
    margin-top: 0.5rem;
    font-weight: 600;
    color: #083141;
}

.cbs-tax-summary {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    color: #6b7280;
}

/* Download CSV – front and centre */
.cbs-csv-cta {
    margin-top: 1.75rem;
    padding: 30px 24px;
    border-top: 3px solid #1d4ed8;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08) 0%, rgba(37, 99, 235, 0.02) 100%);
    border-radius: 16px;
    text-align: center;
}
.cbs-csv-cta-title {
    margin: 0 0 0.35rem 0;
    color: #083141;
    font-size: 1.15rem;
    font-weight: 800;
}
.cbs-csv-cta-subtitle {
    margin: 0 0 1rem 0;
    color: #334155;
    font-size: 0.95rem;
}
.cbs-btn--csv-cta {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: 3px solid #1d4ed8;
    color: #fff;
    padding: 18px 36px;
    font-size: 18px;
    font-weight: 800;
    min-height: 56px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}
.cbs-btn--csv-cta:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
}

/* Actions */
.cbs-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.cbs-btn {
    padding: 0.6rem 1.2rem;
    background: #f0f4f8;
    border: 1.5px solid #083141;
    border-radius: 8px;
    color: #083141;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(8, 49, 65, 0.1);
}

.cbs-btn:hover {
    background: #083141;
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(8, 49, 65, 0.2);
    transform: translateY(-1px);
}

.cbs-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(8, 49, 65, 0.1);
}

.cbs-btn-small {
    padding: 0.4rem 0.8rem;
    background: #f0f4f8;
    border: 1.5px solid #083141;
    border-radius: 6px;
    color: #083141;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cbs-btn-small:hover {
    background: #083141;
    color: #ffffff;
}

.cbs-btn-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.cbs-btn-danger:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

/* Table */
.cbs-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 600px; /* Limit table height to reduce scrolling */
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    margin-top: 1rem;
}

.cbs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem; /* Smaller font for more compact table */
}

.cbs-table thead {
    background: #ebf2f4;
    display: table-header-group;
}

.cbs-table thead tr {
    display: table-row;
}

.cbs-table th,
.cbs-table td {
    padding: 0.5rem 0.4rem; /* Reduced padding for more compact table */
    text-align: right;
    border-bottom: 1px solid #e5e7eb;
    display: table-cell;
    white-space: nowrap; /* Prevent text wrapping in table cells */
}

.cbs-table th {
    font-weight: 600;
    color: #083141;
    background: #f9fafb;
    border-bottom: 2px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 0.7rem; /* Smaller header font */
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-align: center; /* Center align headers for better appearance */
    padding: 0.5rem 0.4rem; /* Match cell padding */
}

.cbs-table th:first-child,
.cbs-table td:first-child {
    text-align: left;
}

.cbs-table th:nth-child(2) {
    text-align: center; /* "Break?" column */
}

.cbs-table td:nth-child(2) {
    text-align: center; /* "Break?" column */
}

.cbs-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.cbs-table tbody tr:hover {
    background: #f0f4f8;
}

.cbs-table tbody tr.cbs-break-row {
    background: #fefce8;
}

.cbs-table tbody tr.cbs-break-row:hover {
    background: #fef9c3;
}

/* Scenarios Section */
.cbs-scenarios {
    margin-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
}

.cbs-scenarios h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: #083141;
}

.cbs-scenarios-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.cbs-scenario-item {
    padding: 0.85rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.cbs-scenario-name {
    font-weight: 600;
    color: #083141;
    flex: 1;
    min-width: 200px;
    font-size: 0.9rem;
}

.cbs-scenario-meta {
    font-size: 0.85rem;
    color: #6b7280;
    flex: 1;
    min-width: 200px;
}

.cbs-scenario-actions {
    display: flex;
    gap: 0.5rem;
}

/* Charts */
.cbs-charts {
    margin-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1.25rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.25rem;
}

.cbs-chart-card {
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    padding: 0.9rem 1rem;
}

.cbs-chart-card h3 {
    margin: 0 0 0.25rem;
    font-size: 0.96rem;
    font-weight: 600;
    color: #083141;
}

.cbs-chart-card p {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #6b7280;
}

.cbs-chart-card canvas {
    width: 100%;
    max-height: 320px;
}

.cbs-chart-wrapper {
    position: relative;
    width: 100%;
    height: 300px;
    margin-top: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    background: #ffffff;
    box-sizing: border-box;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cbs-container {
        padding: 1rem 0.75rem;
    }

    .cbs-calculator-root {
        padding: 1rem;
        border-radius: 10px;
    }

    .cbs-grid {
        grid-template-columns: 1fr;
    }

    .cbs-table-wrapper {
        font-size: 0.8rem;
    }

    .cbs-table th,
    .cbs-table td {
        padding: 0.5rem 0.4rem;
    }

    .cbs-scenario-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .cbs-scenario-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .cbs-actions {
        flex-direction: column;
    }

    .cbs-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cbs-header h1 {
        font-size: 1.25rem;
    }

    .cbs-step {
        padding-top: 1rem;
    }

    .cbs-step h2 {
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .cbs-actions,
    .cbs-scenarios,
    .cbs-charts {
        display: none;
    }

    .cbs-step {
        page-break-inside: avoid;
    }

    .cbs-table {
        font-size: 0.75rem;
    }
}

/* Accessibility */
.cbs-input input::-webkit-outer-spin-button,
.cbs-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cbs-input input[type="number"] {
    -moz-appearance: textfield;
}

.cbs-input input:focus-visible {
    outline: 2px solid #083141;
    outline-offset: 2px;
}

.cbs-btn:focus-visible {
    outline: 2px solid #083141;
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
