/* BuyBack Pro Widget Styles - Isolated */

:root {
    --bb-primary-color: #2563eb;
    --bb-primary-hover: #1d4ed8;
    --bb-secondary-color: #64748b;
    --bb-success-color: #10b981;
    --bb-background: #f8fafc;
    --bb-card-background: #ffffff;
    --bb-text-primary: #0f172a;
    --bb-text-secondary: #64748b;
    --bb-border-color: #e2e8f0;
    --bb-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --bb-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --bb-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --bb-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --bb-radius: 24px;
    --bb-radius-sm: 12px;
    --bb-radius-md: 16px;
    --bb-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* Animation speed */
    --bb-transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --bb-transition-normal: 0.3s ease;
}

/* Iframe Body Reset */
.bb-iframe-body {
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: var(--bb-font-family);
    width: 100%;
    height: auto;
    overflow-x: hidden;
    /* Prevent layout shift on mobile */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* Reset for widget container only */
.bb-widget-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Prevent scroll jump on click - important for Elementor embed */
.bb-widget-container button,
.bb-widget-container .bb-brand-card,
.bb-widget-container .bb-model-card,
.bb-widget-container .bb-condition-card {
    scroll-behavior: auto !important;
}

/* Ensure no anchor behavior */
.bb-widget-container a {
    scroll-behavior: auto !important;
}

/* Override Elementor/theme button styles - ensure consistent text color */
.bb-widget-container button {
    color: var(--bb-text-primary) !important;
}

.bb-widget-container button.bb-btn-primary {
    color: white !important;
}

.bb-widget-container button.bb-btn-back {
    color: var(--bb-text-secondary) !important;
}

/* Carrier unlock buttons */
.bb-widget-container .bb-carrier-unlock-btn {
    color: var(--bb-text-primary) !important;
    background: white !important;
}

.bb-widget-container .bb-carrier-unlock-btn:hover {
    border-color: var(--bb-primary-color) !important;
    color: var(--bb-primary-color) !important;
}

.bb-widget-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    font-family: var(--bb-font-family);
    color: var(--bb-text-primary);
    line-height: 1.5;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    box-sizing: border-box;
}

.bb-widget-wrapper {
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    animation: bbFadeIn 0.5s ease-out;
}

@keyframes bbFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.bb-widget-header {
    text-align: center;
    margin-bottom: 24px;
}

.bb-widget-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--bb-text-primary);
    margin-bottom: 8px;
    line-height: 1.2;
}

.bb-widget-header p {
    font-size: 1.1rem;
    color: var(--bb-text-secondary);
}

/* Progress Bar */
.bb-progress-container {
    margin-bottom: 24px;
}

.bb-progress-bar {
    height: 8px;
    background: var(--bb-border-color);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 20px;
}

.bb-progress-fill {
    height: 100%;
    background: var(--bb-primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Progress Steps - Horizontal Layout */
.bb-progress-steps {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 32px;
    margin-bottom: 20px;
}

.bb-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--bb-text-secondary);
    min-width: 60px;
}

.bb-step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bb-border-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.bb-progress-step span {
    text-align: center;
    line-height: 1.2;
}

.bb-progress-step.active .bb-step-circle {
    background: var(--bb-primary-color);
}

.bb-progress-step.completed .bb-step-circle {
    background: var(--bb-success-color);
}

.bb-progress-step.active span,
.bb-progress-step.completed span {
    color: var(--bb-text-primary);
    font-weight: 600;
}

/* Step Content */
.bb-step-content {
    padding: 16px 0;
    display: none;
    animation: bbFadeIn 0.3s ease;
    /* Prevent layout shift */
    min-height: 300px;
    box-sizing: border-box;
}

.bb-step-content.active {
    display: flex;
    flex-direction: column;
}

@keyframes bbSlideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.bb-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: var(--bb-text-primary);
}

/* Brand Grid */
.bb-brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    /* Prevent layout shift */
    contain: layout;
}

