/* experience.css */
.exp-body {
    background: #050a15; /* Darker than midnight */
    overflow: hidden; /* Prevent scrolling, it's an app-like experience */
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.exp-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: transparent;
    border: none;
}

.close-exp {
    color: var(--muted);
    font-family: var(--mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: color 0.2s;
}

.close-exp:hover {
    color: var(--ink);
}

/* 3D Canvas */
#factory-canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    perspective: 1000px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-floor {
    position: absolute;
    width: 200%;
    height: 200%;
    bottom: -50%;
    left: -50%;
    background-image: 
        linear-gradient(rgba(46, 107, 255, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(46, 107, 255, 0.2) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: rotateX(75deg) translateZ(-200px);
    transform-origin: center center;
    opacity: 0.3;
    animation: gridMove 10s linear infinite;
}

@keyframes gridMove {
    0% { background-position: 0 0; }
    100% { background-position: 0 50px; }
}

/* AI Core */
.ai-core {
    position: absolute;
    top: 50%;
    left: 70%; /* Offset to right since UI is on left */
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    transform-style: preserve-3d;
    transition: all 1s ease;
}

/* Base state */
.ai-core.state-1 { transform: translate(-50%, -50%) scale(0.6) rotateX(20deg) rotateY(45deg); opacity: 0.5; }
.ai-core.state-2 { transform: translate(-50%, -50%) scale(1) rotateX(15deg) rotateY(-30deg); opacity: 0.8; }
.ai-core.state-3 { transform: translate(-50%, -50%) scale(1.2) rotateX(10deg) rotateY(15deg); opacity: 1; }
.ai-core.state-launch { 
    transform: translate(-50%, -50%) scale(2.5) rotateX(0deg) rotateY(360deg); 
    transition: transform 3s cubic-bezier(0.4, 0, 0.2, 1);
    left: 50%; /* Center during launch */
}

.core-box {
    width: 100%;
    height: 100%;
    position: absolute;
    transform-style: preserve-3d;
    animation: rotateCore 15s linear infinite;
}

@keyframes rotateCore {
    100% { transform: rotateY(360deg) rotateX(360deg); }
}

.face {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(14, 28, 64, 0.8);
    border: 2px solid var(--cyan);
    box-shadow: inset 0 0 20px rgba(70, 198, 245, 0.5);
}

.front  { transform: translateZ(50px); }
.back   { transform: rotateY(180deg) translateZ(50px); }
.right  { transform: rotateY(90deg) translateZ(50px); }
.left   { transform: rotateY(-90deg) translateZ(50px); }
.top    { transform: rotateX(90deg) translateZ(50px); }
.bottom { transform: rotateX(-90deg) translateZ(50px); }

.core-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(70,198,245,0.4) 0%, transparent 70%);
    filter: blur(20px);
    pointer-events: none;
    transition: all 1s;
}

.ai-core.state-launch .core-glow {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(70,198,245,0.9) 0%, transparent 70%);
    transition: all 2s;
}

.factory-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.2;
}

.factory-lines path {
    stroke: var(--azure);
    stroke-width: 0.5;
    fill: none;
}

/* Floating modules visualization */
#module-container {
    position: absolute;
    top: 50%;
    left: 70%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    pointer-events: none;
    transform-style: preserve-3d;
}

