/**
 * Retention Chatbot Styles - Curiosophy Design System
 * Mobile-first approach, matching site's design language
 *
 * Colors from base.css:
 * --primary: #2563eb
 * --primary-dark: #1d4ed8
 * --primary-light: #3b82f6
 * --success: #16a34a
 * --danger: #dc2626
 *
 * Breakpoints:
 * - Mobile: 320px - 767px (default)
 * - Tablet: 768px - 1023px
 * - Desktop: 1024px+
 */

:root {
    --chatbot-primary: #2563eb;
    --chatbot-primary-dark: #1d4ed8;
    --chatbot-primary-light: #3b82f6;
    --chatbot-success: #16a34a;
    --chatbot-danger: #dc2626;
    --chatbot-gray-100: #f9fafb;
    --chatbot-gray-200: #f3f4f6;
    --chatbot-gray-300: #e5e7eb;
    --chatbot-gray-400: #d1d5db;
    --chatbot-gray-500: #9ca3af;
    --chatbot-gray-600: #6b7280;
    --chatbot-gray-700: #4b5563;
    --chatbot-gray-800: #374151;
    --chatbot-dark: #111827;
    --chatbot-radius: 8px;
    --chatbot-radius-lg: 12px;
}

/* === Modal Overlay === */
.retention-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.retention-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(17, 24, 39, 0.75);
    backdrop-filter: blur(4px);
}

/* === Chatbot Container === */
.retention-chatbot-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* === Progress Bar === */
.retention-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--chatbot-gray-200);
    z-index: 10;
}

.retention-progress-bar {
    height: 100%;
    background: var(--chatbot-primary);
    transition: width 0.4s ease;
}

/* === Close Button === */
.retention-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--chatbot-gray-100);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chatbot-gray-600);
    transition: all 0.2s;
    z-index: 10;
}

.retention-close-btn:hover {
    background: var(--chatbot-gray-200);
    color: var(--chatbot-gray-800);
}

/* === Steps === */
.retention-step {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 20px;
    overflow-y: auto;
    animation: slideInUp 0.3s ease-out;
}

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

.retention-step-content {
    width: 100%;
    max-width: 100%;
    text-align: center;
}

/* === Typography === */
.retention-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--chatbot-dark);
    margin: 0 0 12px 0;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.retention-subtitle {
    font-size: 16px;
    color: var(--chatbot-gray-600);
    margin: 0 0 32px 0;
    line-height: 1.6;
}

/* === Option Cards === */
.retention-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.retention-option-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: #fff;
    border: 2px solid var(--chatbot-gray-300);
    border-radius: var(--chatbot-radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.retention-option-card:hover {
    border-color: var(--chatbot-primary);
    background: #eff6ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.retention-option-card:active {
    transform: translateY(0);
}

.retention-option-card.selected {
    border-color: var(--chatbot-primary);
    background: #eff6ff;
}

.retention-option-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.retention-option-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--chatbot-gray-800);
}

.retention-option-key {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--chatbot-gray-100);
    color: var(--chatbot-gray-500);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* === Price Options === */
.retention-price-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.retention-price-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px;
    background: #fff;
    border: 2px solid var(--chatbot-gray-300);
    border-radius: var(--chatbot-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.retention-price-card:hover {
    border-color: var(--chatbot-primary);
    background: #eff6ff;
}

.retention-price-card.selected {
    border-color: var(--chatbot-primary);
    background: #eff6ff;
}

.retention-price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--chatbot-dark);
}

.retention-price-label {
    font-size: 14px;
    color: var(--chatbot-gray-600);
    margin-top: 4px;
}

/* === Textarea === */
.retention-textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--chatbot-gray-300);
    border-radius: var(--chatbot-radius);
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s;
    margin-bottom: 24px;
}

.retention-textarea:focus {
    outline: none;
    border-color: var(--chatbot-primary);
}

.retention-textarea::placeholder {
    color: var(--chatbot-gray-500);
}

/* === Buttons === */
.retention-nav-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.retention-back-btn {
    padding: 14px 24px;
    background: transparent;
    border: 2px solid var(--chatbot-gray-300);
    border-radius: var(--chatbot-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--chatbot-gray-600);
    cursor: pointer;
    transition: all 0.2s;
}

.retention-back-btn:hover {
    border-color: var(--chatbot-gray-400);
    background: var(--chatbot-gray-100);
}

