/**
 * Mitaar AI — שפה עיצובית (v2)
 * השראה: Gamma / Tome / Linear — אפליקציית AI כהה, זכוכית, גרדיאנט חתימה.
 */

:root {
    --mai-bg: #0b0e1a;
    --mai-bg-soft: #11152a;
    --mai-panel: rgba(255, 255, 255, 0.045);
    --mai-panel-strong: rgba(255, 255, 255, 0.08);
    --mai-border: rgba(255, 255, 255, 0.09);
    --mai-text: #e9ebf5;
    --mai-text-muted: #9aa1b8;
    --mai-indigo: #6366f1;
    --mai-violet: #a855f7;
    --mai-pink: #ec4899;
    --mai-gradient: linear-gradient(120deg, #6366f1, #a855f7 55%, #ec4899);
    --mai-radius: 16px;
    --mai-radius-sm: 10px;
    --mai-shadow: 0 20px 60px rgba(3, 6, 20, 0.55);
    --mai-font: "Heebo", -apple-system, "Segoe UI", sans-serif;
}

/* ---------- בסיס האפליקציה ---------- */

body.mai-app {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 85% -10%, rgba(99, 102, 241, 0.16), transparent 60%),
        radial-gradient(1000px 600px at 8% 110%, rgba(236, 72, 153, 0.10), transparent 55%),
        var(--mai-bg);
    color: var(--mai-text);
    font-family: var(--mai-font);
    overflow-x: hidden;
}

body.mai-app * {
    box-sizing: border-box;
}

/* בלובים מרחפים ברקע */
.mai-bg-blobs {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.mai-blob {
    position: absolute;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.35;
    animation: mai-float 16s ease-in-out infinite alternate;
}

.mai-blob-a {
    background: #4438ca66;
    top: -180px;
    inset-inline-start: -120px;
}

.mai-blob-b {
    background: #a855f74d;
    bottom: -200px;
    inset-inline-end: -140px;
    animation-delay: -8s;
}

@keyframes mai-float {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(60px, 40px, 0) scale(1.15); }
}

/* ---------- לוגו וכפתורים ---------- */

.mai-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
}

.mai-logo-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--mai-gradient);
    color: #fff;
    font-size: 17px;
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.45);
}

.mai-logo-text {
    font-size: 19px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.mai-logo-text b {
    background: var(--mai-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-weight: 800;
    margin-inline-start: 2px;
}

.mai-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: 0;
    border-radius: 12px;
    background: var(--mai-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s;
    box-shadow: 0 6px 22px rgba(139, 92, 246, 0.35);
}

.mai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(139, 92, 246, 0.5);
    color: #fff;
}

.mai-btn:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}

.mai-btn-lg {
    padding: 15px 34px;
    font-size: 17px;
    border-radius: 14px;
}

.mai-btn-ghost {
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    box-shadow: none;
    color: var(--mai-text);
}

.mai-btn-ghost:hover {
    background: var(--mai-panel-strong);
    box-shadow: none;
    color: #fff;
}

/* ============================================================
   נחיתה
   ============================================================ */