.floating-mod {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(46, 107, 255, 0.2);
    border: 1px solid var(--cyan);
    box-shadow: 0 0 10px rgba(70, 198, 245, 0.3);
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

/* UI Overlay */
.exp-ui {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Align left */
    padding: 0 8%;
    pointer-events: none; 
}

.step-panel {
    width: 100%;
    max-width: 520px;
    background: rgba(10, 22, 51, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 40px;
    pointer-events: auto;
    transition: opacity 0.5s, transform 0.5s;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.step-panel.hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    position: absolute;
}

.step-panel.active {
    opacity: 1;
    transform: translateY(0);
}

.panel-content h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

/* Grid for buttons */
.g-ind {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ind-btn, .comp-btn {
    background: rgba(14, 28, 64, 0.8);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 14px;
    border-radius: 10px;
    font-family: var(--body);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.ind-btn:hover, .comp-btn:hover {
    border-color: var(--cyan);
    background: rgba(46, 107, 255, 0.1);
}

.comp-btn.selected {
    background: rgba(46, 107, 255, 0.2);
    border-color: var(--cyan);
    box-shadow: 0 0 15px rgba(70, 198, 245, 0.2);
}

.g-comp {
    margin-top: 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 10px;
}

.g-comp::-webkit-scrollbar { width: 4px; }
.g-comp::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); border-radius: 2px; }
.g-comp::-webkit-scrollbar-thumb { background: var(--azure); border-radius: 2px; }

.mt-4 { margin-top: 24px; }

button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Kio Chat */
.kio-chat-box {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.kio-header {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 16px;
}

.kio-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--panel);
    padding: 4px;
    border: 1px solid var(--line);
}

.kio-name {
    font-family: var(--disp);
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.kio-role {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--cyan);
    text-transform: uppercase;
    margin: 4px 0 0 0;
}

.chat-flow {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.msg {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    max-width: 90%;
    line-height: 1.4;
}

.msg.bot {
    background: rgba(14, 28, 64, 0.8);
    border: 1px solid var(--line);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.msg.user {
    background: linear-gradient(120deg, var(--azure), var(--cyan));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.highlight {
    color: var(--cyan);
    font-weight: 600;
}

.chat-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    background: transparent;
    border: 1px solid var(--cyan);
    color: var(--cyan);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: rgba(70, 198, 245, 0.15);
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

#kio-input {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 10px 14px;
    border-radius: 8px;
    font-family: var(--body);
}

#kio-input:focus {
    outline: none;
    border-color: var(--cyan);
}

#kio-send {
    background: var(--azure);
    color: white;
    border: none;
    border-radius: 8px;
    width: 44px;
    cursor: pointer;
    font-size: 1.2rem;
}

.typing-indicator {
    align-self: flex-start;
    background: rgba(14, 28, 64, 0.8);
    border: 1px solid var(--line);
    padding: 12px 16px;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    height: 38px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); background: var(--cyan); }
}

.fade-in { animation: fadeIn 0.5s forwards; }
.fade-in-delay { opacity: 0; animation: fadeIn 0.5s forwards 0.5s; }

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

/* Step 4: Deploy */
.center-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.btn-deploy {
    font-size: 1.2rem;
    padding: 16px 40px;
    margin-top: 30px;
}

.pulse-btn {
    animation: btnPulse 2s infinite;
}

@keyframes btnPulse {
    0% { box-shadow: 0 0 0 0 rgba(70, 198, 245, 0.4); }
    70% { box-shadow: 0 0 0 20px rgba(70, 198, 245, 0); }
    100% { box-shadow: 0 0 0 0 rgba(70, 198, 245, 0); }
}

.glitch {
    position: relative;
    color: white;
    text-shadow: 0 0 10px rgba(70, 198, 245, 0.8);
}

/* Step 5: Result */
.roi-card {
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.roi-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 12px;
}
.roi-metric:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.roi-lbl {
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
    text-transform: uppercase;
}

.roi-val {
    font-family: var(--disp);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--cyan);
}

.roi-val small {
    font-size: 0.8rem;
    color: var(--muted);
    font-weight: 400;
}

.gold { color: var(--gold); }

.result-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* Responsive */
@media(max-width: 900px) {
    .exp-ui {
        justify-content: center;
        padding: 0 20px;
        align-items: flex-end;
        padding-bottom: 40px;
    }
    
    .ai-core {
        top: 30%; 
        left: 50%;
    }

    #module-container {
        top: 30%;
        left: 50%;
    }

    .step-panel {
        max-width: 100%;
        padding: 24px;
    }

    .g-ind {
        grid-template-columns: 1fr 1fr;
    }
}
