/* =========================================
   SECTION 01: DIAGNOSIS (PAIN CAROUSEL)
   ========================================= */
/* КОНЦЕПТ: 3 слайда с разными "болями" AI-систем:
   1. CHAT PAIN: бесконечные правки
   2. AGENT PAIN: retry, timeout, stuck
   3. AUTOMATION PAIN: непонятные соединения, постоянный debug */



/* --- CAROUSEL WRAPPER --- */
.diagnosis-carousel-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px 20px;
}

/* --- SLIDES CONTAINER --- */
.diagnosis-slides {
    width: 620px;
    height: 520px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    border-radius: 18px;
}

.diagnosis-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transform: translateX(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, visibility 0s 0.6s;
    pointer-events: none;
}

.diagnosis-slide.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, visibility 0s 0s;
    pointer-events: all;
}

/* --- NAVIGATION DOTS --- */
.diagnosis-nav {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    position: absolute;
    bottom: 20px;
}

.diag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #CCC;
    cursor: pointer;
    transition: all 0.3s ease;
}

.diag-dot:hover {
    background: #999;
    transform: scale(1.2);
}

.diag-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #FF6633;
}

/* --- NAVIGATION ARROWS --- */
.diag-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.diag-arrow:hover {
    background: #FFFFFF;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.1);
}

.diag-arrow.prev {
    left: -60px;
}

.diag-arrow.next {
    right: -60px;
}

.diag-arrow svg {
    width: 20px;
    height: 20px;
    stroke: #333;
    stroke-width: 2.5;
}


/* ===============================================
   SLIDE 1: CHAT PAIN (уже готов)
   =============================================== */
.pain-container {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.pain-container::before {
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #333;
    z-index: 10;
    height: 44px;
    background: radial-gradient(circle at center, #fcfcfc, #fcfcfc);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    content: 'ИИ чат-бот';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
}

.chat-messages {
    width: 100%;
    aspect-ratio: 16 / 10;
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
    background: radial-gradient(circle at center, #F5F5F7, #E0E0E5);
    gap: 10px;
    flex: 1;
    padding: 65px 20px 90px 20px;
}

.msg {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13.5px;
    line-height: 1.5;
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    animation: msg-appear 0.3s ease-out forwards;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.msg-user {
    align-self: flex-end;
    background: #343541;
    color: #ECECF1;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.msg-ai {
    align-self: flex-start;
    background: #FFFFFF;
    color: #353740;
    border: 1px solid #E5E7EB;
    border-bottom-left-radius: 4px;
}

.msg-ai.error {
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    color: #DC2626;
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.1);
}

.msg-ai.error::before {
    content: '⚠ ';
    opacity: 0.7;
}

.msg-ai.water {
    opacity: 0.55;
    font-style: italic;
}

.msg:nth-child(1) {
    animation-delay: 0.5s;
}

.msg:nth-child(2) {
    animation-delay: 1.5s;
}

.msg:nth-child(3) {
    animation-delay: 3s;
}

.msg:nth-child(4) {
    animation-delay: 4.5s;
}

.msg:nth-child(5) {
    animation-delay: 6s;
}

.msg:nth-child(6) {
    animation-delay: 7.5s;
}

.msg:nth-child(7) {
    animation-delay: 9s;
}

@keyframes msg-appear {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.96);
    }

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

.chat-result-danger {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.95) 0%, rgba(185, 28, 28, 0.95) 100%);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    color: #FFFFFF;
    text-align: center;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3), 0 2px 4px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    opacity: 0;
    animation: result-appear 0.4s ease-out 9.5s forwards;
    z-index: 20;
}

@keyframes result-appear {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #DDD;
    border-radius: 3px;
}

/* ===============================================
   SLIDE 2: AGENT PAIN
   =============================================== */