.bb-brand-card {
    background: #fdfdfd;
    border: 1px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--bb-transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    box-shadow: var(--bb-shadow-sm);
}

.bb-brand-card:hover {
    border-color: var(--bb-primary-color);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow-md);
}

.bb-brand-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bb-text-primary);
    letter-spacing: -0.01em;
}

/* Search Input */
.bb-search-container {
    margin-bottom: 20px;
    position: relative;
}

.bb-search-input {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.05rem;
    border: 1px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    background: #f8fafc;
}

.bb-search-input:focus {
    background: white;
    border-color: var(--bb-primary-color);
    box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
}

/* Model Grid */
.bb-model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    max-height: 600px;
    overflow-y: auto;
    padding: 4px;
    /* Smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Prevent layout shift */
    contain: layout;
}

.bb-model-card {
    background: #fdfdfd;
    border: 1px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    box-shadow: var(--bb-shadow-sm);
}

.bb-model-card:hover {
    border-color: var(--bb-primary-color);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow-md);
}

.bb-model-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--bb-text-primary);
}

.bb-model-price {
    font-size: 0.875rem;
    color: var(--bb-success-color);
    font-weight: 600;
    display: none;
}

/* Condition Grid */
.bb-condition-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.bb-condition-card {
    background: white;
    border: 1px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    padding: 24px 32px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--bb-shadow-sm);
}

.bb-condition-card:hover {
    border-color: var(--bb-primary-color);
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow-md);
}

.bb-condition-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--bb-text-primary);
}

.bb-condition-desc {
    font-size: 0.95rem;
    color: var(--bb-text-secondary);
    line-height: 1.5;
    max-width: 100%;
}

.bb-condition-multiplier {
    font-size: 0.875rem;
    color: var(--bb-success-color);
    font-weight: 600;
    margin-top: 8px;
}

/* Damage Options */
.bb-damage-options {
    margin-top: 20px;
    padding: 24px;
    background: var(--bb-background);
    border: 2px solid var(--bb-border-color);
    border-radius: 16px;
}

.bb-damage-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bb-text-primary);
    margin-bottom: 16px;
    text-align: center;
}

.bb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bb-checkbox-option {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border: 2px solid var(--bb-border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.bb-checkbox-option:hover {
    border-color: var(--bb-primary-color);
    background: #f8f9fa;
    transform: translateX(4px);
}

.bb-damage-checkbox {
    width: 22px;
    height: 22px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--bb-primary-color);
    flex-shrink: 0;
}

.bb-checkbox-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--bb-text-primary);
    cursor: pointer;
    user-select: none;
}

.bb-checkbox-option:has(.bb-damage-checkbox:checked) {
    border-color: var(--bb-primary-color);
    background: #fff5f5;
}

/* Quote Result */
.bb-quote-result {
    text-align: center;
    padding: 20px;
}

.bb-quote-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bbBounce 0.6s ease-out;
}

@keyframes bbBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

.bb-quote-result h2 {
    font-size: 1.5rem;
    color: var(--bb-text-secondary);
    margin-bottom: 16px;
}

.bb-quote-amount {
    font-size: 4rem;
    font-weight: 700;
    color: var(--bb-success-color);
    margin-bottom: 20px;
    animation: bbScaleIn 0.5s ease-out;
}

@keyframes bbScaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.bb-quote-details {
    background: var(--bb-background);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bb-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bb-border-color);
}

.bb-detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.bb-detail-label {
    font-size: 1rem;
    color: var(--bb-text-secondary);
    font-weight: 500;
}

.bb-detail-value {
    font-size: 1rem;
    color: var(--bb-text-primary);
    font-weight: 600;
}

.bb-quote-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.bb-quote-info {
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
    padding: 20px;
    text-align: left;
}