.mai-landing {
    position: relative;
    z-index: 1;
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 24px 80px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mai-landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mai-hero {
    text-align: center;
    margin-top: clamp(48px, 12vh, 130px);
}

.mai-hero-badge {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 999px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    color: var(--mai-text-muted);
    font-size: 13.5px;
    margin-bottom: 26px;
}

.mai-hero-title {
    margin: 0;
    font-size: clamp(38px, 6.2vw, 68px);
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.mai-gradient-text {
    background: var(--mai-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mai-hero-sub {
    max-width: 640px;
    margin: 22px auto 0;
    color: var(--mai-text-muted);
    font-size: clamp(16px, 1.9vw, 19px);
    line-height: 1.75;
    font-weight: 300;
}

.mai-hero-actions {
    margin-top: 36px;
}

.mai-hero-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: clamp(56px, 10vh, 96px);
    text-align: right;
}

.mai-step-card {
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    padding: 24px 22px;
    backdrop-filter: blur(14px);
    transition: transform 0.2s ease, border-color 0.2s;
}

.mai-step-card:hover {
    transform: translateY(-4px);
    border-color: rgba(168, 85, 247, 0.45);
}

.mai-step-icon {
    font-size: 26px;
}

.mai-step-card h3 {
    margin: 12px 0 6px;
    font-size: 17px;
    font-weight: 700;
}

.mai-step-card p {
    margin: 0;
    color: var(--mai-text-muted);
    font-size: 14px;
    line-height: 1.65;
}

/* שקפי דמה מרחפים */
.mai-hero-deck {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.mai-mock-slide {
    position: absolute;
    width: 190px;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--mai-border);
    backdrop-filter: blur(8px);
    padding: 14px;
    animation: mai-drift 12s ease-in-out infinite alternate;
}

.mai-mock-slide i,
.mai-mock-slide b,
.mai-mock-slide u {
    display: block;
    border-radius: 4px;
}

.mai-mock-slide i {
    width: 55%;
    height: 10px;
    background: var(--mai-gradient);
    opacity: 0.85;
}

.mai-mock-slide b {
    width: 85%;
    height: 6px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.22);
}

.mai-mock-slide u {
    width: 70%;
    height: 6px;
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.13);
}

.mai-mock-1 { top: 16%; inset-inline-start: 5%; transform: rotate(-7deg); }
.mai-mock-2 { top: 34%; inset-inline-end: 4%; transform: rotate(6deg); animation-delay: -4s; }
.mai-mock-3 { bottom: 12%; inset-inline-start: 12%; transform: rotate(4deg); animation-delay: -8s; }

@keyframes mai-drift {
    from { translate: 0 0; }
    to   { translate: 0 -26px; }
}

/* ============================================================
   הסטודיו
   ============================================================ */

.mai-studio {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ---------- topbar ---------- */

.mai-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 12px 22px;
    border-bottom: 1px solid var(--mai-border);
    background: rgba(11, 14, 26, 0.7);
    backdrop-filter: blur(16px);
}

.mai-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mai-avatar {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mai-panel-strong);
    border: 1px solid var(--mai-border);
    font-weight: 700;
    font-size: 15px;
}

/* מחוון פאזות */
.mai-phase-indicator {
    display: flex;
    align-items: center;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 5px;
    border-radius: 999px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
}

.mai-phase-indicator li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    border-radius: 999px;
    color: var(--mai-text-muted);
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.25s, color 0.25s;
}

.mai-phase-dot {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--mai-panel-strong);
    font-size: 11px;
    font-weight: 700;
}

.mai-phase-indicator li.is-active {
    background: var(--mai-gradient);
    color: #fff;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.mai-phase-indicator li.is-active .mai-phase-dot {
    background: rgba(255, 255, 255, 0.25);
}

.mai-phase-indicator li.is-done {
    color: #c4b5fd;
}

.mai-phase-indicator li.is-done .mai-phase-dot {
    background: rgba(139, 92, 246, 0.35);
}

@media (max-width: 900px) {
    .mai-phase-name { display: none; }
}

/* ---------- גוף: צ'אט + קנבס ---------- */

.mai-studio-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.mai-chat-pane {
    display: flex;
    flex-direction: column;
    width: 400px;
    min-width: 320px;
    border-inline-end: 1px solid var(--mai-border);
    background: rgba(15, 18, 34, 0.55);
    backdrop-filter: blur(16px);
}

.mai-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--mai-border);
}

.mai-chat-head strong {
    display: block;
    font-size: 15px;
}

.mai-chat-head small {
    color: var(--mai-text-muted);
    font-size: 12px;
}

.mai-ai-avatar {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--mai-gradient);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    flex: 0 0 auto;
}

.mai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.mai-chat-bubble {
    max-width: 88%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.65;
    font-size: 14.5px;
    white-space: pre-wrap;
    animation: mai-bubble-in 0.25s ease both;
}

@keyframes mai-bubble-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.mai-chat-bubble.is-user {
    align-self: flex-start;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(168, 85, 247, 0.22));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-end-start-radius: 4px;
}

.mai-chat-bubble.is-assistant {
    align-self: flex-end;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-end-end-radius: 4px;
}

.mai-chat-bubble.is-typing {
    color: var(--mai-text-muted);
    font-style: italic;
    position: relative;
}

.mai-chat-bubble.is-typing::after {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-inline-start: 8px;
    border-radius: 50%;
    background: var(--mai-violet);
    animation: mai-pulse 1s ease-in-out infinite;
    vertical-align: middle;
}

@keyframes mai-pulse {
    0%, 100% { opacity: 0.25; transform: scale(0.8); }
    50%      { opacity: 1; transform: scale(1.25); }
}

