/* ===== GUIDED TROUBLESHOOTING OVERLAY ===== */
/* Step-by-step walkthrough UI for RAG answers with numbered resolution steps.
   Tech clicks "Start Guided Troubleshooting" on an answer, and this overlay
   replaces the answer card with an interactive step-by-step flow. */

/* ── Overlay Container ── */
.guided-overlay {
    position: relative;
    background: var(--bg-card, #0d1225);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius-lg, 12px);
    padding: 20px;
    margin: 0;
    animation: guidedFadeIn 0.3s ease-out;
}

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

/* Close button - top right corner */
.guided-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    color: var(--text-tertiary, #8892a8);
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.guided-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
    border-color: var(--text-tertiary, #8892a8);
}

/* ── Header ── */
.guided-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-right: 60px; /* room for close button */
}

.guided-header-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.guided-header-title {
    font-family: var(--font-heading, 'Oswald', sans-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    letter-spacing: 0.3px;
}

.guided-header-subtitle {
    font-size: 12px;
    color: var(--text-tertiary, #8892a8);
    margin-top: 2px;
}

/* ── Progress Bar ── */
.guided-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
    padding: 0 4px;
    position: relative;
}

.guided-progress-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    border: 2px solid var(--border, rgba(255, 255, 255, 0.15));
    background: var(--bg-secondary, #0a0f1f);
    color: var(--text-tertiary, #8892a8);
}

/* Completed step dot */
.guided-progress-dot.completed {
    background: #34C759;
    border-color: #34C759;
    color: #ffffff;
}

/* Skipped step dot */
.guided-progress-dot.skipped {
    background: transparent;
    border-color: #FF9500;
    color: #FF9500;
}

/* Active step dot */
.guided-progress-dot.active {
    background: var(--jfp-teal, #00AFD2);
    border-color: var(--jfp-teal, #00AFD2);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 175, 210, 0.4);
    transform: scale(1.1);
}

/* Connecting line between dots */
.guided-progress-line {
    flex: 1;
    height: 2px;
    background: var(--border, rgba(255, 255, 255, 0.15));
    min-width: 8px;
    transition: background 0.3s ease;
}

.guided-progress-line.completed {
    background: #34C759;
}

.guided-progress-line.skipped {
    background: #FF9500;
}

/* Step counter text */
.guided-step-counter {
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary, #8892a8);
    margin-bottom: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Step Card ── */
.guided-step-card {
    background: var(--bg-secondary, #0a0f1f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius, 8px);
    padding: 20px;
    margin-bottom: 16px;
    animation: guidedStepSlide 0.25s ease-out;
}

@keyframes guidedStepSlide {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.guided-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--jfp-teal, #00AFD2);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
    vertical-align: middle;
}

.guided-step-title {
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    font-size: 15px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.guided-step-text {
    color: var(--text-secondary, #c8d0e0);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.guided-step-text strong {
    color: var(--text-primary, #ffffff);
    font-weight: 600;
}

/* ── Action Buttons ── */
.guided-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.guided-btn-fixed,
.guided-btn-next,
.guided-btn-detail {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Fixed It - success green */
.guided-btn-fixed {
    background: #34C759;
    color: #ffffff;
}

.guided-btn-fixed:hover {
    background: #2db84d;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    transform: translateY(-1px);
}

.guided-btn-fixed:active {
    transform: translateY(0);
}

/* Not the Issue - amber/orange */
.guided-btn-next {
    background: #FF9500;
    color: #ffffff;
}

.guided-btn-next:hover {
    background: #e68600;
    box-shadow: 0 4px 12px rgba(255, 149, 0, 0.3);
    transform: translateY(-1px);
}

.guided-btn-next:active {
    transform: translateY(0);
}

/* Need More Detail - cyan brand */
.guided-btn-detail {
    background: transparent;
    color: var(--jfp-teal, #00AFD2);
    border: 1px solid var(--jfp-teal, #00AFD2);
}

.guided-btn-detail:hover {
    background: rgba(0, 175, 210, 0.1);
    box-shadow: 0 4px 12px rgba(0, 175, 210, 0.2);
    transform: translateY(-1px);
}

.guided-btn-detail:active {
    transform: translateY(0);
}

/* ── Completion Card ── */
.guided-complete {
    text-align: center;
    padding: 24px 20px;
    animation: guidedFadeIn 0.3s ease-out;
}

.guided-complete-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.guided-complete-title {
    font-family: var(--font-heading, 'Oswald', sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    margin-bottom: 6px;
}

.guided-complete-subtitle {
    font-size: 13px;
    color: var(--text-secondary, #c8d0e0);
    margin-bottom: 20px;
}

.guided-complete-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

.guided-btn-notes {
    padding: 12px 20px;
    border-radius: var(--radius, 8px);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: var(--jfp-teal, #00AFD2);
    color: #ffffff;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.guided-btn-notes:hover {
    background: #009aba;
    box-shadow: 0 4px 12px rgba(0, 175, 210, 0.3);
    transform: translateY(-1px);
}

.guided-btn-close-final {
    padding: 10px 20px;
    border-radius: var(--radius, 8px);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    color: var(--text-secondary, #c8d0e0);
    transition: all 0.2s ease;
}

.guided-btn-close-final:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-tertiary, #8892a8);
}

/* ── WO Notes Output ── */
.guided-notes-output {
    text-align: left;
    background: var(--bg-secondary, #0a0f1f);
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    border-radius: var(--radius, 8px);
    padding: 16px;
    margin-top: 16px;
    position: relative;
    animation: guidedFadeIn 0.3s ease-out;
}

.guided-notes-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary, #8892a8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.guided-notes-text {
    font-size: 13px;
    color: var(--text-primary, #ffffff);
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: var(--font-body, 'Open Sans', sans-serif);
}

.guided-notes-copy {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    color: var(--text-tertiary, #8892a8);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guided-notes-copy:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #ffffff);
}

/* Loading state for notes generation */
.guided-notes-loading {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary, #8892a8);
    font-size: 13px;
}

.guided-notes-loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border, rgba(255, 255, 255, 0.15));
    border-top-color: var(--jfp-teal, #00AFD2);
    border-radius: 50%;
    animation: guidedSpin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* ── Action Log ── */
.guided-action-log {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border, rgba(255, 255, 255, 0.15));
}

.guided-action-log-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary, #8892a8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.guided-action-log-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary, #c8d0e0);
    padding: 4px 0;
    line-height: 1.4;
}

.guided-action-log-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 12px;
}

.guided-action-log-icon.fixed  { color: #34C759; }
.guided-action-log-icon.skipped { color: #FF9500; }
.guided-action-log-icon.detail  { color: var(--jfp-teal, #00AFD2); }

/* ── All Steps Exhausted Card ── */
.guided-exhausted {
    text-align: center;
    padding: 24px 20px;
    animation: guidedFadeIn 0.3s ease-out;
}

.guided-exhausted-icon {
    font-size: 36px;
    margin-bottom: 10px;
}

.guided-exhausted-title {
    font-family: var(--font-heading, 'Oswald', sans-serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #ffffff);
    margin-bottom: 6px;
}

.guided-exhausted-text {
    font-size: 13px;
    color: var(--text-secondary, #c8d0e0);
    margin-bottom: 16px;
    line-height: 1.5;
}

.guided-exhausted-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
    margin: 0 auto;
}

/* ── Start Guided Button (injected into answer card) ── */
.guided-start-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 20px;
    margin-top: 8px;
    margin-bottom: 4px;
    border-radius: var(--radius, 8px);
    background: linear-gradient(135deg, #00AFD2 0%, #0090B0 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guided-start-btn:hover {
    background: linear-gradient(135deg, #00c4e9 0%, #00AFD2 100%);
    box-shadow: 0 4px 16px rgba(0, 175, 210, 0.35);
    transform: translateY(-1px);
}

.guided-start-btn:active {
    transform: translateY(0);
}

.guided-start-btn-icon {
    font-size: 16px;
}

/* ── Light Mode Overrides ── */
[data-theme="light"] .guided-overlay {
    background: var(--bg-card, #ffffff);
    border-color: var(--border, rgba(14, 20, 62, 0.1));
}

[data-theme="light"] .guided-step-card {
    background: var(--bg-secondary, #f8f9fa);
    border-color: var(--border, rgba(14, 20, 62, 0.1));
}

[data-theme="light"] .guided-progress-dot {
    background: var(--bg-secondary, #f8f9fa);
    border-color: var(--border, rgba(14, 20, 62, 0.1));
    color: var(--text-tertiary, #757575);
}

[data-theme="light"] .guided-step-title {
    color: var(--text-primary, #0e143e);
}

[data-theme="light"] .guided-step-text {
    color: var(--text-secondary, #495057);
}

[data-theme="light"] .guided-notes-output {
    background: var(--bg-secondary, #f8f9fa);
    border-color: var(--border, rgba(14, 20, 62, 0.1));
}

[data-theme="light"] .guided-notes-text {
    color: var(--text-primary, #0e143e);
}

[data-theme="light"] .guided-close {
    border-color: var(--border, rgba(14, 20, 62, 0.1));
    color: var(--text-tertiary, #757575);
}

[data-theme="light"] .guided-close:hover {
    background: rgba(14, 20, 62, 0.05);
    color: var(--text-primary, #0e143e);
}

[data-theme="light"] .guided-btn-close-final {
    border-color: var(--border, rgba(14, 20, 62, 0.1));
    color: var(--text-secondary, #495057);
}

[data-theme="light"] .guided-btn-detail {
    color: #0090B0;
    border-color: #0090B0;
}

[data-theme="light"] .guided-btn-detail:hover {
    background: rgba(0, 175, 210, 0.08);
}

[data-theme="light"] .guided-action-log-item {
    color: var(--text-secondary, #495057);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .guided-overlay {
        padding: 14px;
    }

    .guided-actions {
        flex-direction: column;
    }

    .guided-btn-fixed,
    .guided-btn-next,
    .guided-btn-detail {
        min-width: 100%;
    }

    .guided-progress-dot {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .guided-step-card {
        padding: 14px;
    }
}