.bb-quote-info p {
    color: var(--bb-success-color);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.bb-quote-info p:last-child {
    margin-bottom: 0;
}

/* Buttons */
.bb-btn-primary {
    flex: 1;
    padding: 16px 32px;
    background: var(--bb-primary-color);
    color: white;
    border: none;
    border-radius: var(--bb-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bb-btn-primary:hover {
    background: var(--bb-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--bb-shadow-lg);
}

.bb-btn-secondary {
    flex: 1;
    padding: 16px 32px;
    background: transparent;
    color: var(--bb-text-secondary);
    border: 2px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bb-btn-secondary:hover {
    border-color: var(--bb-text-secondary);
    color: var(--bb-text-primary);
}

.bb-btn-back {
    padding: 12px 24px;
    background: transparent;
    color: var(--bb-text-secondary);
    border: 2px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bb-btn-back:hover {
    border-color: var(--bb-primary-color);
    color: var(--bb-primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .bb-widget-wrapper {
        padding: 12px;
        padding-bottom: 20px;
    }

    .bb-widget-header {
        margin-bottom: 16px;
    }

    .bb-widget-header h1 {
        font-size: 1.75rem;
        margin-bottom: 6px;
        line-height: 1.2;
    }

    .bb-widget-header p {
        font-size: 0.95rem;
        line-height: 1.4;
    }

    .bb-progress-container {
        margin-bottom: 16px;
    }

    .bb-progress-bar {
        margin-bottom: 12px;
    }

    .bb-progress-steps {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .bb-progress-step {
        font-size: 0.7rem;
        min-width: 50px;
        flex: 0 1 auto;
    }

    .bb-step-circle {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .bb-progress-step span {
        font-size: 0.65rem;
        line-height: 1.1;
    }

    .bb-step-title {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .bb-brand-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .bb-brand-card {
        padding: 16px 12px;
        min-height: 80px;
    }

    .bb-brand-name {
        font-size: 1rem;
    }

    .bb-model-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: calc(100vh - 400px);
        overflow-y: auto;
    }

    .bb-model-card {
        padding: 16px 12px;
        min-height: 70px;
    }

    .bb-model-name {
        font-size: 0.9rem;
    }

    .bb-search-container {
        margin-bottom: 16px;
    }

    .bb-search-input {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .bb-condition-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .bb-condition-card {
        padding: 18px 20px;
    }

    .bb-condition-title {
        font-size: 1.1rem;
        margin-bottom: 6px;
    }

    .bb-condition-desc {
        font-size: 0.9rem;
    }

    .bb-damage-options {
        margin-top: 16px;
        padding: 16px;
    }

    .bb-damage-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .bb-checkbox-option {
        padding: 12px;
    }

    .bb-checkbox-label {
        font-size: 0.9rem;
    }

    .bb-btn-back {
        padding: 10px 20px;
        font-size: 0.9rem;
        margin-top: 16px;
        width: 100%;
    }

    .bb-form-group {
        margin-bottom: 18px;
    }

    .bb-form-group input {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .bb-form-actions {
        flex-direction: column;
        gap: 12px;
    }

    .bb-btn-primary,
    .bb-btn-secondary {
        padding: 14px 24px;
        font-size: 1rem;
        width: 100%;
    }

    .bb-selection-summary {
        padding: 16px;
        margin-bottom: 16px;
    }

    .bb-summary-content {
        font-size: 0.95rem;
        gap: 8px;
    }

    .bb-thank-you-screen {
        padding: 16px;
    }

    .bb-success-icon {
        font-size: 4rem;
        margin-bottom: 16px;
    }

    .bb-thank-you-screen h2 {
        font-size: 2rem;
        margin-bottom: 12px;
    }

    .bb-thank-you-message {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .bb-thank-you-details {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }

    .bb-detail-card {
        padding: 20px 16px;
    }
}

@media (max-width: 480px) {
    .bb-widget-wrapper {
        padding: 10px;
        padding-bottom: 16px;
    }

    .bb-widget-header h1 {
        font-size: 1.5rem;
    }

    .bb-widget-header p {
        font-size: 0.9rem;
    }

    .bb-progress-steps {
        gap: 6px;
    }

    .bb-progress-step {
        font-size: 0.65rem;
        min-width: 45px;
    }

    .bb-step-circle {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }

    .bb-progress-step span {
        font-size: 0.6rem;
    }

    .bb-step-title {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .bb-brand-grid {
        gap: 8px;
    }

    .bb-brand-card {
        padding: 14px 10px;
        min-height: 70px;
    }

    .bb-brand-name {
        font-size: 0.95rem;
    }

    .bb-model-grid {
        gap: 8px;
        max-height: calc(100vh - 350px);
    }

    .bb-model-card {
        padding: 14px 10px;
        min-height: 60px;
    }

    .bb-model-name {
        font-size: 0.85rem;
    }

    .bb-condition-card {
        padding: 16px 18px;
    }

    .bb-condition-title {
        font-size: 1rem;
    }

    .bb-condition-desc {
        font-size: 0.85rem;
    }

    .bb-damage-options {
        padding: 14px;
    }

    .bb-checkbox-option {
        padding: 10px;
    }

    .bb-checkbox-label {
        font-size: 0.85rem;
    }

    .bb-form-group input {
        padding: 11px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .bb-btn-primary,
    .bb-btn-secondary {
        padding: 13px 20px;
        font-size: 0.95rem;
    }
}

/* Mobile step content adjustments */
@media (max-width: 768px) {
    /* IMPORTANT: Only apply display:flex to ACTIVE steps on mobile */
    .bb-step-content.active {
        min-height: calc(100vh - 200px);
        display: flex;
        flex-direction: column;
    }

    .bb-model-grid,
    .bb-brand-grid {
        flex: 1;
        min-height: 0;
    }
}

/* Selection Summary */
.bb-selection-summary {
    background: #f8fafc;
    border: 1px solid var(--bb-border-color);
    border-radius: var(--bb-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.bb-summary-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    color: var(--bb-text-primary);
}

.bb-summary-label {
    color: var(--bb-text-secondary);
    font-weight: 500;
}

.bb-summary-item {
    font-weight: 600;
    color: var(--bb-primary-color);
}

.bb-summary-separator {
    color: var(--bb-border-color);
    font-weight: 400;
}

/* User Form */
.bb-user-form {
    max-width: 500px;
    margin: 0 auto;
}

.bb-form-group {
    margin-bottom: 24px;
}

.bb-form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--bb-text-primary);
    margin-bottom: 8px;
}

.bb-form-group input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid var(--bb-border-color);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.bb-form-group input:focus {
    border-color: var(--bb-primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.bb-form-group input::placeholder {
    color: var(--bb-text-secondary);
}

.bb-form-actions {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}

/* Thank You Screen */
.bb-thank-you-screen {
    text-align: center;
    padding: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.bb-success-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    animation: bbBounce 0.6s ease-out;
}

.bb-thank-you-screen h2 {
    font-size: 2.5rem;
    color: var(--bb-text-primary);
    margin-bottom: 16px;
}

.bb-thank-you-message {
    font-size: 1.2rem;
    color: var(--bb-text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

.bb-thank-you-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.bb-detail-card {
    background: var(--bb-background);
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
}

.bb-detail-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.bb-detail-card h3 {
    font-size: 1.1rem;
    color: var(--bb-text-primary);
    margin-bottom: 8px;
}

.bb-detail-card p {
    font-size: 0.9rem;
    color: var(--bb-text-secondary);
    margin: 0;
}

/* Custom Scrollbar */
.bb-model-grid::-webkit-scrollbar {
    width: 8px;
}

.bb-model-grid::-webkit-scrollbar-track {
    background: var(--bb-background);
    border-radius: 4px;
}

.bb-model-grid::-webkit-scrollbar-thumb {
    background: var(--bb-border-color);
    border-radius: 4px;
}

.bb-model-grid::-webkit-scrollbar-thumb:hover {
    background: var(--bb-text-secondary);
}