/* 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 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* CMS Content Width Override - Forces 1170px container */
.c-matter--article .c-matter__body {
    max-width: 1170px;
    width: 1170px;
}

@media (max-width: 950px) {
    .c-matter--article .c-matter__body {
        width: 100%;
        max-width: 750px;
        padding: 0;
    }
}

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

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

/* Intro text between title and calculator */
.bola-body .bola-container p.bola-intro-text {
    margin: 0 auto 2rem auto;
    text-align: center;
    max-width: 90%;
    display: block;
    padding: 0;
    width: 100%;
}

/* Two-column layout for desktop */
.bola-calculator-layout {
    display: grid;
    grid-template-columns: 48% 52%;
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    align-items: start;
    -webkit-align-items: start;
    grid-template-rows: auto;
}

.bola-form-column {
    background: #f7fafc;
    border: 2px solid #f3f4f6;
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    align-self: start;
    -webkit-align-self: start;
    position: sticky;
    top: 2rem;
}

.bola-results-column {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    align-self: start;
    -webkit-align-self: start;
}

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

/* Header */
.bola-header {
    text-align: left;
    margin-bottom: 32px;
    padding-bottom: 0;
}

/* Placeholder content styles */
.bola-placeholder {
    background: #f7fafc;
    border: 2px solid #f3f4f6;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: none;
    text-align: left;
}

.bola-placeholder__icon {
    margin-bottom: 1rem;
    text-align: center;
}

/* Form sections */
.bola-input-section {
    margin-bottom: 1rem;
    padding: 0;
    background: transparent;
    border: none;
}

.bola-section-heading h2 {
    margin: 1rem 0;
}

.bola-helper-text {
    margin-bottom: 8px;
    opacity: 0.8;
}

/* Input groups */
.bola-input-group {
    margin-bottom: 20px;
}

.bola-input-label {
    display: block;
    margin-bottom: 8px;
    position: relative;
    font-weight: 600;
}

/* Input wrapper for currency and percent symbols */
.bola-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* Stepper buttons (up/down arrows) - subtle design */
.bola-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;
}

/* Adjust stepper position when suffix exists */
.bola-input-wrapper:has(.bola-input-suffix) .bola-stepper {
    right: 50px;
}

.bola-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;
    transition: opacity 0.15s ease;
    opacity: 0.5;
}

.bola-stepper-btn:hover {
    opacity: 1;
}

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

.bola-stepper-btn--up::before {
    border-bottom: 5px solid #9ca3af;
    border-top: none;
}

.bola-stepper-btn--down::before {
    border-top: 5px solid #9ca3af;
    border-bottom: none;
}

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

/* Show steppers on hover - multiple selectors for compatibility */
.bola-input-group:hover .bola-stepper {
    opacity: 1;
    pointer-events: auto;
}

.bola-input-wrapper:hover .bola-stepper {
    opacity: 1;
    pointer-events: auto;
}

.bola-input:focus + .bola-stepper {
    opacity: 1;
    pointer-events: auto;
}

/* Enable pointer events on buttons when stepper is visible */
.bola-input-group:hover .bola-stepper .bola-stepper-btn,
.bola-input-wrapper:hover .bola-stepper .bola-stepper-btn,
.bola-input:focus ~ .bola-stepper .bola-stepper-btn {
    pointer-events: auto;
}

@media (max-width: 750px) {
    .bola-input-wrapper:has(.bola-input:focus) .bola-stepper {
        opacity: 1;
        pointer-events: auto;
    }
}

.bola-input-prefix {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 1 !important;
    line-height: 1 !important;
    pointer-events: none !important;
    color: #6b7280 !important;
}

.bola-input-suffix {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
}

/* Input styles */
.bola-input {
    width: 100%;
    padding: 14px 12px;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    background: #ffffff;
}

/* Placeholder styling - 55% opacity */
.bola-input::placeholder {
    opacity: 0.55;
    color: inherit;
    font-style: normal;
}

.bola-input::-webkit-input-placeholder {
    opacity: 0.55;
    color: inherit;
}

.bola-input::-moz-placeholder {
    opacity: 0.55;
    color: inherit;
}

.bola-input:focus::placeholder {
    opacity: 0;
}

/* Currency inputs need extra left padding */
.bola-input-wrapper .bola-input-prefix + .bola-input {
    padding-left: 32px !important;
}

/* Percentage inputs need right padding for % symbol */
.bola-input-wrapper input[type="text"]:has(+ .bola-input-suffix) {
    padding-right: 45px !important;
}

.bola-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgb(16 185 129 / 0.08);
}

.bola-input:hover {
    border-color: #9ca3af;
}

/* Error messages */
.bola-error-message {
    margin: -0.5rem 0 2rem 0;
    display: none;
    color: #ef4444;
}

