/* ==== WIKI SPECIFIC LAYOUT ==== */
.wiki-orbs .orb-1 {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4), transparent 70%);
}

.wiki-orbs .orb-2 {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.4), transparent 70%);
}

.wiki-layout {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8rem 2rem 4rem;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 4rem;
    position: relative;
}

/* LEFT: Tutorial Content */
.wiki-content {
    padding-right: 2rem;
}

.tutorial-section {
    cursor: pointer;
    padding: 2rem;
    border-radius: 16px;
    border: 1px solid transparent;
    margin-bottom: 4rem;
    opacity: 0.3;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.tutorial-section:hover {
    background: rgba(255, 255, 255, 0.02);
    opacity: 0.6;
}

.tutorial-section.active-section {
    opacity: 1;
    transform: translateY(0);
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(15, 23, 42, 0.4);
}

.tutorial-section h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #a855f7 0%, #10b981 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tutorial-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #f8fafc;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.tutorial-section p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

.interactive-prompt {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
    padding: 1rem 1.5rem;
    border-radius: 0 12px 12px 0;
    margin: 2rem 0;
    font-size: 1.05rem;
    color: #bfdbfe;
    line-height: 1.6;
}

/* RIGHT: Simulator */
.wiki-simulator {
    position: relative;
    height: 100%;
}

.sticky-phone {
    position: sticky;
    top: 6rem;
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Simulator Overlays (True Dialogs) */
.sim-base-layer {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sim-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease forwards;
}

.sim-overlay.align-bottom {
    justify-content: flex-end;
}

.sim-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Create Manual Rule Dialog */
.compose-dialog {
    background: #1b212f;
    width: 90%;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dialog-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.compose-btn-outline {
    background: transparent;
    border: 1px solid #3b82f6;
    color: #60a5fa;
    border-radius: 24px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
}

.compose-textfield {
    position: relative;
    width: 100%;
}

.compose-row {
    display: flex;
    gap: 0.8rem;
    width: 100%;
}

.compose-textfield.half {
    flex: 1;
}

.compose-textfield input {
    width: 100%;
    background: transparent;
    border: 1px solid #334155;
    padding: 1rem;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.compose-textfield input:focus {
    border-color: #8b5cf6;
}

.compose-textfield input::placeholder {
    color: #94a3b8;
}

.compose-textfield.with-icon input {
    padding-right: 3rem;
}

.icon-btn.magic-wand-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fcd34d;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-btn.magic-wand-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-50%) scale(1.1);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 0.5rem;
}

.compose-btn-text {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
}

.compose-btn-filled {
    background: #334155;
    border: none;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    padding: 0.5rem 1.5rem;
    transition: background 0.2s;
}

.compose-btn-filled.active-style {
    background: #3b82f6;
    color: #fff;
}


/* Builder sheet (Bottom Sheet exactly matching image) */
.builder-sheet,
.snap-sheet {
    background: #19202e;
    width: 100%;
    height: 90%;
    border-radius: 24px 24px 0 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
    /* Prevent sheet from blowing out */
}

.bs-header,
.snap-header {
    flex-shrink: 0;
    /* Important: Don't let header squish */
}

.bs-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
}

.wand-icon {
    font-size: 1.2rem;
}

.bs-sub {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.bs-preview {
    background: #232238;
    /* Dark purplish like image */
    border-radius: 12px;
    padding: 1.5rem;
    color: #94a3b8;
    font-family: monospace;
    font-size: 0.9rem;
    min-height: 100px;
    margin-bottom: 1rem;
    word-break: break-all;
}

.bs-row-snap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.bs-snap-btn {
    background: transparent;
    border: 1px solid #3b82f6;
    color: #60a5fa;
    border-radius: 20px;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.bs-inputs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.bs-inputs-container::-webkit-scrollbar {
    display: none;
}

.bs-input {
    width: 100%;
    background: transparent;
    border: 1px solid #334155;
    padding: 1rem;
    border-radius: 6px;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.bs-input::placeholder {
    color: #94a3b8;
}

.bs-input-pair {
    display: flex;
    border: 1px solid #334155;
    border-radius: 6px;
    overflow: hidden;
}

.bs-prefix {
    background: transparent;
    color: #60a5fa;
    border: none;
    border-right: 1px solid #334155;
    padding: 0 1rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.bs-input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 1rem;
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.bs-input-field::placeholder {
    color: #94a3b8;
}

.drop-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: #e2e8f0;
    font-size: 0.8rem;
}

.drop-item button {
    background: transparent;
    border: 1px solid #3b82f6;
    color: #60a5fa;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
}

.bs-actions,
.snap-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #334155;
    flex-shrink: 0;
    /* Important: Don't let buttons go off-screen */
    background: #19202e;
}


/* Snapshot Picker Sheet */
.snap-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.snap-header h3 {
    font-size: 1.3rem;
    color: #60a5fa;
    font-weight: 700;
}

.snap-tabs {
    display: flex;
    background: #0f172a;
    border-radius: 20px;
    overflow: hidden;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

.tab-btn.active {
    background: #3b82f6;
    color: #fff;
}

/* Snap Content Area */
.snap-content {
    display: none;
    flex: 1;
    flex-direction: column;
    gap: 0.8rem;
    overflow-y: auto;
    padding-bottom: 1rem;
}

.snap-content.active {
    display: flex;
}

.snap-content::-webkit-scrollbar {
    display: none;
}

.snap-card {
    background: #1e293b;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.snap-card h5 {
    margin: 0;
}

.sc-title {
    font-size: 1rem;
    color: #60a5fa;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.sc-prop {
    font-size: 0.8rem;
    color: #94a3b8;
    font-family: monospace;
    line-height: 1.4;
}

.snap-card:hover {
    background: #334155;
}

.snap-card.target-node {
    border-color: #3b82f6;
}

.snap-overlay-box {
    position: absolute;
    top: 50%;
    left: 10%;
    width: 80%;
    height: 35px;
    background: rgba(59, 130, 246, 0.4);
    border: 2px solid #60a5fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.snap-overlay-box:hover {
    background: rgba(59, 130, 246, 0.6);
}

.snap-overlay-box.clicked {
    animation: flashBlue 0.4s ease forwards;
}

.snap-card.clicked {
    animation: flashBlue 0.4s ease forwards;
}

@keyframes flashBlue {
    0% {
        background: #3b82f6;
        color: #fff;
    }

    100% {
        background: #1e293b;
    }
}

/* BOTTOM NAVIGATION BAR */
.mock-bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-item.active {
    color: #3b82f6;
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 600;
}

/* CODE BLOCKS */
.code-block {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin: 2rem 0;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.code-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: #60a5fa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'Fira Code', monospace;
    font-weight: 600;
}

.code-block pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
    background: transparent;
}

.code-block code {
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    line-height: 1.7;
    color: #e2e8f0;
    white-space: pre;
}

.code-block pre::-webkit-scrollbar {
    height: 6px;
}

.code-block pre::-webkit-scrollbar-track {
    background: transparent;
}

.code-block pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.code-block pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 992px) {
    .wiki-layout {
        display: block;
        padding-top: 6rem;
        padding-left: 1rem;
        padding-right: 1rem;
        padding-bottom: 50vh;
        /* Make room for fixed simulator */
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .tutorial-section {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }

    .wiki-content {
        padding-right: 0;
        display: flex;
        flex-direction: column;
    }

    /* Fixed Split-Screen Simulator for Mobile */
    .wiki-simulator {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 48vh;
        z-index: 100;
        display: flex;
        justify-content: center;
        align-items: flex-end;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0;
        margin: 0;
        overflow: hidden;
    }

    .sticky-phone {
        margin: 0;
        transform: scale(0.65);
        transform-origin: bottom center;
        margin-bottom: -15px;
        /* Ensures the mock bottom nav sits perfectly flush */
        opacity: 1;
        pointer-events: auto;
    }

    /* Hide the mobile toggle button built for the previous floating design */
    .mobile-sim-toggle {
        display: none !important;
    }
}