.agent-container {
    width: 100%;
    height: 100%;
    background: #1E1E1E;
    border-radius: 20px;
    box-shadow: 0 24px 56px -12px rgba(0, 0, 0, 0.24);
    position: relative;
    overflow: hidden;
    padding: 24px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.agent-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #888;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.agent-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.log-line {
    font-size: 13px;
    line-height: 1.6;
    color: #AAA;
    opacity: 0;
    transform: translateX(-8px);
    animation: log-line-appear 0.3s ease-out forwards;
}

.log-line.error {
    color: #FF6B6B;
}

.log-line.warn {
    color: #FFB84D;
}

.log-line:nth-child(1) {
    animation-delay: 0.5s;
}

.log-line:nth-child(2) {
    animation-delay: 1s;
}

.log-line:nth-child(3) {
    animation-delay: 2s;
}

.log-line:nth-child(4) {
    animation-delay: 3s;
}

.log-line:nth-child(5) {
    animation-delay: 4.5s;
}

.log-line:nth-child(6) {
    animation-delay: 5.5s;
}

.log-line:nth-child(7) {
    animation-delay: 6.5s;
}

.log-line:nth-child(8) {
    animation-delay: 7.5s;
}

.log-line:nth-child(9) {
    animation-delay: 8.5s;
}

@keyframes log-line-appear {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

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

.agent-result {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    padding: 12px 16px;
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #FF6B6B;
    text-align: center;
    opacity: 0;
    animation: result-appear 0.4s ease-out 9.5s forwards;
}

.agent-log::-webkit-scrollbar {
    width: 6px;
}

.agent-log::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* ===============================================
   SLIDE 3: AUTOMATION PAIN
   =============================================== */
.automation-container {
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    border-radius: 20px;
    box-shadow: 0 24px 56px -12px rgba(0, 0, 0, 0.12);
    position: relative;
    overflow: hidden;
    padding: 24px;
}

.automation-header {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #999;
    margin-bottom: 24px;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.workflow-canvas {
    width: 100%;
    height: 380px;
    background: #FAFAFA;
    border-radius: 12px;
    position: relative;
    padding: 50px 20px;
}

.wf-node {
    position: absolute;
    width: 100px;
    height: 60px;
    background: linear-gradient(135deg, #FFF 0%, #F5F5F5 100%);
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    opacity: 0;
    animation: node-appear 0.4s ease-out forwards;
}

.node-1 {
    left: 30px;
    top: 30px;
    animation-delay: 0.5s;
}

.node-2 {
    left: 180px;
    top: 30px;
    animation-delay: 1s;
    border-color: #FFB84D;
}

.node-3 {
    left: 330px;
    top: 30px;
    animation-delay: 1.5s;
    border-color: #FFB84D;
}

.node-4 {
    left: 480px;
    top: 30px;
    animation-delay: 2s;
}

@keyframes node-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

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

.wf-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.wf-line {
    stroke: #CCC;
    stroke-width: 2;
    stroke-dasharray: 6 4;
    opacity: 0;
    animation: line-appear 0.5s ease-out forwards;
}

.wf-line:nth-child(1) {
    animation-delay: 1.2s;
}

.wf-line:nth-child(2) {
    animation-delay: 1.7s;
}

.wf-line:nth-child(3) {
    animation-delay: 2.2s;
}

.wf-line.broken {
    stroke: #FF9966;
    stroke-dasharray: 3 3;
    animation: line-broken 1s ease-in-out infinite;
}

@keyframes line-appear {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes line-broken {

    0%,
    100% {
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dashoffset: 6;
    }
}

.wf-error {
    position: absolute;
    left: 190px;
    top: 120px;
    padding: 8px 12px;
    background: rgba(255, 51, 0, 0.1);
    border: 1px solid rgba(255, 51, 0, 0.3);
    border-radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #CC3300;
    opacity: 0;
    animation: error-popup 0.3s ease-out 3s forwards;
}

@keyframes error-popup {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

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

.automation-result {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 24px;
    padding: 12px 16px;
    background: rgba(255, 51, 0, 0.08);
    border: 1px solid rgba(255, 51, 0, 0.2);
    border-radius: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #CC3300;
    text-align: center;
    opacity: 0;
    animation: result-appear 0.4s ease-out 9s forwards;
}

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 1200px) {
    .diagnosis-slides {
        width: 540px;
        height: 460px;
    }
}

/* ===================================================
   SLIDE 2: RANDOMNESS (LLM НЕПРЕДСКАЗУЕМОСТЬ)
   =================================================== */
.randomness-container {
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.randomness-header {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #1A1A1A;
    text-align: center;
    opacity: 0;
    animation: header-appear 0.4s ease-out 0.3s forwards;
}

.attempts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    flex: 1;
}

.attempt-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 248, 248, 0.9) 100%);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    animation: box-appear 0.4s ease-out forwards;
}

.attempt-box:nth-child(1) {
    animation-delay: 0.5s;
}

.attempt-box:nth-child(2) {
    animation-delay: 0.7s;
}

.attempt-box:nth-child(3) {
    animation-delay: 0.9s;
}

@keyframes box-appear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.attempt-label {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #666;
    letter-spacing: 0.5px;
}

.attempt-output {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.output-line {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    color: #10B981;
    padding: 4px 8px;
    background: rgba(16, 185, 129, 0.05);
    border-left: 3px solid #10B981;
    border-radius: 4px;
}

.output-line.error {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.05);
    border-left-color: #EF4444;
}

.output-line.warn {
    color: #F59E0B;
    background: rgba(245, 158, 11, 0.05);
    border-left-color: #F59E0B;
}

.attempt-status {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: center;
}

.attempt-status.success {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #FFFFFF;
}

.attempt-status.fail {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #FFFFFF;
}

.randomness-result-danger {
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #DC2626;
    text-align: center;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
    opacity: 0;
    animation: result-appear 0.4s ease-out 2s forwards;
}

/* ===================================================
   SLIDE 3: BUILDER (N8N/FLOWISE HELL)
   =================================================== */
.builder-container {
    width: 100%;
    height: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1A1A1A 0%, #2A2A2A 100%);
    border-radius: 10px;
    opacity: 0;
    animation: header-appear 0.4s ease-out 0.3s forwards;
}

.builder-logo {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: 0.5px;
}

.builder-status.error {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    font-weight: 700;
    color: #EF4444;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 6px;
}

.builder-canvas {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 240, 240, 0.95) 100%);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 20px;
    overflow: hidden;
}