.bola-error-message.show {
    display: block;
}

.bola-input-group.error > .bola-input-wrapper > .bola-input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgb(239 68 68 / 0.1);
}

/* Required field styling */
.bola-input-group.bola-required-empty .bola-input {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgb(239 68 68 / 0.1) !important;
}

.bola-input-group.bola-required-empty .bola-input-label::after {
    content: " *";
    color: #ef4444;
}

/* Required field animation */
.bola-input-group.bola-required-empty .bola-input {
    animation: bola-required-pulse 2s ease-in-out;
}

@keyframes bola-required-pulse {
    0%, 100% { border-color: #ef4444; }
    50% { border-color: #f87171; }
}

/* Action buttons at bottom of results section */
.bola-results-button-group {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

.bola-start-over-btn,
.bola-download-pdf-btn {
    /* Uses .c-btn website styles by default */
    flex: 1;
    min-width: 180px;
    max-width: 250px;
}

/* Example values text styling */
.bola-example-text {
    margin-top: 8px;
    margin-bottom: 24px;
    opacity: 0.75;
}

/* Results section */
.bola-results {
    background: #f7fafc;
    border: 2px solid #f3f4f6;
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 0;
    max-width: 100%;
    overflow: hidden;
    box-shadow: none;
}

/* Results header */
.bola-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 1rem;
}

.bola-results-header h2 {
    margin: 1rem 0 0 0;
}

.bola-results-header h3 {
    margin: 0;
}

.bola-result-summary__subtitle {
    opacity: 0.7;
    margin: 0;
}

/* Result cards */
.bola-result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    width: 100%;
    max-width: 100%;
}

.bola-result-card {
    background: #ffffff;
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid #f3f4f6;
    transition: all 0.2s ease;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.bola-result-card:hover {
    box-shadow: var(--shadow-md);
}

.bola-result-card__header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bola-result-card__label {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bola-result-card__icon {
    font-size: 20px;
}

.bola-result-card--buy .bola-result-card__header {
    border-bottom-color: #3b82f6;
}

.bola-result-card--lease .bola-result-card__header {
    border-bottom-color: #8b5cf6;
}

.bola-result-card__metrics {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bola-metric {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.bola-metric--highlight {
    padding-top: 16px;
    border-top: 2px solid #f3f4f6;
    margin-top: 8px;
}

.bola-metric__label {
    letter-spacing: 0.03em;
}

.bola-metric__value {
    font-weight: 600;
    letter-spacing: -0.02em;
}

.bola-metric__value--large {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Difference Summary Card */
.bola-difference-summary {
    margin-bottom: 24px;
}

.bola-difference-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.bola-difference-card--better-lease {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.bola-difference-card__content {
    width: 100%;
    color: white;
}

.bola-difference-card__content h2, h3 {
    width: 100%;
    color: white;
}

.bola-difference-card__label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.bola-difference-card__value {
    font-weight: bold;
    line-height: 1;
    margin: 1rem auto;
    letter-spacing: -0.02em;
    font-size: 3rem;
}

.bola-difference-card__description {
    opacity: 0.95;
}

/* Chart section */
.bola-chart-section {
    background: #ffffff;
    padding: 16px 12px 12px 12px;
    border-radius: var(--radius-lg);
    margin: 20px 0 16px 0;
    box-shadow: var(--shadow-sm);
    border: 1px solid #f3f4f6;
    max-width: 100%;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.bola-chart-section h4 {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
    letter-spacing: -0.01em;
}

.bola-chart-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 300px;
    box-sizing: border-box;
}

@media (max-width: 750px) {
    .bola-chart-container {
        height: 250px;
    }
}

.bola-chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

/* Loading overlay */
.bola-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.bola-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #10b981;
    border-radius: 50%;
    animation: bola-spin 0.8s linear infinite;
}

@keyframes bola-spin {
    to { transform: rotate(360deg); }
}

/* Results footnote */
.bola-results-footnote {
    opacity: 0.7;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
}

/* Slider styles - visible on desktop and mobile */
/* Default fallback values (FMG brand color) - will be overridden by JS if heading color detected */
:root {
    --bola-slider-r: 0;
    --bola-slider-g: 106;
    --bola-slider-b: 133;
    /* Darker version for thumb (30% darker than track color) */
    --bola-slider-thumb-r: 0;
    --bola-slider-thumb-g: 74;
    --bola-slider-thumb-b: 93;
}

.bola-slider {
    margin-top: 1rem;
    margin-bottom: 1rem;
    display: block;
}

.bola-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    opacity: 0.7;
}

.bola-slider-label-min,
.bola-slider-label-max {
    display: inline-block;
}

.bola-slider input[type="range"] {
    width: 100%;
    appearance: none;
    height: 4px;
    border-radius: 4px;
    background-color: rgba(var(--bola-slider-r), var(--bola-slider-g), var(--bola-slider-b), 0.2);
}

.bola-slider input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgb(var(--bola-slider-thumb-r), var(--bola-slider-thumb-g), var(--bola-slider-thumb-b));
    cursor: pointer;
    border: none;
    transition: transform 0.18s ease;
}

.bola-slider input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.1);
}

.bola-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: rgb(var(--bola-slider-thumb-r), var(--bola-slider-thumb-g), var(--bola-slider-thumb-b));
    cursor: pointer;
    border: none;
}

/* Tooltip styles */
.bola-tooltip {
    position: relative;
}

.bola-tooltip__trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #666;
    padding: 0.2rem;
    border-radius: 4px;
}

