/* Variables */
:root {
    --bpc-primary: #8b5cf6; /* Purple from goosed gradient */
    --bpc-primary-light: #a78bfa;
    --bpc-primary-dark: #7c3aed;
    --bpc-secondary: #ec4899; /* Magenta from goosed gradient */
    --bpc-gradient: linear-gradient(135deg, var(--bpc-primary) 0%, var(--bpc-secondary) 100%);
    --bpc-text: #1f2937;
    --bpc-border: #e5e7eb;
    --bpc-background: #ffffff;
    --bpc-success: #10b981;
    --bpc-error: #ef4444;
    --bpc-neutral: #6b7280;
    --bpc-spacing: 1rem;
    --bpc-border-radius: 12px;
    --bpc-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.1), 0 2px 4px -1px rgba(139, 92, 246, 0.06);
    --bpc-focus-outline: 2px solid var(--bpc-primary);
    --bpc-focus-offset: 2px;
}

/* Base styles - Mobile First */
.bpc-calculator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--bpc-text);
    max-width: 100%;
    margin: 1rem auto;
    padding: 1rem;
    font-size: 16px; /* Prevent zoom on iOS */
    line-height: 1.6;
    position: relative;
}

/* Subtle goosed branding header */
.bpc-calculator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bpc-gradient);
    border-radius: var(--bpc-border-radius) var(--bpc-border-radius) 0 0;
}

/* Focus styles for accessibility */
.bpc-input:focus,
#plan-selector:focus,
.bpc-suggestion-item:focus {
    outline: var(--bpc-focus-outline);
    outline-offset: var(--bpc-focus-offset);
    border-color: var(--bpc-primary);
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

/* Skip to content link for screen readers */
.bpc-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Plan Selector Styles */
#plan-selector {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--bpc-border);
    border-radius: var(--bpc-border-radius);
    font-size: 1rem;
    line-height: 1.5;
    background-color: var(--bpc-background);
    min-height: 48px; /* Touch-friendly size */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#plan-selector:focus {
    border-color: var(--bpc-primary);
}

#plan-selector optgroup {
    font-weight: bold;
    color: var(--bpc-primary);
}

#plan-selector option {
    padding: 0.5rem;
    color: var(--bpc-text);
}

/* Selected Plan Info */
.bpc-selected-plan {
    margin-top: var(--bpc-spacing);
    padding: var(--bpc-spacing);
    background-color: #f8f9fa;
    border-radius: var(--bpc-border-radius);
    border-left: 4px solid var(--bpc-primary);
}

.bpc-selected-plan p {
    margin: 0.5rem 0;
    line-height: 1.4;
}

.bpc-selected-plan strong {
    color: var(--bpc-primary);
}

/* Helper text */
.bpc-helper-text {
    font-size: 0.875rem;
    color: var(--bpc-neutral);
    margin-top: 0.25rem;
    line-height: 1.4;
}

/* Disabled input styles */
.bpc-input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Enhanced section styling with goosed aesthetic */
.bpc-section {
    background: var(--bpc-background);
    border: 1px solid var(--bpc-border);
    border-radius: var(--bpc-border-radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--bpc-shadow);
    position: relative;
    overflow: hidden;
}

.bpc-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--bpc-gradient);
    opacity: 0.6;
}

.bpc-section h2 {
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bpc-border);
    font-size: 1.5rem;
    color: var(--bpc-primary);
    font-weight: 600;
    position: relative;
}

.bpc-section h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: var(--bpc-gradient);
    border-radius: 1px;
}

/* Form groups - Mobile first */
.bpc-form-group {
    margin-bottom: 1.5rem;
}

/* Enhanced label styling to accommodate info buttons */
.bpc-form-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--bpc-text);
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Input styles */
.bpc-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--bpc-border);
    border-radius: var(--bpc-border-radius);
    font-size: 1rem;
    line-height: 1.5;
    background-color: var(--bpc-background);
    min-height: 48px; /* Touch-friendly size */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.bpc-input:focus {
    border-color: var(--bpc-primary);
}

.bpc-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Custom input for duration */
.bpc-custom-input {
    margin-top: 0.5rem;
}