.mai-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid var(--mai-border);
}

.mai-chat-form textarea {
    flex: 1;
    resize: none;
    max-height: 130px;
    border: 1px solid var(--mai-border);
    border-radius: 14px;
    background: var(--mai-panel);
    color: var(--mai-text);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mai-chat-form textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.mai-chat-form textarea::placeholder {
    color: var(--mai-text-muted);
}

.mai-send-btn {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 13px;
    background: var(--mai-gradient);
    color: #fff;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    flex: 0 0 auto;
}

.mai-send-btn svg {
    transform: scaleX(-1); /* RTL */
}

.mai-send-btn:hover {
    transform: translateY(-1px) scale(1.04);
}

.mai-send-btn:disabled {
    opacity: 0.5;
    cursor: wait;
    transform: none;
}

/* ---------- קנבס ---------- */

.mai-preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 26px;
    min-width: 0;
    overflow-y: auto;
}

#mai-phase-panel {
    width: 100%;
    max-width: 880px;
}

.mai-preview-canvas-wrap {
    width: 100%;
    max-width: 880px;
}

.mai-preview-canvas {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--mai-shadow), 0 0 0 1px var(--mai-border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.mai-preview-empty {
    text-align: center;
    color: #6b7280;
}

.mai-preview-empty-icon {
    display: inline-grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--mai-gradient);
    color: #fff;
    font-size: 24px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.35);
}

.mai-preview-empty p {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #374151;
}

.mai-preview-empty small {
    color: #9ca3af;
}

/* ---------- deck strip ---------- */

.mai-deck-strip-wrap {
    border-top: 1px solid var(--mai-border);
    background: rgba(11, 14, 26, 0.7);
    backdrop-filter: blur(16px);
}

.mai-deck-strip {
    display: flex;
    gap: 12px;
    padding: 14px 22px;
    overflow-x: auto;
    min-height: 96px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.mai-deck-thumb {
    position: relative;
    width: 128px;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--mai-border);
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.mai-deck-thumb:hover {
    transform: translateY(-3px);
}

.mai-deck-thumb.is-active {
    box-shadow: 0 0 0 2px var(--mai-violet), 0 8px 20px rgba(139, 92, 246, 0.35);
}

.mai-deck-thumb.is-done::after {
    content: "✓";
    position: absolute;
    top: 4px;
    inset-inline-end: 4px;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 10px;
    z-index: 3;
}

.mai-deck-thumb-canvas {
    position: absolute;
    inset: 0;
    background: #fff;
}

.mai-deck-thumb-canvas.is-empty {
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.05), rgba(255,255,255,0.05) 6px, transparent 6px, transparent 12px);
}

.mai-deck-thumb-label {
    position: absolute;
    bottom: 0;
    inset-inline: 0;
    z-index: 2;
    padding: 3px 7px;
    font-size: 10px;
    color: #e9ebf5;
    background: linear-gradient(transparent, rgba(5, 8, 18, 0.85));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- פאנלי פאזה (מתווה / קונספטים / סקירה) ---------- */

.mai-outline-editor,
.mai-concept-cards,
.mai-review-bar {
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    padding: 20px 24px;
    backdrop-filter: blur(14px);
    animation: mai-bubble-in 0.3s ease both;
}

.mai-outline-editor h3,
.mai-concept-cards h3 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 700;
}

.mai-outline-list {
    margin: 14px 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 42vh;
    overflow-y: auto;
}

.mai-outline-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--mai-radius-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: border-color 0.15s;
}

.mai-outline-item:hover {
    border-color: var(--mai-border);
}

.mai-outline-item input {
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--mai-text);
    font-family: inherit;
    font-size: 14.5px;
    padding: 4px 6px;
    border-radius: 6px;
}

.mai-outline-item input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
}

.mai-outline-item small {
    color: var(--mai-text-muted);
    max-width: 230px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.mai-outline-controls {
    display: flex;
    gap: 4px;
}

.mai-outline-controls button {
    border: 0;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--mai-panel-strong);
    color: var(--mai-text-muted);
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s, color 0.15s;
}

.mai-outline-controls button:hover {
    background: rgba(139, 92, 246, 0.3);
    color: #fff;
}

