/* Bi-Weekly Mortgage Payments Calculator Styles */
/* Prefix: bwmp- */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bwmp-body {
    width: 100%;
    box-sizing: border-box;
}

/* CMS compatibility - Force wide layout */
.c-matter--article .c-matter__body {
    max-width: 1170px !important;
    width: 100% !important;
}

.ci-body {
    width: 100%;
    max-width: 1170px;
    margin: 0 auto;
}

@media(min-width: 992px) {
    .c-matter--article .c-matter__body:has(.ci-body) {
        max-width: 1170px !important;
        width: auto !important;
    }
}

.c-matter--article .bwmp-body,
.c-matter--article .bwmp-container {
    max-width: 1170px !important;
    width: 100% !important;
}

@media (max-width: 950px) {
    .c-matter--article .c-matter__body {
        max-width: 750px !important;
        padding: 1.5rem;
    }
}

@media (max-width: 750px) {
    .c-matter--article .c-matter__body {
        max-width: 100% !important;
        margin: 10px;
        padding: 1rem;
        border-radius: 8px;
    }
}

/* Container and layout */
.bwmp-container {
    max-width: 1170px;
    margin: 2rem auto 4rem auto;
    padding: 0 2rem;
    background: transparent;
    box-sizing: border-box;
}

/* Two-column layout */
.bwmp-calculator-layout {
    display: grid !important;
    grid-template-columns: 0.48fr 0.52fr !important;
    gap: 24px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    align-items: start !important;
}

.c-matter--article .bwmp-calculator-layout {
    display: grid !important;
    grid-template-columns: 0.48fr 0.52fr !important;
    gap: 24px !important;
}

.bwmp-form-column {
    background: #f7fafc;
    border: 2px solid #f3f4f6;
    border-radius: var(--radius-lg);
    padding: 26px;
    margin-bottom: 24px;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    height: fit-content;
    transform: translateZ(0);
    will-change: transform;
}

/* Sticky positioning - desktop only */
@media (min-width: 751px) {
    .bwmp-form-column {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        align-self: start !important;
    }
}

.bwmp-results-column {
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.bwmp-results-column * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Header */
.bwmp-header {
    text-align: center;
    margin-bottom: 48px;
    padding-bottom: 0;
}

.bwmp-header p {
    max-width: none;
    margin: 0;
    line-height: 1.7;
    font-weight: 400;
}

/* Form section headings */
.bwmp-form-column h2,
.bwmp-chart-section h2 {
    font-weight: 500;
    margin-bottom: 20px;
    margin-top: 0px;
    letter-spacing: -0.01em;
    text-align: center;
}

/* Labels */
.bwmp-form-column > label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    margin-top: 20px;
    letter-spacing: -0.005em;
    cursor: default !important;
}

.bwmp-form-column > label:first-of-type {
    margin-top: 0;
}

/* Tooltip styles */
.bwmp-tooltip {
    display: inline-block;
    margin-left: 6px;
    width: 18px;
    height: 18px;
    background: #64748b;
    color: white;
    border-radius: 50%;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    line-height: 18px;
    transition: all 0.2s ease;
    vertical-align: middle;
    flex-shrink: 0;
}

.bwmp-tooltip:hover {
    background: #475569;
    transform: scale(1.1);
}

.bwmp-tooltip.active {
    z-index: 99999;
}

.bwmp-tooltip.active::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 400;
    white-space: normal;
    width: 280px;
    text-align: left;
    z-index: 99999;
    box-shadow: var(--shadow-lg);
    line-height: 1.5;
    pointer-events: none;
}

.bwmp-tooltip.active::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1e293b;
    z-index: 99999;
    pointer-events: none;
}

/* Input wrapper for currency and percent symbols */
.bwmp-input-wrapper {
    position: relative;
}

.bwmp-currency {
    position: absolute;
    left: 12px;
    top: 46%;
    transform: translateY(-50%);
    font-weight: 500;
    font-size: 1em;
    pointer-events: none;
    z-index: 2;
    color: #64748b;
}

.bwmp-unit {
    position: absolute;
    right: 35px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 500;
    font-size: 1em;
    pointer-events: none;
    z-index: 10;
    color: #64748b;
}

/* Input styles */
input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 400;
}

/* Hide native steppers */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] {
    -moz-appearance: textfield;
}

/* Custom stepper buttons */
.bwmp-stepper {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    gap: 1px;
}

.bwmp-stepper-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    position: relative;
}

.bwmp-stepper-btn::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    display: block;
}

.bwmp-stepper-btn--up::before {
    border-bottom: 4px solid #555;
    border-top: none;
}

.bwmp-stepper-btn--down::before {
    border-top: 4px solid #555;
    border-bottom: none;
}

.bwmp-stepper-btn:hover::before {
    border-bottom-color: #333 !important;
    border-top-color: #333 !important;
}

/* Show steppers on hover/focus */
.bwmp-input-wrapper:hover .bwmp-stepper {
    opacity: 1;
    pointer-events: auto;
}

.bwmp-input-wrapper:has(input:focus) .bwmp-stepper {
    opacity: 1;
    pointer-events: auto;
}

.bwmp-input-wrapper:hover .bwmp-stepper .bwmp-stepper-btn,
.bwmp-input-wrapper:has(input:focus) .bwmp-stepper .bwmp-stepper-btn {
    pointer-events: auto;
}

/* Add padding for inputs with custom steppers */
.bwmp-input-wrapper:has(.bwmp-stepper) input {
    padding-right: 35px;
}