/* Calculate button section */
.bpc-calculate-wrapper {
    text-align: center;
    padding: 1rem 0;
}

.bpc-calculate-btn {
    background: var(--bpc-gradient);
    color: white;
    border: none;
    border-radius: var(--bpc-border-radius);
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--bpc-shadow);
    position: relative;
    overflow: hidden;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.bpc-calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(139, 92, 246, 0.4);
}

.bpc-calculate-btn:active {
    transform: translateY(0);
}

.bpc-calculate-btn:focus {
    outline: var(--bpc-focus-outline);
    outline-offset: var(--bpc-focus-offset);
}

.bpc-calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--bpc-neutral);
}

.bpc-calculate-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: var(--bpc-neutral);
}

.bpc-btn-text {
    font-weight: 600;
}

.bpc-btn-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.bpc-calculate-btn:hover .bpc-btn-icon {
    transform: translateX(4px);
}

.bpc-calculate-help {
    margin-top: 0.75rem;
    color: var(--bpc-neutral);
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Results section - initially hidden */
.bpc-results {
    display: none !important;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
}

.bpc-results::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bpc-gradient);
    border-radius: var(--bpc-border-radius);
    opacity: 0.05;
    z-index: -1;
}

.bpc-results::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--bpc-gradient);
    border-radius: var(--bpc-border-radius) var(--bpc-border-radius) 0 0;
}

.bpc-results.show {
    display: block !important;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Enhanced result items */
.bpc-result-item {
    background: var(--bpc-background);
    padding: 1.5rem;
    border-radius: var(--bpc-border-radius);
    text-align: center;
    box-shadow: var(--bpc-shadow);
    border: 1px solid var(--bpc-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bpc-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(139, 92, 246, 0.25);
}

.bpc-result-item h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: var(--bpc-primary);
    font-weight: 600;
}

.bpc-amount {
    font-size: 2rem;
    font-weight: bold;
    margin: 0;
    color: var(--bpc-text);
    background: var(--bpc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bpc-currency {
    font-size: 0.8em;
    margin-right: 0.2em;
    color: var(--bpc-neutral);
}

/* Enhanced difference styling with goosed colors */
.bpc-difference {
    border: 3px solid transparent;
    background: var(--bpc-gradient);
    position: relative;
    color: white;
}

.bpc-difference.cheaper {
    background: var(--bpc-gradient);
}

.bpc-difference.expensive {
    background: var(--bpc-gradient);
}

.bpc-difference.same {
    background: var(--bpc-gradient);
}

/* Difference text styling with goosed colors */
.bpc-difference-text {
    margin-top: 1rem;
    font-weight: 900;
    color: white;
    text-align: center;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: none !important;
    padding: 0 !important;
    background-color: transparent !important;
    background-image: none !important;
}

/* Ensure no borders on the difference section itself */
.bpc-difference {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Override any result-item styling for the difference section */
.bpc-difference.bpc-result-item {
    background: var(--bpc-gradient) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background-color: var(--bpc-gradient) !important;
    background-image: var(--bpc-gradient) !important;
}

/* Ensure the difference text has no inherited styling */
.bpc-difference .bpc-difference-text {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 1rem 0 0 0 !important;
}

/* Target the paragraph element directly */
.bpc-difference p.bpc-difference-text {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 1rem 0 0 0 !important;
    display: block !important;
}

/* Target by ID as well */
#difference-text {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 1rem 0 0 0 !important;
}

/* Override the specific result-item properties for difference */
.bpc-difference.bpc-result-item {
    background: var(--bpc-gradient) !important;
    background-color: var(--bpc-gradient) !important;
    background-image: var(--bpc-gradient) !important;
    padding: 1.5rem !important;
    border-radius: var(--bpc-border-radius) !important;
    text-align: center !important;
    box-shadow: none !important;
    border: none !important;
    transition: none !important;
}

/* Make the difference amount text white and bold */
.bpc-difference .bpc-amount {
    color: white !important;
    -webkit-text-fill-color: white !important;
    background: none !important;
}

.bpc-difference .bpc-currency {
    color: rgba(255, 255, 255, 0.8) !important;
}

.bpc-difference h3 {
    color: white !important;
}

/* Footer with subtle goosed branding */
.bpc-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--bpc-border);
    color: var(--bpc-neutral);
    font-size: 0.9rem;
    position: relative;
}

.bpc-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 2px;
    background: var(--bpc-gradient);
    border-radius: 1px;
}