.mai-concept-row {
    display: flex;
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.mai-concept-card {
    flex: 1;
    min-width: 200px;
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    background: rgba(255, 255, 255, 0.03);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.mai-concept-card:hover {
    transform: translateY(-4px);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 12px 30px rgba(3, 6, 20, 0.45);
}

.mai-concept-card strong {
    font-size: 16px;
}

.mai-concept-card small {
    color: var(--mai-text-muted);
}

.mai-concept-swatch {
    display: flex;
    gap: 6px;
}

.mai-concept-swatch span {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    display: inline-block;
}

.mai-review-bar p {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 15px;
}

/* ============================================================
   בונה רצף ההצגה (פאזת המתווה) — מפת זרימה בסגנון node-graph
   ============================================================ */

.mai-flow-wrap {
    width: 100%;
    max-width: 980px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    padding: 22px 26px;
    backdrop-filter: blur(14px);
    animation: mai-bubble-in 0.3s ease both;
}

.mai-flow-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.mai-flow-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.mai-flow-head p {
    margin: 4px 0 0;
    color: var(--mai-text-muted);
    font-size: 13.5px;
}

.mai-flow-board {
    position: relative;
    margin-top: 16px;
    min-height: 120px;
}

.mai-flow-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.mai-flow-svg path {
    fill: none;
    stroke: url(#mai-flow-grad);
    stroke-width: 2;
    opacity: 0.75;
    stroke-dasharray: 6 5;
    animation: mai-flow-dash 1.2s linear infinite;
}

@keyframes mai-flow-dash {
    to { stroke-dashoffset: -22; }
}

.mai-flow-nodes {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 26px 34px;
    padding: 6px 2px;
}

.mai-flow-node {
    position: relative;
    width: 200px;
    border-radius: 14px;
    background: rgba(17, 21, 42, 0.92);
    border: 1px solid var(--mai-border);
    padding: 12px 14px 12px;
    cursor: grab;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}

.mai-flow-node:hover {
    transform: translateY(-3px);
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 12px 28px rgba(3, 6, 20, 0.5);
}

.mai-flow-node.is-dragging {
    opacity: 0.35;
    cursor: grabbing;
}

.mai-flow-node.is-drop-target {
    border-color: var(--mai-pink);
    box-shadow: 0 0 0 2px rgba(236, 72, 153, 0.45);
}

/* פס עליון צבעוני לפי סוג הארכיטיפ */
.mai-flow-node::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 14px;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: var(--mai-node-color, var(--mai-gradient));
}

/* נקודות חיבור (in מימין, out משמאל — RTL) */
.mai-flow-dot {
    position: absolute;
    top: 50%;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--mai-bg);
    border: 2.5px solid var(--mai-violet);
    transform: translateY(-50%);
    z-index: 2;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.55);
}

.mai-flow-dot.is-in  { inset-inline-start: -6px; }
.mai-flow-dot.is-out { inset-inline-end: -6px; }

.mai-flow-node-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.mai-flow-num {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--mai-panel-strong);
    font-size: 12px;
    font-weight: 700;
    color: #c4b5fd;
}

.mai-flow-icon {
    font-size: 15px;
}

.mai-flow-type {
    font-size: 10.5px;
    color: var(--mai-text-muted);
    letter-spacing: 0.3px;
    margin-inline-start: auto;
}

.mai-flow-del {
    border: 0;
    background: transparent;
    color: var(--mai-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 5px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.mai-flow-node:hover .mai-flow-del {
    opacity: 1;
}

.mai-flow-del:hover {
    color: #f87171;
}

.mai-flow-node input.mai-flow-title {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--mai-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 3px 5px;
    border-radius: 6px;
    cursor: text;
}

.mai-flow-node input.mai-flow-title:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.07);
}

.mai-flow-purpose {
    display: block;
    margin-top: 5px;
    padding: 0 5px;
    color: var(--mai-text-muted);
    font-size: 11.5px;
    line-height: 1.5;
    max-height: 3em;
    overflow: hidden;
}