.bola-tooltip__trigger:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 106, 133, 0.2);
}

.bola-tooltip__panel {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    width: min(260px, 70vw);
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 5;
    font-weight: normal;
}

.bola-tooltip--open .bola-tooltip__panel {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* Hidden elements */
.bola-hidden {
    display: none !important;
}

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

@media (max-width: 750px) {
    .bola-container {
        max-width: 100%;
        margin: 0.5rem auto 1rem auto;
        padding: 0 0.5rem;
    }
    
    /* Stack vertically on mobile */
    .bola-calculator-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .bola-results-column {
        position: static;
    }
    
    .bola-form-column {
        padding: 16px;
        position: static;
    }
    
    .bola-placeholder, 
    .bola-results {
        padding: 16px;
    }
    
    .bola-input-group {
        margin-bottom: 16px;
    }
    
    .bola-result-cards {
        grid-template-columns: 1fr;
    }
    
    .bola-difference-card {
        text-align: center;
    }
    
    .bola-results-button-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .bola-start-over-btn,
    .bola-download-pdf-btn {
        width: 100% !important;
        max-width: 100% !important;
        justify-content: center;
    }
    
    .bola-results-header {
        flex-direction: column;
    }
    
    /* Mobile slider improvements for better touch targets */
    .bola-slider input[type="range"] {
        height: 8px;
        border-radius: 6px;
    }
    
    .bola-slider input[type="range"]::-webkit-slider-thumb {
        width: 28px;
        height: 28px;
    }
    
    .bola-slider input[type="range"]::-moz-range-thumb {
        width: 28px;
        height: 28px;
    }
    
    /* Add visual separation between input groups on mobile */
    .bola-input-group {
        border-bottom: 1px solid #f3f4f6;
    }
    
    .bola-input-group:last-child {
        border-bottom: none;
    }
}

@media (max-width: 480px) {
    .bola-form-column {
        padding: 12px;
    }
    
    .bola-placeholder, 
    .bola-results {
        padding: 12px;
    }
    
    .bola-result-card {
        padding: 16px 12px;
    }
    
    .bola-difference-card__value {
        font-size: 2.5rem;
    }
}

/* Print styles */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .bola-form-column,
    .bola-placeholder,
    .bola-start-over-btn,
    .bola-download-pdf-btn,
    button[data-bola-action="start-over"],
    button,
    .c-btn {
        display: none !important;
    }
    
    .bola-calculator-layout {
        display: block !important;
        grid-template-columns: none !important;
    }
    
    .bola-results-column {
        width: 100% !important;
        position: static !important;
    }
    
    .bola-results {
        background: white !important;
        border: 1pt solid #e5e7eb !important;
        padding: 20pt !important;
        margin: 0 !important;
        page-break-inside: avoid;
    }
    
    .bola-results h2 {
        margin: 0 0 15pt 0 !important;
        border-bottom: 1pt solid #e5e7eb !important;
        padding-bottom: 8pt !important;
    }
    
    .bola-difference-card {
        background: #10b981 !important;
        border: 1pt solid #059669 !important;
        padding: 15pt !important;
        margin: 15pt 0 !important;
        page-break-inside: avoid;
    }
    
    .bola-result-card {
        background: white !important;
        border: 1pt solid #dee2e6 !important;
        padding: 12pt !important;
        margin: 8pt 0 !important;
        page-break-inside: avoid;
    }
    
    .bola-chart-section {
        background: #f8f9fa !important;
        border: 1pt solid #dee2e6 !important;
        padding: 15pt !important;
        margin: 15pt 0 !important;
        text-align: center !important;
        page-break-inside: avoid;
    }
    
    .bola-chart-section canvas {
        display: none !important;
    }
    
    .bola-chart-section::after {
        content: "Chart available in digital version";
        display: block !important;
        color: #6c757d !important;
        margin-top: 10pt;
    }
    
    @page {
        margin: 0.75in;
        size: letter;
    }
}