/* Result grid */
.bpc-result-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr; /* Mobile: single column */
}

/* Result info styling */
.bpc-result-info {
    font-size: 0.875rem;
    color: var(--bpc-neutral);
    margin-top: 0.5rem;
    line-height: 1.4;
    font-style: italic;
    text-align: center;
}

/* Result grid adjustments */
.bpc-result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .bpc-result-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

/* Enhanced clubcard notice with goosed styling */
.bpc-clubcard-notice {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: var(--bpc-border-radius);
    color: #92400e;
    font-size: 0.9em;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.bpc-clubcard-notice::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--bpc-gradient);
}

.bpc-clubcard-notice em {
    font-style: normal;
    font-weight: 600;
}

/* Phone Autocomplete */
.bpc-phone-autocomplete {
    position: relative;
}

.bpc-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bpc-background);
    border: 2px solid var(--bpc-border);
    border-top: none;
    border-radius: 0 0 var(--bpc-border-radius) var(--bpc-border-radius);
    box-shadow: var(--bpc-shadow);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: -1px; /* Overlap border */
}

.bpc-suggestion-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--bpc-border);
    transition: background-color 0.2s ease;
    min-height: 48px; /* Touch-friendly */
    display: flex;
    align-items: center;
}

.bpc-suggestion-item:last-child {
    border-bottom: none;
}

.bpc-suggestion-item:hover,
.bpc-suggestion-item:focus {
    background-color: #f8f9fa;
    outline: none;
}

/* Enhanced suggestion items */
.bpc-suggestion-item.bpc-focused {
    background: var(--bpc-gradient);
    color: white;
    transform: scale(1.02);
}

.bpc-suggestion-item.bpc-focused strong {
    color: white;
}

.bpc-custom-entry {
    font-style: italic;
    color: var(--bpc-neutral);
    text-align: center;
}

/* Calculator header with goosed branding */
.bpc-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
}

.bpc-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--bpc-text);
    margin: 0;
    line-height: 1.2;
}

.bpc-powered-by {
    display: block;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--bpc-neutral);
    margin-top: 0.5rem;
    opacity: 0.8;
}

.bpc-goosed {
    background: var(--bpc-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-style: italic;
}

/* Info button styling */
.bpc-info-btn {
    background: none;
    border: none;
    padding: 0;
    margin-left: 0.5rem;
    cursor: help;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bpc-gradient);
    color: white;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    position: relative;
}

.bpc-info-btn:hover,
.bpc-info-btn:focus {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
    outline: none;
}

.bpc-info-btn:focus {
    outline: 2px solid var(--bpc-primary);
    outline-offset: 2px;
}

.bpc-info-icon {
    display: block;
    font-size: 12px;
    line-height: 1;
}

/* Tooltip styling */
.bpc-info-btn[data-tooltip] {
    position: relative;
}

.bpc-info-btn[data-tooltip]:hover::before,
.bpc-info-btn[data-tooltip]:focus::before,
.bpc-info-btn.bpc-tooltip-visible::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 1rem 1.25rem;
    background: var(--bpc-text);
    color: white;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: var(--bpc-border-radius);
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    min-width: 300px;
    white-space: normal;
    text-align: left;
}

.bpc-info-btn[data-tooltip]:hover::after,
.bpc-info-btn[data-tooltip]:focus::after,
.bpc-info-btn.bpc-tooltip-visible::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    border: 6px solid transparent;
    border-top-color: var(--bpc-text);
}