.mai-flow-add {
    width: 46px;
    height: 46px;
    align-self: center;
    border: 1.5px dashed rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: transparent;
    color: var(--mai-text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, transform 0.15s;
}

.mai-flow-add:hover {
    border-color: var(--mai-violet);
    color: #c4b5fd;
    transform: scale(1.06);
}

.mai-flow-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.mai-flow-hint {
    color: var(--mai-text-muted);
    font-size: 12.5px;
}

/* ---------- פרקים בבונה הרצף ---------- */

.mai-flow-chapters {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 22px;
    padding: 6px 2px;
}

.mai-flow-chapter {
    border: 1.5px dashed rgba(168, 85, 247, 0.28);
    border-radius: 16px;
    padding: 10px 14px 14px;
    background: rgba(139, 92, 246, 0.05);
    transition: border-color 0.2s, background 0.2s;
}

.mai-flow-chapter:hover {
    border-color: rgba(168, 85, 247, 0.5);
    background: rgba(139, 92, 246, 0.08);
}

.mai-flow-chapter-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.mai-flow-chapter-num {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--mai-gradient);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    box-shadow: 0 3px 10px rgba(139, 92, 246, 0.4);
}

.mai-flow-chapter-title {
    border: 0;
    background: transparent;
    color: #d9ccff;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 7px;
    min-width: 90px;
    max-width: 200px;
}

.mai-flow-chapter-title:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.07);
}

.mai-flow-chapter-move {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s;
}

.mai-flow-chapter:hover .mai-flow-chapter-move {
    opacity: 1;
}

.mai-flow-chapter-move button {
    border: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--mai-panel-strong);
    color: var(--mai-text-muted);
    cursor: pointer;
    font-size: 10px;
}

.mai-flow-chapter-move button:hover {
    background: rgba(139, 92, 246, 0.35);
    color: #fff;
}

.mai-flow-chapter .mai-flow-nodes {
    padding: 0;
    gap: 20px 26px;
}

/* ---------- סרט האג'נדה (מעל הקנבס בפאזת הבנייה) ---------- */

.mai-agenda-ribbon {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: 999px;
    backdrop-filter: blur(14px);
    animation: mai-bubble-in 0.3s ease both;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

.mai-agenda-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.mai-agenda-chip-name {
    font-size: 13px;
    color: var(--mai-text-muted);
    white-space: nowrap;
    transition: color 0.25s;
}

/* הזיקה: הפרק של השקף הפעיל זוהר */
.mai-agenda-chip.is-active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(236, 72, 153, 0.18));
    border-color: rgba(168, 85, 247, 0.55);
    box-shadow: 0 4px 18px rgba(139, 92, 246, 0.35);
}

.mai-agenda-chip.is-active .mai-agenda-chip-name {
    color: #fff;
    font-weight: 700;
}

.mai-agenda-link {
    width: 26px;
    height: 2px;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.55), rgba(99, 102, 241, 0.25));
    flex: 0 0 auto;
}

.mai-agenda-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.mai-agenda-dot {
    width: 9px;
    height: 9px;
    padding: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.mai-agenda-dot:hover {
    transform: scale(1.35);
}

.mai-agenda-dot.is-built {
    background: rgba(168, 85, 247, 0.55);
    border-color: rgba(168, 85, 247, 0.7);
}

.mai-agenda-dot.is-done {
    background: #22c55e;
    border-color: #22c55e;
}

.mai-agenda-dot.is-current {
    background: var(--mai-gradient);
    border-color: transparent;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.3), 0 0 10px rgba(236, 72, 153, 0.5);
    transform: scale(1.25);
}

/* אנימציית "נחיתה" של השקפים לרצועה אחרי אישור הרצף */
.mai-deck-thumb.mai-drop-in {
    animation: mai-drop-in 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes mai-drop-in {
    from { opacity: 0; transform: translateY(-26px) scale(0.85); }
    to   { opacity: 1; transform: none; }
}

/* ============================================================
   מסך הבית האישי
   ============================================================ */

.mai-home {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mai-home-main {
    flex: 1;
    width: 100%;
    max-width: 1060px;
    margin: 0 auto;
    padding: 20px 24px 60px;
}

.mai-home-hero {
    text-align: center;
    padding: clamp(30px, 7vh, 70px) 0 34px;
}

.mai-home-name {
    margin: 0;
    font-size: clamp(34px, 5vw, 54px);
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(120deg, #fff 30%, #c4b5fd 70%, #f0abfc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.mai-home-summary {
    max-width: 620px;
    margin: 14px auto 26px;
    color: var(--mai-text-muted);
    font-size: clamp(15px, 1.8vw, 17.5px);
    line-height: 1.7;
    min-height: 1.7em;
}

.mai-home-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 18px;
}

@media (max-width: 900px) {
    .mai-home-grid { grid-template-columns: 1fr; }
}

.mai-home-card {
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    padding: 18px 20px;
    backdrop-filter: blur(14px);
    transition: border-color 0.2s, transform 0.2s;
    min-height: 180px;
}

.mai-home-card:hover {
    border-color: rgba(168, 85, 247, 0.4);
}

.mai-home-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.mai-home-card-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    flex: 1;
}

.mai-home-card-icon {
    font-size: 19px;
}

.mai-home-count {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--mai-panel-strong);
    color: #c4b5fd;
    font-size: 12.5px;
    font-weight: 700;
}

