/* ==========================================================================
   Clear Title Partners-inspired Calculator Styles
   ========================================================================== */

/* Root wrapper */
.ctc-calculator {
    max-width: 1200px;
    margin: 40px auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Header */
.ctc-calculator h3 {
    margin: 0 0 12px 0;
    color: #005bac;
    font-size: 2.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ctc-calculator p {
    margin: 0 0 28px 0;
    color: #444;
    font-size: 1.1rem;
    line-height: 1.55;
}

/* Grid - 60/40 split */
.ctc-calculator-grid {
    display: grid;
    grid-template-columns: 60% 40%;
    gap: 36px;
    margin-top: 24px;
}

/* Input panel - white card matching site style */
.ctc-inputs-column {
    background: #ffffff;
    border: 1px solid #e0e7f1;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 91, 172, 0.08);
    padding: 32px;
    min-width: 0;
    box-sizing: border-box;
}

/* Fix input overflow & consistent sizing */
.ctc-inputs-column *,
.ctc-inputs-column *::before,
.ctc-inputs-column *::after {
    box-sizing: border-box;
}

.ctc-inputs-column label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1a2b4c;
    font-size: 1.05rem;
}

.ctc-inputs-column input,
.ctc-inputs-column select {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid #c3d4e8;
    border-radius: 8px;
    font-size: 1rem;
    color: #1f2937;
    background: #fafcff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ctc-inputs-column input:focus,
.ctc-inputs-column select:focus {
    outline: none;
    border-color: #005bac;
    box-shadow: 0 0 0 3px rgba(0, 91, 172, 0.15);
}

.ctc-inputs-column select {
    max-width: 100%;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23005bac' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
}

/* Date Picker */
.date-picker-wrapper {
    margin-bottom: 1.4rem;
}

.date-picker-wrapper label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.date-picker-wrapper .required-indicator {
    color: #d32f2f;
    margin-left: 0.25rem;
}

.input-with-icon {
    position: relative;
}

.date-picker-input {
    width: 100%;
    padding: 0.65rem 2.8rem 0.65rem 0.9rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.date-picker-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.calendar-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform-transform: translateY(-50%);
    pointer-events: none;
    font-size: 1.3rem;
    color: #6b7280;
}

.help-text {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.875rem;
    color: #6b7280;
}

/* ==========================================================================
   Custom Premium Checkbox
   ========================================================================== */

/* Container for checkbox + label */
.ctc-checkbox-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 1.4rem;
    cursor: pointer;
    user-select: none;
}

/* Hide the native checkbox */
.ctc-checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/*: Custom checkbox box */
.ctc-checkbox-wrapper label {
    position: relative;
    padding-left: 36px;               /* space for the checkbox */
    font-weight: 500;
    color: #1a2b4c;
    font-size: 1.05rem;
    line-height: 1.5;
    transition: color 0.2s ease;
}

/* The box itself */
.ctc-checkbox-wrapper label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ffffff;
    border: 2px solid #c3d4e8;
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.18s ease;
}

/* Hover state */
.ctc-checkbox-wrapper:hover label::before {
    border-color: #a8c4e8;
    box-shadow: 0 0 0 3px rgba(0, 91, 172, 0.08);
}

/* Focus state (accessibility) */
.ctc-checkbox-wrapper input[type="checkbox"]:focus-visible + label::before {
    outline: none;
    border-color: #005bac;
    box-shadow: 0 0 0 4px rgba(0, 91, 172, 0.22);
}

/* Checked state */
.ctc-checkbox-wrapper input[type="checkbox"]:checked + label::before {
    background: #005bac;
    border-color: #005bac;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}

/* Checkmark (using pseudo-element) */
.ctc-checkbox-wrapper input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 50%;
    width: 7px;
    height: 13px;
    border: solid white;
    border-width: 0 3px 3px 0;
42    transform: translateY(-50%) rotate(45deg) scale(0.8);
    opacity: 0;
    transition: all 0.22s ease;
}

