/* ═══════════════════════════════════════════════════
   ATSFlow — Guided Single-Step ATS Analysis Flow
   Fade-swap between steps for a video-game-style progression
   "Complete Step 1 → Fade → Step 2 → Fade → Step 3 → Analyze"
   ═══════════════════════════════════════════════════ */

/* ── CSS Variables ── */
.atsflow {
    --af-primary: #3B82F6;
    --af-accent: #60A5FA;
    --af-success: #10B981;
    --af-disabled: #9CA3AF;
    --af-card-bg: #ffffff;
    --af-card-shadow: 0 2px 12px rgba(59, 130, 246, 0.06),
                      0 1px 3px rgba(0, 0, 0, 0.04);
    --af-radius: 16px;
    --af-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --af-ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Container ── */
.atsflow {
    margin-bottom: 32px;
}

/* ═══════════════════════════════════════════════════
   Header + Step Indicator
   ═══════════════════════════════════════════════════ */
.atsflow__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.atsflow__header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--af-primary), var(--af-accent));
    color: #fff;
    flex-shrink: 0;
}

.atsflow__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--bp-deep-blue, #1a1a2e);
    margin: 0;
    line-height: 1.3;
}

.atsflow__step-indicator {
    font-size: 13px;
    font-weight: 600;
    color: var(--af-primary);
    margin: 4px 0 0;
    line-height: 1.4;
    letter-spacing: 0.2px;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.atsflow__step-indicator--exit {
    opacity: 0;
    transform: translateY(4px);
}

/* ═══════════════════════════════════════════════════
   Panel — DJ-style crossfade container
   ═══════════════════════════════════════════════════ */
.atsflow__panel {
    position: relative;
}

/* New step content fades in when @key swaps the DOM element */
.atsflow__step-content {
    animation: afXfadeIn 1.4s ease-out both;
}

/* Suppress child entrance animations during crossfade —
   the parent opacity fade handles the whole transition smoothly */
.atsflow__step-content .atsflow__next-btn {
    animation: none;
}
.atsflow__step-content .atsflow__analyze-btn {
    animation: none;
}

/* Instant swap — no animation when user clicks navigation buttons */
.atsflow__step-content--instant {
    animation: none;
}

/* ═══════════════════════════════════════════════════
   Card
   ═══════════════════════════════════════════════════ */
.atsflow__card {
    position: relative;
    display: flex;
    background: var(--af-card-bg);
    border-radius: var(--af-radius);
    box-shadow: var(--af-card-shadow);
    overflow: hidden;
}

.atsflow__card-bar {
    width: 5px;
    flex-shrink: 0;
    border-radius: 5px 0 0 5px;
    background: var(--af-primary);
    animation: afBarGlow 2.5s ease-in-out infinite;
}

.atsflow__card-content {
    flex: 1;
    min-width: 0;
    padding: 24px 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.atsflow__card-content--center {
    align-items: center;
    text-align: center;
    padding: 32px 26px;
}

/* ═══════════════════════════════════════════════════
   Microcopy
   ═══════════════════════════════════════════════════ */
.atsflow__microcopy {
    font-size: 13.5px;
    color: var(--bp-text-muted, #6b7280);
    margin: 0;
    line-height: 1.5;
}

.atsflow__microcopy-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════
   Action Buttons
   ═══════════════════════════════════════════════════ */
.atsflow__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.atsflow__action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 550;
    font-family: inherit;
    color: var(--bp-deep-blue, #1a1a2e);
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    white-space: nowrap;
}

.atsflow__action-btn:hover:not(:disabled) {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.atsflow__action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.atsflow__action-btn svg {
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   Textarea
   ═══════════════════════════════════════════════════ */
.atsflow__textarea-wrap {
    position: relative;
}

.atsflow__textarea {
    width: 100%;
    min-height: 180px;
    padding: 14px 16px 32px;
    font-size: 13.5px;
    font-family: 'IBM Plex Mono', 'Fira Code', monospace;
    line-height: 1.65;
    color: var(--bp-deep-blue, #1a1a2e);
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    resize: vertical;
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
    box-sizing: border-box;
}

.atsflow__textarea:focus {
    outline: none;
    border-color: var(--af-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: #fff;
}

.atsflow__textarea::placeholder {
    color: #9ca3af;
}

.atsflow__char-count {
    position: absolute;
    bottom: 10px;
    right: 14px;
    font-size: 11px;
    color: #9ca3af;
    pointer-events: none;
    font-family: 'IBM Plex Mono', monospace;
}

/* ═══════════════════════════════════════════════════
   Tooltip
   ═══════════════════════════════════════════════════ */
.atsflow__tooltip-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--bp-text-muted, #6b7280);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.atsflow__tooltip-trigger:hover {
    background: #f3f4f6;
    color: var(--af-primary);
}

.atsflow__tooltip {
    padding: 14px 16px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--bp-deep-blue, #1a1a2e);
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    animation: afFadeIn 0.25s ease-out;
}

.atsflow__tooltip strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--af-primary);
}

/* ═══════════════════════════════════════════════════
   Analyze Button (Step 3)
   ═══════════════════════════════════════════════════ */
.atsflow__analyze-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--af-primary), #2563eb);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    transition: transform 0.3s, box-shadow 0.3s;
    letter-spacing: 0.2px;
    animation: afSlideUp 0.5s var(--af-ease-out) both;
}

.atsflow__analyze-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(59, 130, 246, 0.4);
}

.atsflow__analyze-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.atsflow__analyze-btn:disabled {
    background: linear-gradient(135deg, var(--af-disabled), #b0b8c4);
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
    animation: none;
}

.atsflow__analyze-btn svg {
    flex-shrink: 0;
}

.atsflow__analyze-hint {
    font-size: 12px;
    color: var(--bp-text-muted, #6b7280);
    margin: 8px 0 0;
}

/* ═══════════════════════════════════════════════════
   Back Button — subtle link to return to previous step
   ═══════════════════════════════════════════════════ */
.atsflow__back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin-bottom: 10px;
    font-size: 12.5px;
    font-weight: 550;
    font-family: inherit;
    color: var(--af-primary);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.atsflow__back-btn:hover {
    opacity: 1;
    transform: translateX(-2px);
}

.atsflow__back-btn svg {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.atsflow__back-btn:hover svg {
    transform: translateX(-2px);
}

/* ═══════════════════════════════════════════════════
   Navigation Row — back + next side by side
   ═══════════════════════════════════════════════════ */
.atsflow__nav-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.atsflow__nav-row .atsflow__back-btn {
    margin-bottom: 0;
}

/* Next / Forward Button */
.atsflow__next-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    margin-left: auto;
    font-size: 12.5px;
    font-weight: 550;
    font-family: inherit;
    color: var(--af-primary);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.15s ease;
    animation: afFadeIn 0.3s ease-out both;
}

.atsflow__next-btn:hover {
    opacity: 1;
    transform: translateX(2px);
}

.atsflow__next-btn svg {
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.atsflow__next-btn:hover svg {
    transform: translateX(2px);
}

/* ═══════════════════════════════════════════════════
   Keyframe Animations
   ═══════════════════════════════════════════════════ */

/* Panel fade in — opacity + slide up */
@keyframes afFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* Panel fade out — opacity + slide up (exit) */
@keyframes afFadeOut {
    from { opacity: 1; transform: translateY(0);    }
    to   { opacity: 0; transform: translateY(-6px); }
}

/* Bar glow pulse on active step */
@keyframes afBarGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        background: var(--af-primary);
    }
    50% {
        box-shadow: 0 0 10px 3px rgba(59, 130, 246, 0.3);
        background: var(--af-accent);
    }
}

/* Slide-up entrance for analyze button */
@keyframes afSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}

/* DJ crossfade — opacity-only entrance (no vertical movement) */
@keyframes afXfadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* DJ crossfade — opacity-only exit for ghost overlay */
@keyframes afXfadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .atsflow__step-content {
        animation: none;
    }
}

@media (max-width: 640px) {
    .atsflow__card-content {
        padding: 18px 14px;
    }

    .atsflow__card-content--center {
        padding: 24px 14px;
    }

    .atsflow__actions {
        gap: 6px;
    }

    .atsflow__action-btn {
        padding: 6px 10px;
        font-size: 11.5px;
    }

    .atsflow__analyze-btn {
        padding: 14px 28px;
        font-size: 15px;
        width: 100%;
    }

    .atsflow__tooltip {
        width: 240px;
    }

    .atsflow__title {
        font-size: 18px;
    }
}