/* Input padding for currency symbol */
.bwmp-input-wrapper:has(.bwmp-currency) input {
    padding-left: 28px;
}

/* Input padding for unit symbol with stepper */
.bwmp-has-unit-stepper input {
    padding-right: 85px !important;
}

input[type="text"]::placeholder {
    color: rgba(0, 0, 0, 0.55);
    opacity: 1;
}

input[type="text"]:focus,
input[type="number"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgb(16 185 129 / 0.08);
}

/* Disclaimer text */
.bwmp-disclaimer-text {
    margin-top: 24px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f3f3f3;
    border-left: 3px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.5;
}

/* Button styles */
.bwmp-download-section {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 32px;
    margin-bottom: 0;
}

.bwmp-download-section .c-btn {
    flex: 1;
}

.bwmp-button-mobile {
    display: none;
}

/* Results section */
.bwmp-main-result {
    background: #f8fafc;
    padding: 26px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 24px;
    border: 1px solid #e2e8f0;
}

.bwmp-main-result h2 {
    font-weight: 500;
    margin-bottom: 16px;
    letter-spacing: -0.01em;
}

.bwmp-main-value {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--paletteColor3, #10b981);
}

.bwmp-explanation-text {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: left;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #475569;
}

/* Comparison section - two columns */
.bwmp-comparison {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.bwmp-comparison-column {
    background: #f8fafc;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.bwmp-comparison-column.bwmp-comparison-highlight {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border-color: var(--paletteColor3, #10b981);
    border-width: 2px;
}

.bwmp-comparison-column h3 {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
}

.bwmp-comparison-highlight h3 {
    border-bottom-color: var(--paletteColor3, #10b981);
    color: var(--paletteColor3, #047857);
}

.bwmp-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.bwmp-breakdown-label {
    font-size: 0.9rem;
    font-weight: 400;
    color: #475569;
}

.bwmp-breakdown-value {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.bwmp-breakdown-value.bwmp-highlight {
    color: var(--paletteColor3, #10b981);
}

/* Chart section */
.bwmp-chart-section {
    background: #f7fafc;
    border: 2px solid #f3f4f6;
    border-radius: var(--radius-lg);
    padding: 26px;
    margin-bottom: 32px;
    box-shadow: none;
}

.bwmp-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.bwmp-chart-header h2 {
    margin-bottom: 0;
    flex: 1;
}

.bwmp-chart-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.bwmp-chart-toggle:hover {
    background: #f1f5f9;
}

.bwmp-caret {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid #64748b;
    transition: transform 0.3s ease;
    display: block;
}

.bwmp-chart-section.collapsed .bwmp-caret {
    transform: rotate(180deg);
}

.bwmp-chart-toggle:hover .bwmp-caret {
    border-bottom-color: #475569;
}

.bwmp-chart-content {
    margin-top: 20px;
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.bwmp-chart-section.collapsed .bwmp-chart-content {
    max-height: 0;
    margin-top: 0;
    opacity: 0;
    overflow: hidden;
}

.bwmp-chart-container {
    position: relative;
    height: 350px;
    width: 100%;
    contain: layout;
    min-height: 200px;
}

.bwmp-chart-container canvas {
    max-width: 100%;
    height: 350px !important;
    width: 100% !important;
}

/* Responsive */
@media (max-width: 950px) {
    .bwmp-container {
        max-width: 750px;
        padding: 0 1.5rem;
        margin: 1.5rem auto 3rem auto;
    }
}

@media (max-width: 900px) {
    .bwmp-download-section {
        flex-direction: column;
    }
    
    .bwmp-download-section .c-btn {
        width: 100%;
    }
    
    .bwmp-comparison {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 750px) {
    .bwmp-container {
        max-width: 100%;
        margin: 0.5rem auto 1rem auto;
        padding: 0;
    }
    
    .bwmp-calculator-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bwmp-form-column {
        position: static !important;
    }
    
    .bwmp-results-column {
        position: static !important;
        min-height: 0 !important;
    }
    
    .bwmp-header {
        text-align: left;
        margin-bottom: 24px;
    }
    
    .bwmp-chart-section h2 {
        text-align: left;
    }
    
    .bwmp-main-result {
        text-align: left;
    }
    
    .bwmp-form-column {
        padding: 16px;
    }
    
    .bwmp-chart-section {
        padding: 16px;
    }
    
    .bwmp-main-result {
        padding: 24px 16px;
    }
    
    .bwmp-comparison-column {
        padding: 16px;
    }
    
    .bwmp-download-desktop {
        display: none;
    }
    
    .bwmp-button-mobile {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-top: 24px;
        width: 100%;
    }
    
    .bwmp-button-mobile .c-btn {
        width: 100%;
    }
    
    .bwmp-chart-container {
        height: auto;
    }
}

@media (max-width: 480px) {
    .bwmp-form-column {
        padding: 12px;
    }
    
    .bwmp-chart-section {
        padding: 12px;
    }
    
    .bwmp-main-result {
        padding: 20px 12px;
    }
    
    .bwmp-comparison-column {
        padding: 12px;
    }
    
    .bwmp-main-value {
        font-size: 2rem;
    }
    
    .bwmp-breakdown-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .bwmp-chart-container {
        height: auto;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
    }
    
    .bwmp-container {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }
    
    .bwmp-form-column,
    .bwmp-download-section,
    .bwmp-button-mobile {
        display: none;
    }
}