.retention-next-btn,
.retention-accept-btn,
.retention-done-btn {
    padding: 14px 28px;
    background: var(--chatbot-primary);
    border: none;
    border-radius: var(--chatbot-radius);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.retention-next-btn:hover,
.retention-accept-btn:hover,
.retention-done-btn:hover {
    background: var(--chatbot-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.retention-skip-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    font-size: 15px;
    color: var(--chatbot-gray-600);
    cursor: pointer;
    transition: color 0.2s;
}

.retention-skip-btn:hover {
    color: var(--chatbot-gray-800);
}

.retention-decline-btn,
.retention-cancel-confirm-btn {
    padding: 14px 24px;
    background: transparent;
    border: 2px solid var(--chatbot-danger);
    border-radius: var(--chatbot-radius);
    font-size: 16px;
    font-weight: 500;
    color: var(--chatbot-danger);
    cursor: pointer;
    transition: all 0.2s;
}

.retention-decline-btn:hover,
.retention-cancel-confirm-btn:hover {
    background: #fef2f2;
}

.retention-stay-btn {
    padding: 14px 28px;
    background: var(--chatbot-success);
    border: none;
    border-radius: var(--chatbot-radius);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.retention-stay-btn:hover {
    background: #15803d;
}

/* === Offer Card === */
.retention-offer-card {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: var(--chatbot-radius-lg);
    padding: 32px 24px;
    margin-bottom: 24px;
}

.retention-offer-badge {
    display: inline-block;
    background: var(--chatbot-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.retention-offer-text {
    font-size: 16px;
    color: var(--chatbot-gray-600);
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.retention-discount-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
}

.retention-discount-percent {
    font-size: 56px;
    font-weight: 800;
    color: var(--chatbot-primary);
    line-height: 1;
}

.retention-discount-text {
    font-size: 18px;
    color: var(--chatbot-gray-600);
}

.retention-price-comparison {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 28px;
}

.retention-price-old,
.retention-price-new {
    text-align: center;
}

.retention-price-old .price-label,
.retention-price-new .price-label {
    display: block;
    font-size: 13px;
    color: var(--chatbot-gray-500);
    margin-bottom: 4px;
}

.retention-price-old .price-value {
    font-size: 18px;
    color: var(--chatbot-gray-500);
    text-decoration: line-through;
}

.retention-price-new .price-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--chatbot-success);
}

.retention-offer-card .retention-accept-btn {
    width: 100%;
    margin-bottom: 12px;
}

.retention-offer-card .retention-decline-btn {
    width: 100%;
    border: none;
    color: var(--chatbot-gray-500);
}

.retention-offer-card .retention-decline-btn:hover {
    background: transparent;
    color: var(--chatbot-gray-700);
}

/* === Success/Error States === */
.retention-success-icon,
.retention-cancelled-icon,
.retention-error-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

/* === Loading Spinner === */
.retention-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--chatbot-gray-200);
    border-top-color: var(--chatbot-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.retention-loading-text {
    font-size: 16px;
    color: var(--chatbot-gray-600);
}

/* === Final Buttons === */
.retention-final-buttons {
    flex-direction: column;
    gap: 16px;
}

.retention-final-buttons .retention-stay-btn,
.retention-final-buttons .retention-cancel-confirm-btn {
    width: 100%;
}


/* ========================================
   TABLET STYLES (768px - 1023px)
   ======================================== */
@media (min-width: 768px) {
    .retention-chatbot-container {
        width: 560px;
        height: auto;
        max-height: 90vh;
        border-radius: 16px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    .retention-progress {
        border-radius: 16px 16px 0 0;
    }

    .retention-step {
        padding: 60px 48px 48px;
    }

    .retention-title {
        font-size: 28px;
    }

    .retention-subtitle {
        font-size: 17px;
    }

    .retention-options:not(.retention-price-options) {
        max-width: 440px;
        margin-left: auto;
        margin-right: auto;
    }

    .retention-price-options {
        grid-template-columns: repeat(4, 1fr);
    }

    .retention-textarea {
        max-width: 440px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 24px;
    }

    .retention-offer-card {
        padding: 40px;
    }

    .retention-discount-percent {
        font-size: 72px;
    }

    .retention-final-buttons {
        flex-direction: row;
        max-width: 400px;
        margin: 0 auto;
    }

    .retention-final-buttons .retention-stay-btn,
    .retention-final-buttons .retention-cancel-confirm-btn {
        flex: 1;
    }
}


/* ========================================
   DESKTOP STYLES (1024px+)
   ======================================== */
@media (min-width: 1024px) {
    .retention-chatbot-container {
        width: 640px;
    }

    .retention-step {
        padding: 70px 60px 60px;
    }

    .retention-title {
        font-size: 32px;
    }

    .retention-option-card {
        padding: 18px 24px;
    }

    .retention-option-card:hover {
        transform: translateX(4px);
    }

    .retention-close-btn {
        top: 20px;
        right: 20px;
    }
}


/* ========================================
   ANIMATIONS
   ======================================== */
.retention-step.entering {
    animation: slideInUp 0.3s ease-out forwards;
}

.retention-step.exiting {
    animation: slideOutUp 0.2s ease-in forwards;
}

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

/* Option card selection pulse */
.retention-option-card.selected::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.2);
    animation: pulse 0.3s ease-out forwards;
    pointer-events: none;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.05);
        opacity: 0;
    }
}

/* Body scroll lock when modal is open */
body.retention-modal-open {
    overflow: hidden;
}


/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .retention-chatbot-container,
    .retention-step,
    .retention-option-card,
    .retention-progress-bar,
    .retention-spinner {
        animation: none;
        transition: none;
    }
}