.mai-home-count:empty { display: none; }

.mai-home-badge {
    padding: 3px 11px;
    border-radius: 999px;
    background: linear-gradient(120deg, rgba(99, 102, 241, 0.3), rgba(236, 72, 153, 0.25));
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #d9ccff;
    font-size: 11.5px;
    font-weight: 600;
}

.mai-home-empty {
    color: var(--mai-text-muted);
    font-size: 13.5px;
    line-height: 1.65;
    padding: 12px 2px;
}

.mai-home-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--mai-radius-sm);
    transition: background 0.15s;
}

.mai-home-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.mai-home-row-info strong {
    display: block;
    font-size: 14.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

.mai-home-row-info small {
    color: var(--mai-text-muted);
    font-size: 12px;
}

.mai-home-row-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.mai-home-row-actions .mai-btn {
    padding: 7px 15px;
    font-size: 13px;
}

.mai-home-images {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mai-home-images img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--mai-border);
}

/* המכונה האישית */
.mai-prefs {
    margin-top: 18px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: var(--mai-radius);
    padding: 20px 24px;
    backdrop-filter: blur(14px);
}

.mai-prefs-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.mai-prefs-head h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.mai-prefs-head p {
    margin: 3px 0 0;
    color: var(--mai-text-muted);
    font-size: 13px;
}

.mai-prefs-label {
    display: block;
    margin: 12px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #c4b5fd;
}

.mai-prefs-select,
.mai-prefs textarea {
    width: 100%;
    border: 1px solid var(--mai-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--mai-text);
    padding: 11px 14px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}

.mai-prefs-select:focus,
.mai-prefs textarea:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.mai-prefs-select option {
    background: var(--mai-bg-soft);
    color: var(--mai-text);
}

.mai-prefs-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 14px;
}

.mai-prefs-status {
    color: #4ade80;
    font-size: 13px;
}

/* ---------- כרטיס בחירת תמונות בצ'אט ---------- */

.mai-chat-bubble.is-card {
    align-self: stretch;
    max-width: none;
    padding: 14px 16px;
}

.mai-image-card-head {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
}

.mai-image-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 10px;
    border-radius: var(--mai-radius-sm);
    background: rgba(255, 255, 255, 0.04);
    margin-bottom: 8px;
}

.mai-image-field-row.is-done {
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.mai-image-field-label {
    flex: 1;
    min-width: 120px;
    font-size: 13px;
    color: var(--mai-text-muted);
}

.mai-image-field-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mai-btn-sm {
    padding: 6px 12px;
    font-size: 12.5px;
    border-radius: 9px;
}

.mai-image-done {
    color: #4ade80;
    font-size: 13px;
    font-weight: 600;
}

.mai-image-mini {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--mai-border);
}

.mai-image-gallery {
    width: 100%;
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding-top: 8px;
    color: var(--mai-text-muted);
    font-size: 12.5px;
}

.mai-image-gallery img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--mai-border);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.mai-image-gallery img:hover {
    transform: scale(1.07);
    box-shadow: 0 0 0 2px var(--mai-violet);
}

.mai-image-skip {
    border: 0;
    background: transparent;
    color: var(--mai-text-muted);
    font-size: 12.5px;
    cursor: pointer;
    padding: 4px 2px;
    text-decoration: underline;
}

.mai-image-skip:hover {
    color: var(--mai-text);
}

/* ---------- מסך בית ללא גלילה + בחירת מוצר + גריד עיצובי ---------- */