.builder-node {
    position: absolute;
    width: 140px;
    padding: 12px;
    background: #FFFFFF;
    border: 2px solid #EF4444;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
    opacity: 0;
    animation: node-error-appear 0.5s ease-out forwards;
}

.builder-node:nth-child(1) {
    animation-delay: 0.5s;
}

.builder-node:nth-child(2) {
    animation-delay: 0.7s;
}

.builder-node:nth-child(3) {
    animation-delay: 0.9s;
}

.builder-node:nth-child(4) {
    animation-delay: 1.1s;
}

@keyframes node-error-appear {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.node-icon {
    font-size: 28px;
    text-align: center;
    margin-bottom: 8px;
}

.node-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #1A1A1A;
    text-align: center;
    margin-bottom: 6px;
}

.node-error {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 10px;
    color: #EF4444;
    text-align: center;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

.builder-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.conn-broken {
    stroke: #EF4444;
    stroke-width: 3;
    stroke-dasharray: 8 4;
    opacity: 0;
    animation: line-appear 0.6s ease-out 1.3s forwards;
}

@keyframes line-appear {
    from {
        opacity: 0;
    }

    to {
        opacity: 0.6;
    }
}

.builder-errors {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: rgba(239, 68, 68, 0.05);
    border: 2px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    opacity: 0;
    animation: result-appear 0.4s ease-out 1.5s forwards;
}

.error-item {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 11px;
    color: #DC2626;
    font-weight: 600;
}

.builder-result-danger {
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #DC2626;
    text-align: center;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.15);
    opacity: 0;
    animation: result-appear 0.4s ease-out 2s forwards;
}