/* Animate checkmark in when checked */
.ctc-checkbox-wrapper input[type="checkbox"]:checked + label::after {
    opacity: 1;
    transform: translateY(-50%) rotate(45deg) scale(1);
}

.ctc-checkbox-wrapper input[type="checkbox"]:checked + label::before {
    transform: translateY(-50%) scale(1.03);
}

.ctc-calculator button {
    padding: 14px 36px;
    background: #005bac;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.08rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.1s ease;
}

.ctc-calculator button:hover {
    background: #0066cc;
}

.ctc-calculator button:active {
    transform: translateY(1px);
}

.ctc-results-column {
    align-self: start;
    position: relative;
}

.ctc-results {
    background: #f5f9ff;
    border: 1px solid #d1e3ff;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 91, 172, 0.08);
    padding: 32px;
    min-height: 200px;
    display: block !important;
}

.ctc-results h4 {
    margin: 0 0 20px 0;
    color: #005bac;
    font-size: 1.45rem;
    font-weight: 700;
}

.ctc-results .results-container p {
    margin: 14px 0;
    padding: 10px 0;
    font-size: 1.08rem;
    color: #1f2937;
    border-bottom: 1px solid #e0eaff;
}

.ctc-results .results-container p:last-child {
    border-bottom: none;
}

.ctc-results .results-container p strong {
    color: #0f172a;
}

.results-container .results-placeholder {
    display: block;
    text-align: center;
    color: #64748b;
    font-style: italic;
    font-size: 1.1rem;
    padding: 70px 0;
    margin: 0;
}

.results-container:not([data-empty="true"]) .results-placeholder,
.results-container.has-results .results-placeholder {
    display: none;
}

/* ==========================================================================
   Sticky / Floating Results Panel
   ========================================================================== */

.ctc-results.stuck {
    position: fixed;
    top: 24px;
    z-index: 20;
    box-sizing: border-box;
    box-shadow: 0 10px 38px rgba(0, 91, 172, 0.18);
    border-color: #a8c4e8;
    background: #f5f9ff;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.ctc-results.bottomed {
    position: relative;
    top: auto;
    box-shadow: 0 6px 20px rgba(0, 91, 172, 0.08);
    border-color: #d1e3ff;
}

/* Error message */
.ctc-error {
    margin-top: 16px;
    padding: 14px 20px;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    font-size: 0.98rem;
}

/* Mobile - stack vertically & disable sticky behavior */
@media (max-width: 900px) {
    .ctc-calculator-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .ctc-results-column {
        order: 2;
    }

    .ctc-calculator {
        margin: 24px 16px;
    }

    /* Disable sticky/fixed positioning on mobile */
    .ctc-results.stuck,
    .ctc-results.bottomed {
        position: relative !important;
        top: auto !important;
        width: 100% !important;
        max-width: none !important;
        box-shadow: 0 6px 20px rgba(0, 91, 172, 0.08) !important;
        border-color: #d1e3ff !important;
    }
}

/* Small screens */
@media (max-width: 480px) {
    .ctc-calculator h3 {
        font-size: 1.7rem;
    }

    .ctc-calculator button {
        width: 100%;
        padding: 15px;
    }
}

/* ==========================================================================
   Collapsible Sections
   ========================================================================== */

.ctc-calculator .collapsible-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    user-select: none;
    margin-top: 32px;
}

.ctc-calculator .collapsible-section:first-child .section-header {
    margin-top: 20px;
}

.ctc-calculator .collapsible-section .section-header h4 {
    margin: 0;
    color: #005bac;
    font-size: 1.45rem;
    font-weight: 700;
}

.ctc-calculator .collapsible-section .toggle-icon {
    font-size: 1.5em;
    font-weight: bold;
    color: #005bac;
    transition: transform 0.2s ease;
}

.ctc-calculator .collapsible-section .section-content {
    display: none;
    padding: 20px 0 8px;
}

.ctc-calculator .collapsible-section.expanded .section-content {
    display: block;
}

/* Optional: slight animation on toggle icon */
.ctc-calculator .collapsible-section.expanded .toggle-icon {
    transform: rotate(180deg);
}