.mai-home { height: 100vh; overflow: hidden; }
.mai-home-main { display: flex; flex-direction: column; padding: 10px 24px 18px; max-width: 1280px; overflow: hidden; }
.mai-home-hero { padding: clamp(8px, 3vh, 28px) 0 14px; }
.mai-home-name { font-size: clamp(28px, 4vw, 42px); }
.mai-home-summary { margin: 8px auto 12px; font-size: 15px; min-height: auto; }
.mai-home-question { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: #c4b5fd; text-align: center; }
.mai-product-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.mai-product-row .mai-btn-lg { padding: 12px 24px; font-size: 15px; }
.mai-design-grid { display: flex; align-items: center; gap: 7px; justify-content: center; margin-top: 14px; }
.mai-design-grid small { color: var(--mai-text-muted); font-size: 12px; }
.mai-design-grid span { width: 22px; height: 22px; border-radius: 7px; border: 1px solid rgba(255,255,255,0.2); display: inline-block; }
.mai-design-grid em { color: var(--mai-text-muted); font-size: 12px; font-style: normal; }
.mai-home-grid { flex: 1; min-height: 0; gap: 14px; }
.mai-home-card { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.mai-prefs { margin-top: 12px; padding: 12px 20px; max-height: 26vh; overflow-y: auto; scrollbar-width: thin; }
@media (max-width: 900px) { .mai-home { height: auto; overflow: auto; } }

/* אג'נדה פרוסה — למעלה, לא במרכז */
.mai-preview-pane { justify-content: flex-start; }
.mai-preview-canvas-wrap { margin-top: 4px; }

/* ---------- תובנות המחקר של המראיין ---------- */

.mai-insights {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(236, 72, 153, 0.06));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: var(--mai-radius);
    padding: 14px 18px;
    margin-bottom: 14px;
    backdrop-filter: blur(12px);
    animation: mai-bubble-in 0.3s ease both;
}

.mai-insights-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.mai-insights-head small {
    color: var(--mai-text-muted);
    font-size: 12px;
}

.mai-insights-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mai-insights-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.mai-insights-list li::before {
    content: "◆";
    color: var(--mai-violet);
    font-size: 10px;
    margin-top: 5px;
}

.mai-insight-text {
    flex: 1;
    font-size: 13.5px;
    line-height: 1.55;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: text;
}

.mai-insight-text:hover { background: rgba(255, 255, 255, 0.05); }
.mai-insight-text:focus { outline: none; background: rgba(255, 255, 255, 0.08); }

.mai-insight-del {
    border: 0;
    background: transparent;
    color: var(--mai-text-muted);
    cursor: pointer;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.15s;
}

.mai-insights-list li:hover .mai-insight-del { opacity: 1; }
.mai-insight-del:hover { color: #f87171; }

.mai-insight-add {
    border: 0;
    background: transparent;
    color: #c4b5fd;
    cursor: pointer;
    font-size: 12.5px;
    padding: 6px 2px 0;
}

.mai-insights.is-compact { padding: 10px 16px; }
.mai-insights.is-compact .mai-insights-list { max-height: 90px; overflow-y: auto; }

/* ---------- דירוג עיצוב (המערכת הלומדת) ---------- */

.mai-rating-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 12px;
    padding: 8px 18px;
    background: var(--mai-panel);
    border: 1px solid var(--mai-border);
    border-radius: 999px;
    width: fit-content;
    margin-inline: auto;
    backdrop-filter: blur(12px);
}

.mai-rating-label {
    color: var(--mai-text-muted);
    font-size: 13px;
    margin-inline-end: 8px;
}

.mai-rating-star {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.25);
    font-size: 21px;
    cursor: pointer;
    padding: 0 2px;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}

.mai-rating-star:hover {
    transform: scale(1.25);
    color: #fbbf24;
}

.mai-rating-star.is-on {
    color: #fbbf24;
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
}

/* ---------- שער כניסה (fallback ל-shortcode מוטמע) ---------- */

.mai-login-gate {
    text-align: center;
    padding: 48px 16px;
}

/* ---------- רספונסיב ---------- */

@media (max-width: 760px) {
    .mai-studio-body {
        flex-direction: column-reverse;
    }
    .mai-chat-pane {
        width: 100%;
        min-width: 0;
        height: 46vh;
        border-inline-end: 0;
        border-top: 1px solid var(--mai-border);
    }
    .mai-hero-steps {
        grid-template-columns: 1fr;
    }
    .mai-topbar {
        flex-wrap: wrap;
    }
    .mai-hero-deck {
        display: none;
    }
}