/* Mobile-friendly tooltip adjustments */
@media (max-width: 768px) {
    .bpc-info-btn[data-tooltip]:hover::before,
    .bpc-info-btn[data-tooltip]:focus::before,
    .bpc-info-btn.bpc-tooltip-visible::before {
        left: 0;
        transform: none;
        white-space: normal;
        max-width: 350px;
        min-width: 280px;
        text-align: left;
    }
    
    .bpc-info-btn[data-tooltip]:hover::after,
    .bpc-info-btn[data-tooltip]:focus::after,
    .bpc-info-btn.bpc-tooltip-visible::after {
        left: 20px;
        transform: none;
    }
    
    /* Ensure tooltips are always visible on mobile when active */
    .bpc-info-btn.bpc-tooltip-visible::before,
    .bpc-info-btn.bpc-tooltip-visible::after {
        display: block !important;
    }
}

/* Responsive design - Tablet and up */
@media (min-width: 768px) {
    .bpc-calculator {
        max-width: 800px;
        margin: 2rem auto;
        padding: 2rem;
    }
    
    .bpc-result-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .bpc-form-group {
        display: grid;
        grid-template-columns: 200px 1fr;
        gap: 1.5rem;
        align-items: start;
    }
    
    .bpc-form-group label {
        margin-bottom: 0;
        padding-top: 0.75rem; /* Align with input */
    }
    
    .bpc-helper-text {
        grid-column: 2;
        margin-top: 0.25rem;
    }
    
    .bpc-custom-input {
        grid-column: 2;
        margin-top: 0.5rem;
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .bpc-calculator {
        max-width: 900px;
        margin: 3rem auto;
    }
    
    .bpc-section {
        padding: 2rem;
    }
    
    .bpc-result-item {
        padding: 2rem;
    }
    
    .bpc-amount {
        font-size: 2.5rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bpc-border: #000;
        --bpc-text: #000;
        --bpc-background: #fff;
    }
    
    .bpc-input:focus,
    #plan-selector:focus {
        outline: 3px solid #000;
        outline-offset: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bpc-input,
    .bpc-suggestion-item,
    #plan-selector {
        transition: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bpc-text: #e1e1e1;
        --bpc-background: #2d2d2d;
        --bpc-border: #555;
        --bpc-neutral: #aaa;
    }
    
    .bpc-section {
        background: #333;
    }
    
    .bpc-suggestions {
        background: #333;
        border-color: #555;
    }
    
    .bpc-suggestion-item:hover,
    .bpc-suggestion-item:focus {
        background-color: #444;
    }
    
    .bpc-selected-plan {
        background-color: #3a3a3a;
    }
    
    .bpc-input[readonly] {
        background-color: #3a3a3a;
    }
} 

/* Monthly cost info styling */
.bpc-monthly-cost-info {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--bpc-background);
    border: 1px solid var(--bpc-border);
    border-radius: var(--bpc-border-radius);
    border-left: 3px solid var(--bpc-primary);
}

.bpc-monthly-cost-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--bpc-neutral);
    font-style: italic;
}

/* Plan info styling */
.bpc-plan-info {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--bpc-border);
    border-radius: var(--bpc-border-radius);
    border-left: 4px solid var(--bpc-primary);
}

/* Hide plan info when empty */
.bpc-plan-info:empty {
    display: none;
} 

/* Plan selector styling */
#plan-selector option[disabled] {
    color: var(--bpc-neutral);
    font-style: italic;
}

#plan-selector option[disabled]:checked {
    background-color: transparent;
    color: var(--bpc-neutral);
}

/* Ensure disabled option doesn't look selected */
#plan-selector option[value=""] {
    color: var(--bpc-neutral);
    font-style: italic;
} 

/* Input validation warnings */
.bpc-input-warning {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
    padding: 0.25rem 0.5rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.25rem;
    font-weight: 500;
}

.bpc-input-warning::before {
    content: "⚠ ";
    margin-right: 0.25rem;
}

/* Rate limiting indicator */
.bpc-calculator.bpc-rate-limited .bpc-calculate-button {
    opacity: 0.6;
    cursor: not-allowed;
}

.bpc-calculator.bpc-rate-limited .bpc-calculate-button::after {
    content: " (Rate limited)";
    font-size: 0.875rem;
    font-style: italic;
} 