/* Conversational Form Base */
.cf-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--nav-scrolled-bg); /* Use the translucent bg variable */
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cf-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cf-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 100%;
    background: var(--bg-surface);
    position: relative;
    display: flex;
    flex-direction: column;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .cf-container {
        height: auto;
        min-height: 500px;
        max-height: 80vh;
        border-radius: 16px;
    }
}

.cf-overlay.open .cf-container {
    transform: translateY(0);
    opacity: 1;
}

/* Header & Progress */
.cf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cf-back-btn {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.cf-back-btn:hover {
    color: var(--text-heading);
    background: var(--bg-card-hover);
}

.cf-back-btn.hidden {
    visibility: hidden;
    pointer-events: none;
}

.cf-step-counter {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.cf-close-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.cf-close-btn:hover {
    color: var(--text-heading);
    background: var(--bg-card-hover);
}

.cf-progress-bar-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-color);
}

.cf-progress-bar {
    height: 100%;
    background: #2E8FA3;
    width: 0%;
    transition: width 0.4s ease;
}

/* Content Area */
.cf-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2.5rem 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.cf-step {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-40px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cf-step.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
    position: relative;
    padding: 0;
}

.cf-step.entering-from-right {
    transform: translateX(40px);
}

.cf-step.entering-from-left {
    transform: translateX(-40px);
}

@media (prefers-reduced-motion: reduce) {
    .cf-step {
        transform: none !important;
        transition: opacity 0.3s ease !important;
    }
}

/* Question Typography */
.cf-question {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 2rem;
    line-height: 1.3;
}

@media (min-width: 768px) {
    .cf-question {
        font-size: 1.875rem;
    }
}

/* Inputs */
.cf-input, .cf-textarea {
    width: 100%;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid var(--border-color) !important;
    color: var(--text-heading);
    font-size: 1.5rem;
    padding: 0.5rem 0;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.cf-textarea {
    font-size: 1.25rem;
    resize: none;
    min-height: 100px;
}

.cf-input:focus, .cf-textarea:focus {
    border-color: #2E8FA3;
}

.cf-input::placeholder, .cf-textarea::placeholder {
    color: var(--text-muted);
}

.cf-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.75rem;
    min-height: 1.25rem;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s;
}

.cf-error.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Button Options */
.cf-options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .cf-options-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.cf-option-btn {
    background: var(--bg-canvas);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    color: var(--text-heading);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.cf-option-btn:hover {
    background: var(--bg-card-hover);
    border-color: #2E8FA3;
    transform: translateY(-2px);
}

.cf-option-btn:active {
    transform: scale(0.98);
}

.cf-option-emoji {
    font-size: 1.5rem;
}

/* Next / Action Buttons */
.cf-actions {
    margin-top: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cf-next-btn {
    background: #2E8FA3;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.cf-next-btn:hover {
    background: #267c8d;
    transform: translateY(-1px);
}

.cf-next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cf-helper-text {
    color: #8FB3C0;
    font-size: 0.875rem;
}

.cf-skip-link {
    color: #8FB3C0;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.cf-skip-link:hover {
    color: #fff;
}

/* Success Screen */
.cf-success {
    text-align: center;
    padding: 2rem;
}

.cf-success-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: inline-block;
    animation: bounceScale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceScale {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.cf-success-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 1rem;
}

.cf-success-text {
    color: var(--text-muted);
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* Confetti */
.cf-confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.cf-confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #2E8FA3;
    opacity: 0;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Confirmation Modal */
.cf-confirm-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 24, 0.9);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.cf-confirm-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cf-confirm-dialog {
    background: #162330;
    border: 1px solid #1E3040;
    border-radius: 12px;
    padding: 2rem;
    max-width: 350px;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.2s;
}

.cf-confirm-overlay.open .cf-confirm-dialog {
    transform: scale(1);
}

.cf-confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.cf-confirm-text {
    color: #8FB3C0;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.cf-confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.cf-confirm-actions button {
    flex: 1;
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cf-btn-cancel {
    background: transparent;
    border: 1px solid #8FB3C0;
    color: #8FB3C0;
}

.cf-btn-cancel:hover {
    color: #fff;
    border-color: #fff;
}

.cf-btn-confirm {
    background: #ef4444;
    border: 1px solid #ef4444;
    color: #fff;
}

.cf-btn-confirm:hover {
    background: #dc2626;
}

/* Summary Chips */
.cf-summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.05);
    border-radius: 100px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    color: #8FB3C0;
    margin-bottom: 1rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.cf-summary-chip:hover {
    background: rgba(255,255,255,0.1);
    border-color: #2E8FA3;
    color: #fff;
}
